diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2021-03-24 06:20:02 +0100 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2021-03-24 06:22:15 +0100 |
commit | 52a31bc4ae2806907194d32567a820c670670357 (patch) | |
tree | 0c5322c9c41fffe091d72834d9e5981f077e6c7b /test/transform/resource/after-ecj | |
parent | 3d7754e269ec84604d43be97a684bb26b519c6b9 (diff) | |
download | lombok-52a31bc4ae2806907194d32567a820c670670357.tar.gz lombok-52a31bc4ae2806907194d32567a820c670670357.tar.bz2 lombok-52a31bc4ae2806907194d32567a820c670670357.zip |
[records] [`@NonNull`] eclipse impl onfthe `@NonNull` on record components feature.
All tests passing.
Diffstat (limited to 'test/transform/resource/after-ecj')
23 files changed, 73 insertions, 41 deletions
diff --git a/test/transform/resource/after-ecj/BuilderSimpleOnRecord.java b/test/transform/resource/after-ecj/BuilderSimpleOnRecord.java index f7e3fff1..f866cd35 100644 --- a/test/transform/resource/after-ecj/BuilderSimpleOnRecord.java +++ b/test/transform/resource/after-ecj/BuilderSimpleOnRecord.java @@ -1,16 +1,22 @@ // version 14: import java.util.List; -@lombok.Builder(access = lombok.AccessLevel.PROTECTED) record BuilderSimpleOnRecord(List l, String a)<T> { +public @lombok.Builder(access = lombok.AccessLevel.PROTECTED) record BuilderSimpleOnRecord(List l, String a)<T> { protected static @java.lang.SuppressWarnings("all") class BuilderSimpleOnRecordBuilder<T> { private @java.lang.SuppressWarnings("all") List<T> l; private @java.lang.SuppressWarnings("all") String a; @java.lang.SuppressWarnings("all") BuilderSimpleOnRecordBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderSimpleOnRecord.BuilderSimpleOnRecordBuilder<T> l(final List<T> l) { this.l = l; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderSimpleOnRecord.BuilderSimpleOnRecordBuilder<T> a(final String a) { this.a = a; return this; diff --git a/test/transform/resource/after-ecj/BuilderSingularOnRecord.java b/test/transform/resource/after-ecj/BuilderSingularOnRecord.java index 3d16d326..2db38515 100644 --- a/test/transform/resource/after-ecj/BuilderSingularOnRecord.java +++ b/test/transform/resource/after-ecj/BuilderSingularOnRecord.java @@ -3,7 +3,7 @@ import java.util.Collection; import java.util.List; import lombok.Builder; import lombok.Singular; -@Builder record BuilderSingularOnRecord(List children, Collection scarves, List rawList)<T> { +public @Builder record BuilderSingularOnRecord(List children, Collection scarves, List rawList)<T> { public static @java.lang.SuppressWarnings("all") class BuilderSingularOnRecordBuilder<T> { private @java.lang.SuppressWarnings("all") java.util.ArrayList<T> children; private @java.lang.SuppressWarnings("all") java.util.ArrayList<Number> scarves; diff --git a/test/transform/resource/after-ecj/ConstructorsOnRecord.java b/test/transform/resource/after-ecj/ConstructorsOnRecord.java index ce01737c..f1d4feb4 100644 --- a/test/transform/resource/after-ecj/ConstructorsOnRecord.java +++ b/test/transform/resource/after-ecj/ConstructorsOnRecord.java @@ -2,7 +2,7 @@ import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; import lombok.RequiredArgsConstructor; -@AllArgsConstructor @RequiredArgsConstructor @NoArgsConstructor record ConstructorsOnRecord(String a, String b) { +public @AllArgsConstructor @RequiredArgsConstructor @NoArgsConstructor record ConstructorsOnRecord(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; public ConstructorsOnRecord(String a, String b) { diff --git a/test/transform/resource/after-ecj/DataOnRecord.java b/test/transform/resource/after-ecj/DataOnRecord.java index c9bd19f0..64ee28a2 100644 --- a/test/transform/resource/after-ecj/DataOnRecord.java +++ b/test/transform/resource/after-ecj/DataOnRecord.java @@ -1,6 +1,6 @@ // version 14: import lombok.Data; -@Data record DataOnRecord(String a, String b) { +public @Data record DataOnRecord(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; public DataOnRecord(String a, String b) { diff --git a/test/transform/resource/after-ecj/EqualsAndHashCodeOnRecord.java b/test/transform/resource/after-ecj/EqualsAndHashCodeOnRecord.java index 043f1233..583191e6 100644 --- a/test/transform/resource/after-ecj/EqualsAndHashCodeOnRecord.java +++ b/test/transform/resource/after-ecj/EqualsAndHashCodeOnRecord.java @@ -1,6 +1,6 @@ // version 14: import lombok.EqualsAndHashCode; -@EqualsAndHashCode record EqualsAndHashCodeOnRecord(String a, String b) { +public @EqualsAndHashCode record EqualsAndHashCodeOnRecord(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; public EqualsAndHashCodeOnRecord(String a, String b) { diff --git a/test/transform/resource/after-ecj/FieldDefaultsOnRecord.java b/test/transform/resource/after-ecj/FieldDefaultsOnRecord.java index 54795ef6..cc1a23b3 100644 --- a/test/transform/resource/after-ecj/FieldDefaultsOnRecord.java +++ b/test/transform/resource/after-ecj/FieldDefaultsOnRecord.java @@ -1,5 +1,5 @@ // version 14: -@lombok.experimental.FieldDefaults(makeFinal = true) record FieldDefaultsOnRecord(String a, String b) { +public @lombok.experimental.FieldDefaults(makeFinal = true) record FieldDefaultsOnRecord(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; public FieldDefaultsOnRecord(String a, String b) { diff --git a/test/transform/resource/after-ecj/FieldNameConstantsOnRecord.java b/test/transform/resource/after-ecj/FieldNameConstantsOnRecord.java index 6499ed4a..5d3b01da 100644 --- a/test/transform/resource/after-ecj/FieldNameConstantsOnRecord.java +++ b/test/transform/resource/after-ecj/FieldNameConstantsOnRecord.java @@ -1,7 +1,7 @@ // version 14: import lombok.experimental.FieldNameConstants; import lombok.AccessLevel; -@FieldNameConstants(level = AccessLevel.PACKAGE) record FieldNameConstantsOnRecord(String iAmADvdPlayer, int $skipMe, int andMe, String butPrintMePlease) { +public @FieldNameConstants(level = AccessLevel.PACKAGE) record FieldNameConstantsOnRecord(String iAmADvdPlayer, int $skipMe, int andMe, String butPrintMePlease) { static final @java.lang.SuppressWarnings("all") class Fields { public static final java.lang.String iAmADvdPlayer = "iAmADvdPlayer"; public static final java.lang.String butPrintMePlease = "butPrintMePlease"; diff --git a/test/transform/resource/after-ecj/GetterOnRecord.java b/test/transform/resource/after-ecj/GetterOnRecord.java index f694ef8b..8ce516bf 100644 --- a/test/transform/resource/after-ecj/GetterOnRecord.java +++ b/test/transform/resource/after-ecj/GetterOnRecord.java @@ -1,6 +1,6 @@ // version 14: import lombok.Getter; -@Getter record GetterOnRecord(String a, String b) { +public @Getter record GetterOnRecord(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; public GetterOnRecord(String a, String b) { diff --git a/test/transform/resource/after-ecj/LoggerConfigOnRecord.java b/test/transform/resource/after-ecj/LoggerConfigOnRecord.java index c97b7925..3e12cbff 100644 --- a/test/transform/resource/after-ecj/LoggerConfigOnRecord.java +++ b/test/transform/resource/after-ecj/LoggerConfigOnRecord.java @@ -1,6 +1,6 @@ // version 14: import lombok.extern.slf4j.Slf4j; -@Slf4j record LoggerConfigOnRecord(String a, String b) { +public @Slf4j record LoggerConfigOnRecord(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; public LoggerConfigOnRecord(String a, String b) { diff --git a/test/transform/resource/after-ecj/LoggerSlf4jOnRecord.java b/test/transform/resource/after-ecj/LoggerSlf4jOnRecord.java index 20a84d0d..673f83a3 100644 --- a/test/transform/resource/after-ecj/LoggerSlf4jOnRecord.java +++ b/test/transform/resource/after-ecj/LoggerSlf4jOnRecord.java @@ -1,6 +1,6 @@ // version 14: import lombok.extern.slf4j.Slf4j; -@Slf4j record LoggerSlf4jOnRecord(org log, String a) { +public @Slf4j record LoggerSlf4jOnRecord(org log, String a) { private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jOnRecord.class); /* Implicit */ private final String a; /* Implicit */ private final String b; diff --git a/test/transform/resource/after-ecj/NonNullExistingConstructorOnRecord.java b/test/transform/resource/after-ecj/NonNullExistingConstructorOnRecord.java index dbf2abe8..6f351854 100644 --- a/test/transform/resource/after-ecj/NonNullExistingConstructorOnRecord.java +++ b/test/transform/resource/after-ecj/NonNullExistingConstructorOnRecord.java @@ -1,21 +1,16 @@ // version 14: import lombok.NonNull; -record NonNullOnRecord(String a, String b) { +public record NonNullExistingConstructorOnRecord(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; - public NonNullOnRecord(String a, String b) { - super(); - .a = a; - .b = b; - } - public NonNullOnRecord(@NonNull String b) { + public NonNullExistingConstructorOnRecord(@NonNull String b) { this("default", b); if ((b == null)) { throw new java.lang.NullPointerException("b is marked non-null but is null"); } } - public @java.lang.SuppressWarnings("all") NonNullOnRecord(final String a, final String b) { + public @java.lang.SuppressWarnings("all") NonNullExistingConstructorOnRecord(@NonNull String a, @NonNull String b) { super(); if ((a == null)) { diff --git a/test/transform/resource/after-ecj/NonNullOnRecord.java b/test/transform/resource/after-ecj/NonNullOnRecord.java index c8efdbe6..d80e243b 100644 --- a/test/transform/resource/after-ecj/NonNullOnRecord.java +++ b/test/transform/resource/after-ecj/NonNullOnRecord.java @@ -1,21 +1,9 @@ // version 14: import lombok.NonNull; -record NonNullOnRecord(String a, String b) { +public record NonNullOnRecord(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; - public NonNullOnRecord(String a, String b) { - super(); - .a = a; - .b = b; - } - public void method(@NonNull String param) { - if ((param == null)) - { - throw new java.lang.NullPointerException("param is marked non-null but is null"); - } - String asd = "a"; - } - public @java.lang.SuppressWarnings("all") NonNullOnRecord(final String a, final String b) { + public @java.lang.SuppressWarnings("all") NonNullOnRecord(@NonNull String a, @NonNull String b) { super(); if ((a == null)) { diff --git a/test/transform/resource/after-ecj/NonNullOnRecord2.java b/test/transform/resource/after-ecj/NonNullOnRecord2.java new file mode 100644 index 00000000..5820d453 --- /dev/null +++ b/test/transform/resource/after-ecj/NonNullOnRecord2.java @@ -0,0 +1,14 @@ +// version 14: +import lombok.NonNull; +record NonNullOnRecord2(String a) { +/* Implicit */ private final String a; + public NonNullOnRecord2(@NonNull String a) { + super(); + if ((a == null)) + { + throw new java.lang.NullPointerException("a is marked non-null but is null"); + } + System.out.println("Hello"); + this.a = a; + } +} diff --git a/test/transform/resource/after-ecj/NonNullOnRecord3.java b/test/transform/resource/after-ecj/NonNullOnRecord3.java new file mode 100644 index 00000000..44c00098 --- /dev/null +++ b/test/transform/resource/after-ecj/NonNullOnRecord3.java @@ -0,0 +1,20 @@ +// version 14: +import lombok.NonNull; +public record NonNullOnRecord3(String a) { +/* Implicit */ private final String a; + public NonNullOnRecord3(String a) { + super(); + .a = a; + } + public NonNullOnRecord3(String a) { + super(); + this.a = a; + } + public void method(@NonNull String param) { + if ((param == null)) + { + throw new java.lang.NullPointerException("param is marked non-null but is null"); + } + String asd = "a"; + } +} diff --git a/test/transform/resource/after-ecj/SetterOnRecord.java b/test/transform/resource/after-ecj/SetterOnRecord.java index d0103759..e65eb1bd 100644 --- a/test/transform/resource/after-ecj/SetterOnRecord.java +++ b/test/transform/resource/after-ecj/SetterOnRecord.java @@ -1,6 +1,6 @@ // version 14: import lombok.Setter; -@Setter record SetterOnRecord(String a, String b) { +public @Setter record SetterOnRecord(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; public SetterOnRecord(String a, String b) { diff --git a/test/transform/resource/after-ecj/SynchronizedInRecord.java b/test/transform/resource/after-ecj/SynchronizedInRecord.java index f90a85e2..b4dc3770 100644 --- a/test/transform/resource/after-ecj/SynchronizedInRecord.java +++ b/test/transform/resource/after-ecj/SynchronizedInRecord.java @@ -1,5 +1,5 @@ import lombok.Synchronized; -record SynchronizedInRecord(java $lock, String a) { +public record SynchronizedInRecord(java $lock, String a) { private final java.lang.Object $lock = new java.lang.Object[0]; /* Implicit */ private final String a; /* Implicit */ private final String b; diff --git a/test/transform/resource/after-ecj/ToStringOnRecord.java b/test/transform/resource/after-ecj/ToStringOnRecord.java index 68caa235..9ca18e8c 100644 --- a/test/transform/resource/after-ecj/ToStringOnRecord.java +++ b/test/transform/resource/after-ecj/ToStringOnRecord.java @@ -1,6 +1,6 @@ // version 14: import lombok.ToString; -@ToString record ToStringOnRecord(String a, String b) { +public @ToString record ToStringOnRecord(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; public ToStringOnRecord(String a, String b) { diff --git a/test/transform/resource/after-ecj/UtilityClassOnRecord.java b/test/transform/resource/after-ecj/UtilityClassOnRecord.java index 0c0c138f..8ffa8909 100644 --- a/test/transform/resource/after-ecj/UtilityClassOnRecord.java +++ b/test/transform/resource/after-ecj/UtilityClassOnRecord.java @@ -1,6 +1,6 @@ // version 14: import lombok.experimental.UtilityClass; -@UtilityClass record UtilityClassOnRecord(String a, String b) { +public @UtilityClass record UtilityClassOnRecord(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; public UtilityClassOnRecord(String a, String b) { diff --git a/test/transform/resource/after-ecj/ValueOnRecord.java b/test/transform/resource/after-ecj/ValueOnRecord.java index f1623ed3..47535305 100644 --- a/test/transform/resource/after-ecj/ValueOnRecord.java +++ b/test/transform/resource/after-ecj/ValueOnRecord.java @@ -1,6 +1,6 @@ // version 14: import lombok.Value; -@Value record ValueOnRecord(String a, String b) { +public @Value record ValueOnRecord(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; public ValueOnRecord(String a, String b) { diff --git a/test/transform/resource/after-ecj/WithByOnRecord.java b/test/transform/resource/after-ecj/WithByOnRecord.java index 8f179407..161382d9 100644 --- a/test/transform/resource/after-ecj/WithByOnRecord.java +++ b/test/transform/resource/after-ecj/WithByOnRecord.java @@ -1,6 +1,6 @@ // version 14: import lombok.experimental.WithBy; -@WithBy record WithByOnRecord(String a, String b) { +public @WithBy record WithByOnRecord(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; public WithByOnRecord(String a, String b) { diff --git a/test/transform/resource/after-ecj/WithByOnRecordComponent.java b/test/transform/resource/after-ecj/WithByOnRecordComponent.java index 5ee14810..efc62161 100644 --- a/test/transform/resource/after-ecj/WithByOnRecordComponent.java +++ b/test/transform/resource/after-ecj/WithByOnRecordComponent.java @@ -1,6 +1,6 @@ // version 14: import lombok.experimental.WithBy; -record WithByOnRecordComponent(String a, String b) { +public record WithByOnRecordComponent(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; public WithByOnRecordComponent( String a, String b) { diff --git a/test/transform/resource/after-ecj/WithOnRecord.java b/test/transform/resource/after-ecj/WithOnRecord.java index 2b24147a..d62bbfab 100644 --- a/test/transform/resource/after-ecj/WithOnRecord.java +++ b/test/transform/resource/after-ecj/WithOnRecord.java @@ -1,6 +1,6 @@ // version 14: import lombok.With; -@With record WithOnRecord(String a, String b) { +public @With record WithOnRecord(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; public WithOnRecord(String a, String b) { @@ -8,9 +8,15 @@ import lombok.With; .a = a; .b = b; } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WithOnRecord withA(final String a) { return ((this.a == a) ? this : new WithOnRecord(a, this.b)); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WithOnRecord withB(final String b) { return ((this.b == b) ? this : new WithOnRecord(this.a, b)); } diff --git a/test/transform/resource/after-ecj/WithOnRecordComponent.java b/test/transform/resource/after-ecj/WithOnRecordComponent.java index d1a602a6..a141fa46 100644 --- a/test/transform/resource/after-ecj/WithOnRecordComponent.java +++ b/test/transform/resource/after-ecj/WithOnRecordComponent.java @@ -1,6 +1,6 @@ // version 14: import lombok.With; -record WithOnRecordComponent(String a, String b) { +public record WithOnRecordComponent(String a, String b) { /* Implicit */ private final String a; /* Implicit */ private final String b; public WithOnRecordComponent( String a, String b) { @@ -8,6 +8,9 @@ record WithOnRecordComponent(String a, String b) { .a = a; .b = b; } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WithOnRecordComponent withA(final String a) { return ((this.a == a) ? this : new WithOnRecordComponent(a, this.b)); } |