-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3482 from Rawi01/getter-lazy
Keep initializer position for lazy getter
- Loading branch information
Showing
10 changed files
with
77 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
test/transform/resource/after-delombok/GetterLazyErrorPosition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class GetterLazyErrorPosition { | ||
private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> field = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); | ||
|
||
@java.lang.SuppressWarnings({"all", "unchecked"}) | ||
public String getField() { | ||
java.lang.Object value = this.field.get(); | ||
if (value == null) { | ||
synchronized (this.field) { | ||
value = this.field.get(); | ||
if (value == null) { | ||
final String actualValue = true ? "" : new ErrorPosition(); | ||
value = actualValue == null ? this.field : actualValue; | ||
this.field.set(value); | ||
} | ||
} | ||
} | ||
return (String) (value == this.field ? null : value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//platform javac: positions in eclipse are hard... | ||
class GetterLazyErrorPosition { | ||
@lombok.Getter(lazy=true) | ||
private final String field = | ||
true ? | ||
"" : | ||
new ErrorPosition(); | ||
} |
1 change: 1 addition & 0 deletions
1
test/transform/resource/messages-delombok/GetterLazyErrorPosition.java.messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
7 cannot find symbol |
1 change: 1 addition & 0 deletions
1
test/transform/resource/messages-idempotent/GetterLazyErrorPosition.java.messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
11 cannot find symbol |