Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions samples/sample/src/main/java/demo/RootScope.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public interface RootScope {
@motif.Objects
abstract class Objects {

abstract Bar bar();
public abstract Bar bar();

String foo(int param) {
public String foo(int param) {
return String.valueOf(param);
}
}
Expand Down
4 changes: 2 additions & 2 deletions samples/sample/src/main/java/demo/RootScope2.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public interface RootScope2 {
@motif.Objects
abstract class Objects {

abstract Bar bar();
public abstract Bar bar();

String foo(int param) {
public String foo(int param) {
return String.valueOf(param);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ public interface RootScope {
@motif.Objects
abstract class Objects {

abstract Bar bar();
public abstract Bar bar();

String foo(int param) {
public String foo(int param) {
return String.valueOf(param);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public interface Dependencies {
private static class Objects extends RootScope.Objects {

@Override
Bar bar() {
public Bar bar() {
throw new UnsupportedOperationException();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public interface RootScope {
@motif.Objects
abstract class Objects {

abstract Bar bar();
public abstract Bar bar();

String foo(int param) {
public String foo(int param) {
return String.valueOf(param);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package motif.sample.app.root.manual_2;

import demo.Bar;
import motif.internal.Initialized;

public class RootScopeImpl implements RootScope {

Expand All @@ -22,7 +21,7 @@ public String foo() {
return string();
}

RootScope rootScope2() {
RootScope rootScope() {
return this;
}

Expand All @@ -32,13 +31,13 @@ Bar bar() {
synchronized (this) {
if (bar == null) {
_bar = new Bar();
if (_bar == null) {
throw new NullPointerException("Factory method cannot return null");
}
Comment on lines +34 to +36
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is motif spec that null is not supported in factory method

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can return null if we don't have the null annotation.

bar = _bar;
}
}
}
if (_bar == Initialized.INITIALIZED) {
return null;
}
Comment on lines -39 to -41
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now those unnecessary code has been deleted

return (Bar) _bar;
}

Expand All @@ -49,15 +48,12 @@ String string() {
if (string == null) {
_string = objects.foo(integer());
if (_string == null) {
_string = Initialized.INITIALIZED;
throw new NullPointerException("Factory method cannot return null");
}
string = _string;
}
}
}
if (_string == Initialized.INITIALIZED) {
return null;
}
return (String) _string;
}

Expand All @@ -70,7 +66,7 @@ public interface Dependencies {
/**
* <ul>
* Requested from:
* <li>{@link demo.RootScope2.Objects#foo(int)}</li>
* <li>{@link demo.RootScope.Objects#foo(int)}</li>
* </ul>
*/
int integer();
Expand All @@ -79,7 +75,7 @@ public interface Dependencies {
private static class Objects extends RootScope.Objects {

@Override
Bar bar() {
public Bar bar() {
throw new UnsupportedOperationException();
}
}
Expand Down
Loading