-
-
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.
Fixes #1236: Getter(lazy=true) now emits an error when used on a tran…
…sient field
- Loading branch information
Showing
8 changed files
with
79 additions
and
4 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
26 changes: 26 additions & 0 deletions
26
test/transform/resource/after-delombok/GetterLazyTransient.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,26 @@ | ||
class GetterLazyTransient { | ||
private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> nonTransientField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); | ||
private final transient int transientField = 2; | ||
private final transient int nonLazyTransientField = 3; | ||
@java.lang.SuppressWarnings("all") | ||
@javax.annotation.Generated("lombok") | ||
public int getNonTransientField() { | ||
java.lang.Object value = this.nonTransientField.get(); | ||
if (value == null) { | ||
synchronized (this.nonTransientField) { | ||
value = this.nonTransientField.get(); | ||
if (value == null) { | ||
final int actualValue = 1; | ||
value = actualValue; | ||
this.nonTransientField.set(value); | ||
} | ||
} | ||
} | ||
return (java.lang.Integer) value; | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
@javax.annotation.Generated("lombok") | ||
public int getNonLazyTransientField() { | ||
return this.nonLazyTransientField; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
test/transform/resource/after-ecj/GetterLazyTransient.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,28 @@ | ||
class GetterLazyTransient { | ||
private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.lang.Object> nonTransientField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); | ||
private final transient @lombok.Getter(lazy = true) int transientField = 2; | ||
private final transient @lombok.Getter int nonLazyTransientField = 3; | ||
GetterLazyTransient() { | ||
super(); | ||
} | ||
public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") int getNonTransientField() { | ||
java.lang.Object value = this.nonTransientField.get(); | ||
if ((value == null)) | ||
{ | ||
synchronized (this.nonTransientField) | ||
{ | ||
value = this.nonTransientField.get(); | ||
if ((value == null)) | ||
{ | ||
final int actualValue = 1; | ||
value = actualValue; | ||
this.nonTransientField.set(value); | ||
} | ||
} | ||
} | ||
return (java.lang.Integer) value; | ||
} | ||
public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") int getNonLazyTransientField() { | ||
return this.nonLazyTransientField; | ||
} | ||
} |
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,10 @@ | ||
class GetterLazyTransient { | ||
@lombok.Getter(lazy=true) | ||
private final int nonTransientField = 1; | ||
|
||
@lombok.Getter(lazy=true) | ||
private final transient int transientField = 2; | ||
|
||
@lombok.Getter | ||
private final transient int nonLazyTransientField = 3; | ||
} |
1 change: 1 addition & 0 deletions
1
test/transform/resource/messages-delombok/GetterLazyTransient.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 @@ | ||
5 'lazy' is not supported on transient fields. |
1 change: 1 addition & 0 deletions
1
test/transform/resource/messages-ecj/GetterLazyTransient.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 @@ | ||
5 'lazy' is not supported on transient fields. |