aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/pretty/resource/after/RecordPattern19.java (renamed from test/pretty/resource/after/RecordPattern.java)4
-rw-r--r--test/pretty/resource/after/RecordPattern20.java22
-rw-r--r--test/pretty/resource/before/RecordPattern19.java (renamed from test/pretty/resource/before/RecordPattern.java)6
-rw-r--r--test/pretty/resource/before/RecordPattern20.java23
-rw-r--r--test/stubs/jakarta/annotation/Nonnull.java9
-rw-r--r--test/stubs/jakarta/annotation/Nullable.java9
-rw-r--r--test/transform/resource/after-delombok/NonNullOnRecordExistingConstructor.java (renamed from test/transform/resource/after-delombok/NonNullOnRecord2.java)4
-rw-r--r--test/transform/resource/after-delombok/NonNullOnRecordExistingSetter.java (renamed from test/transform/resource/after-delombok/NonNullOnRecord3.java)4
-rw-r--r--test/transform/resource/after-delombok/NonNullOnRecordSimple.java (renamed from test/transform/resource/after-delombok/NonNullOnRecord.java)4
-rw-r--r--test/transform/resource/after-delombok/NonNullOnRecordTypeUse.java13
-rw-r--r--test/transform/resource/after-delombok/NullLibrary3.java59
-rw-r--r--test/transform/resource/after-ecj/NonNullOnRecordExistingConstructor.java (renamed from test/transform/resource/after-ecj/NonNullOnRecord2.java)4
-rw-r--r--test/transform/resource/after-ecj/NonNullOnRecordExistingSetter.java (renamed from test/transform/resource/after-ecj/NonNullOnRecord3.java)4
-rw-r--r--test/transform/resource/after-ecj/NonNullOnRecordSimple.java (renamed from test/transform/resource/after-ecj/NonNullOnRecord.java)4
-rw-r--r--test/transform/resource/after-ecj/NonNullOnRecordTypeUse.java21
-rw-r--r--test/transform/resource/after-ecj/NullLibrary3.java48
-rw-r--r--test/transform/resource/before/NonNullOnRecord.java6
-rw-r--r--test/transform/resource/before/NonNullOnRecord2.java9
-rw-r--r--test/transform/resource/before/NonNullOnRecordExistingConstructor.java9
-rw-r--r--test/transform/resource/before/NonNullOnRecordExistingSetter.java (renamed from test/transform/resource/before/NonNullOnRecord3.java)4
-rw-r--r--test/transform/resource/before/NonNullOnRecordSimple.java6
-rw-r--r--test/transform/resource/before/NonNullOnRecordTypeUse.java6
-rw-r--r--test/transform/resource/before/NullLibrary3.java8
-rw-r--r--test/transform/resource/before/RecordNonNull0
24 files changed, 252 insertions, 34 deletions
diff --git a/test/pretty/resource/after/RecordPattern.java b/test/pretty/resource/after/RecordPattern19.java
index ad9fae0b..68b39266 100644
--- a/test/pretty/resource/after/RecordPattern.java
+++ b/test/pretty/resource/after/RecordPattern19.java
@@ -3,13 +3,13 @@ record Point(int x, int y) {
record Rectangle(Point upperLeft, Point lowerRight) {
}
-public class RecordPattern {
+public class RecordPattern19 {
void recordPattern(Object o) {
if (o instanceof Point(int x, int y)) {
}
if (o instanceof Point(int x, int y) p) {
}
- if (o instanceof Rectangle(Point(int x1, int y1), Point(int x2, int y2))) {
+ if (o instanceof Rectangle(Point(var x1, var y1), Point(int x2, int y2))) {
}
}
} \ No newline at end of file
diff --git a/test/pretty/resource/after/RecordPattern20.java b/test/pretty/resource/after/RecordPattern20.java
new file mode 100644
index 00000000..365b139f
--- /dev/null
+++ b/test/pretty/resource/after/RecordPattern20.java
@@ -0,0 +1,22 @@
+record Point(int x, int y) {
+}
+record Rectangle(Point upperLeft, Point lowerRight) {
+}
+
+public class RecordPattern20 {
+ void recordPattern(Object o) {
+ if (o instanceof Point(int x, int y)) {
+ }
+ if (o instanceof Rectangle(Point(var x1, var y1), Point(int x2, int y2))) {
+ }
+ }
+
+ void forEachSimple(Point[] pointArray) {
+ for (Point(var x, var y) : pointArray) {
+ }
+ }
+ void forEachNested(Rectangle[] rectangleArray) {
+ for (Rectangle(Point(var x1, var y1), Point p) : rectangleArray) {
+ }
+ }
+} \ No newline at end of file
diff --git a/test/pretty/resource/before/RecordPattern.java b/test/pretty/resource/before/RecordPattern19.java
index 93c07965..4c417174 100644
--- a/test/pretty/resource/before/RecordPattern.java
+++ b/test/pretty/resource/before/RecordPattern19.java
@@ -1,16 +1,16 @@
-// version 19:
+// version 19:19
record Point(int x, int y) {
}
record Rectangle(Point upperLeft, Point lowerRight) {
}
-public class RecordPattern {
+public class RecordPattern19 {
void recordPattern(Object o) {
if (o instanceof Point(int x, int y)) {
}
if (o instanceof Point(int x, int y) p) {
}
- if (o instanceof Rectangle(Point(int x1, int y1), Point(int x2, int y2))) {
+ if (o instanceof Rectangle(Point(var x1, var y1), Point(int x2, int y2))) {
}
}
} \ No newline at end of file
diff --git a/test/pretty/resource/before/RecordPattern20.java b/test/pretty/resource/before/RecordPattern20.java
new file mode 100644
index 00000000..8604215b
--- /dev/null
+++ b/test/pretty/resource/before/RecordPattern20.java
@@ -0,0 +1,23 @@
+// version 20:
+record Point(int x, int y) {
+}
+record Rectangle(Point upperLeft, Point lowerRight) {
+}
+
+public class RecordPattern20 {
+ void recordPattern(Object o) {
+ if (o instanceof Point(int x, int y)) {
+ }
+ if (o instanceof Rectangle(Point(var x1, var y1), Point(int x2, int y2))) {
+ }
+ }
+
+ void forEachSimple(Point[] pointArray) {
+ for (Point(var x, var y) : pointArray) {
+ }
+ }
+ void forEachNested(Rectangle[] rectangleArray) {
+ for (Rectangle(Point(var x1, var y1), Point p) : rectangleArray) {
+ }
+ }
+} \ No newline at end of file
diff --git a/test/stubs/jakarta/annotation/Nonnull.java b/test/stubs/jakarta/annotation/Nonnull.java
new file mode 100644
index 00000000..c5a985ee
--- /dev/null
+++ b/test/stubs/jakarta/annotation/Nonnull.java
@@ -0,0 +1,9 @@
+package jakarta.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Nonnull {}
diff --git a/test/stubs/jakarta/annotation/Nullable.java b/test/stubs/jakarta/annotation/Nullable.java
new file mode 100644
index 00000000..6ff82ce8
--- /dev/null
+++ b/test/stubs/jakarta/annotation/Nullable.java
@@ -0,0 +1,9 @@
+package jakarta.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Nullable {}
diff --git a/test/transform/resource/after-delombok/NonNullOnRecord2.java b/test/transform/resource/after-delombok/NonNullOnRecordExistingConstructor.java
index d3021350..e3fdc2fc 100644
--- a/test/transform/resource/after-delombok/NonNullOnRecord2.java
+++ b/test/transform/resource/after-delombok/NonNullOnRecordExistingConstructor.java
@@ -1,7 +1,7 @@
// version 16:
import lombok.NonNull;
-record NonNullOnRecord2(@NonNull String a) {
- public NonNullOnRecord2 {
+public record NonNullOnRecordExistingConstructor(@NonNull String a) {
+ public NonNullOnRecordExistingConstructor {
if (a == null) {
throw new java.lang.NullPointerException("a is marked non-null but is null");
}
diff --git a/test/transform/resource/after-delombok/NonNullOnRecord3.java b/test/transform/resource/after-delombok/NonNullOnRecordExistingSetter.java
index 62b385bc..11aaca49 100644
--- a/test/transform/resource/after-delombok/NonNullOnRecord3.java
+++ b/test/transform/resource/after-delombok/NonNullOnRecordExistingSetter.java
@@ -1,7 +1,7 @@
// version 14:
import lombok.NonNull;
-public record NonNullOnRecord3(@NonNull String a) {
- public NonNullOnRecord3(String a) {
+public record NonNullOnRecordExistingSetter(@NonNull String a) {
+ public NonNullOnRecordExistingSetter(String a) {
this.a = a;
}
public void method(@NonNull String param) {
diff --git a/test/transform/resource/after-delombok/NonNullOnRecord.java b/test/transform/resource/after-delombok/NonNullOnRecordSimple.java
index 465c30db..2a772c93 100644
--- a/test/transform/resource/after-delombok/NonNullOnRecord.java
+++ b/test/transform/resource/after-delombok/NonNullOnRecordSimple.java
@@ -1,8 +1,8 @@
// version 16:
import lombok.NonNull;
-public record NonNullOnRecord(@NonNull String a, @NonNull String b) {
+public record NonNullOnRecordSimple(@NonNull String a, @NonNull String b) {
@java.lang.SuppressWarnings("all")
- public NonNullOnRecord {
+ public NonNullOnRecordSimple {
if (a == null) {
throw new java.lang.NullPointerException("a is marked non-null but is null");
}
diff --git a/test/transform/resource/after-delombok/NonNullOnRecordTypeUse.java b/test/transform/resource/after-delombok/NonNullOnRecordTypeUse.java
new file mode 100644
index 00000000..e5b78f1c
--- /dev/null
+++ b/test/transform/resource/after-delombok/NonNullOnRecordTypeUse.java
@@ -0,0 +1,13 @@
+// version 16:
+import lombok.NonNull;
+public record NonNullOnRecordTypeUse(@NonNull int[] a, int @NonNull [] b, int[] @NonNull [] c) {
+ @java.lang.SuppressWarnings("all")
+ public NonNullOnRecordTypeUse {
+ if (a == null) {
+ throw new java.lang.NullPointerException("a is marked non-null but is null");
+ }
+ if (b == null) {
+ throw new java.lang.NullPointerException("b is marked non-null but is null");
+ }
+ }
+}
diff --git a/test/transform/resource/after-delombok/NullLibrary3.java b/test/transform/resource/after-delombok/NullLibrary3.java
new file mode 100644
index 00000000..ee7c5296
--- /dev/null
+++ b/test/transform/resource/after-delombok/NullLibrary3.java
@@ -0,0 +1,59 @@
+public class NullLibrary3 {
+ @jakarta.annotation.Nonnull
+ String foo;
+
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(@jakarta.annotation.Nullable final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof NullLibrary3)) return false;
+ final NullLibrary3 other = (NullLibrary3) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ final java.lang.Object this$foo = this.foo;
+ final java.lang.Object other$foo = other.foo;
+ if (this$foo == null ? other$foo != null : !this$foo.equals(other$foo)) return false;
+ return true;
+ }
+
+ @java.lang.SuppressWarnings("all")
+ protected boolean canEqual(@jakarta.annotation.Nullable final java.lang.Object other) {
+ return other instanceof NullLibrary3;
+ }
+
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ final java.lang.Object $foo = this.foo;
+ result = result * PRIME + ($foo == null ? 43 : $foo.hashCode());
+ return result;
+ }
+
+ @jakarta.annotation.Nonnull
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "NullLibrary3(foo=" + this.foo + ")";
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public NullLibrary3(@jakarta.annotation.Nonnull final String foo) {
+ if (foo == null) {
+ throw new java.lang.NullPointerException("foo is marked non-null but is null");
+ }
+ this.foo = foo;
+ }
+
+ /**
+ * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed).
+ */
+ @jakarta.annotation.Nonnull
+ @java.lang.SuppressWarnings("all")
+ public NullLibrary3 withFoo(@jakarta.annotation.Nonnull final String foo) {
+ if (foo == null) {
+ throw new java.lang.NullPointerException("foo is marked non-null but is null");
+ }
+ return this.foo == foo ? this : new NullLibrary3(foo);
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/NonNullOnRecord2.java b/test/transform/resource/after-ecj/NonNullOnRecordExistingConstructor.java
index 5820d453..4323113f 100644
--- a/test/transform/resource/after-ecj/NonNullOnRecord2.java
+++ b/test/transform/resource/after-ecj/NonNullOnRecordExistingConstructor.java
@@ -1,8 +1,8 @@
// version 14:
import lombok.NonNull;
-record NonNullOnRecord2(String a) {
+public record NonNullOnRecordExistingConstructor(String a) {
/* Implicit */ private final String a;
- public NonNullOnRecord2(@NonNull String a) {
+ public NonNullOnRecordExistingConstructor(@NonNull String a) {
super();
if ((a == null))
{
diff --git a/test/transform/resource/after-ecj/NonNullOnRecord3.java b/test/transform/resource/after-ecj/NonNullOnRecordExistingSetter.java
index 37f0afcf..1bdaf29f 100644
--- a/test/transform/resource/after-ecj/NonNullOnRecord3.java
+++ b/test/transform/resource/after-ecj/NonNullOnRecordExistingSetter.java
@@ -1,8 +1,8 @@
// version 19:
import lombok.NonNull;
-public record NonNullOnRecord3(String a) {
+public record NonNullOnRecordExistingSetter(String a) {
/* Implicit */ private final String a;
- public NonNullOnRecord3(String a) {
+ public NonNullOnRecordExistingSetter(String a) {
super();
this.a = a;
}
diff --git a/test/transform/resource/after-ecj/NonNullOnRecord.java b/test/transform/resource/after-ecj/NonNullOnRecordSimple.java
index d80e243b..ee1510ea 100644
--- a/test/transform/resource/after-ecj/NonNullOnRecord.java
+++ b/test/transform/resource/after-ecj/NonNullOnRecordSimple.java
@@ -1,9 +1,9 @@
// version 14:
import lombok.NonNull;
-public record NonNullOnRecord(String a, String b) {
+public record NonNullOnRecordSimple(String a, String b) {
/* Implicit */ private final String a;
/* Implicit */ private final String b;
- public @java.lang.SuppressWarnings("all") NonNullOnRecord(@NonNull String a, @NonNull String b) {
+ public @java.lang.SuppressWarnings("all") NonNullOnRecordSimple(@NonNull String a, @NonNull String b) {
super();
if ((a == null))
{
diff --git a/test/transform/resource/after-ecj/NonNullOnRecordTypeUse.java b/test/transform/resource/after-ecj/NonNullOnRecordTypeUse.java
new file mode 100644
index 00000000..4f040c2e
--- /dev/null
+++ b/test/transform/resource/after-ecj/NonNullOnRecordTypeUse.java
@@ -0,0 +1,21 @@
+// version 14:
+import lombok.NonNull;
+public record NonNullOnRecordTypeUse(int a, int b, int c) {
+/* Implicit */ private final int[] a;
+/* Implicit */ private final int @NonNull [] b;
+/* Implicit */ private final int[] @NonNull [] c;
+ public @java.lang.SuppressWarnings("all") NonNullOnRecordTypeUse(@NonNull int[] a, int @NonNull [] b, int[] @NonNull [] c) {
+ super();
+ if ((a == null))
+ {
+ throw new java.lang.NullPointerException("a is marked non-null but is null");
+ }
+ if ((b == null))
+ {
+ throw new java.lang.NullPointerException("b is marked non-null but is null");
+ }
+ this.a = a;
+ this.b = b;
+ this.c = c;
+ }
+}
diff --git a/test/transform/resource/after-ecj/NullLibrary3.java b/test/transform/resource/after-ecj/NullLibrary3.java
new file mode 100644
index 00000000..6b6df802
--- /dev/null
+++ b/test/transform/resource/after-ecj/NullLibrary3.java
@@ -0,0 +1,48 @@
+public @lombok.EqualsAndHashCode @lombok.ToString @lombok.AllArgsConstructor class NullLibrary3 {
+ @jakarta.annotation.Nonnull @lombok.With String foo;
+ /**
+ * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed).
+ */
+ public @jakarta.annotation.Nonnull @java.lang.SuppressWarnings("all") NullLibrary3 withFoo(final @jakarta.annotation.Nonnull String foo) {
+ if ((foo == null))
+ {
+ throw new java.lang.NullPointerException("foo is marked non-null but is null");
+ }
+ return ((this.foo == foo) ? this : new NullLibrary3(foo));
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final @jakarta.annotation.Nullable java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof NullLibrary3)))
+ return false;
+ final NullLibrary3 other = (NullLibrary3) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ final java.lang.Object this$foo = this.foo;
+ final java.lang.Object other$foo = other.foo;
+ if (((this$foo == null) ? (other$foo != null) : (! this$foo.equals(other$foo))))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final @jakarta.annotation.Nullable java.lang.Object other) {
+ return (other instanceof NullLibrary3);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ final java.lang.Object $foo = this.foo;
+ result = ((result * PRIME) + (($foo == null) ? 43 : $foo.hashCode()));
+ return result;
+ }
+ public @java.lang.Override @jakarta.annotation.Nonnull @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("NullLibrary3(foo=" + this.foo) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") NullLibrary3(final @jakarta.annotation.Nonnull String foo) {
+ super();
+ if ((foo == null))
+ {
+ throw new java.lang.NullPointerException("foo is marked non-null but is null");
+ }
+ this.foo = foo;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/NonNullOnRecord.java b/test/transform/resource/before/NonNullOnRecord.java
deleted file mode 100644
index ba6121a6..00000000
--- a/test/transform/resource/before/NonNullOnRecord.java
+++ /dev/null
@@ -1,6 +0,0 @@
-// version 14:
-
-import lombok.NonNull;
-
-public record NonNullOnRecord(@NonNull String a, @NonNull String b) {
-} \ No newline at end of file
diff --git a/test/transform/resource/before/NonNullOnRecord2.java b/test/transform/resource/before/NonNullOnRecord2.java
deleted file mode 100644
index 3a4eacd4..00000000
--- a/test/transform/resource/before/NonNullOnRecord2.java
+++ /dev/null
@@ -1,9 +0,0 @@
-// version 14:
-
-import lombok.NonNull;
-
-record NonNullOnRecord2(@NonNull String a) {
- public NonNullOnRecord2 {
- System.out.println("Hello");
- }
-} \ No newline at end of file
diff --git a/test/transform/resource/before/NonNullOnRecordExistingConstructor.java b/test/transform/resource/before/NonNullOnRecordExistingConstructor.java
new file mode 100644
index 00000000..7bab2a8a
--- /dev/null
+++ b/test/transform/resource/before/NonNullOnRecordExistingConstructor.java
@@ -0,0 +1,9 @@
+// version 14:
+
+import lombok.NonNull;
+
+public record NonNullOnRecordExistingConstructor(@NonNull String a) {
+ public NonNullOnRecordExistingConstructor {
+ System.out.println("Hello");
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/NonNullOnRecord3.java b/test/transform/resource/before/NonNullOnRecordExistingSetter.java
index 24198002..dd7b15d8 100644
--- a/test/transform/resource/before/NonNullOnRecord3.java
+++ b/test/transform/resource/before/NonNullOnRecordExistingSetter.java
@@ -2,8 +2,8 @@
import lombok.NonNull;
-public record NonNullOnRecord3(@NonNull String a) {
- public NonNullOnRecord3(String a) {
+public record NonNullOnRecordExistingSetter(@NonNull String a) {
+ public NonNullOnRecordExistingSetter(String a) {
this.a = a;
}
diff --git a/test/transform/resource/before/NonNullOnRecordSimple.java b/test/transform/resource/before/NonNullOnRecordSimple.java
new file mode 100644
index 00000000..0d0a1f9f
--- /dev/null
+++ b/test/transform/resource/before/NonNullOnRecordSimple.java
@@ -0,0 +1,6 @@
+// version 14:
+
+import lombok.NonNull;
+
+public record NonNullOnRecordSimple(@NonNull String a, @NonNull String b) {
+} \ No newline at end of file
diff --git a/test/transform/resource/before/NonNullOnRecordTypeUse.java b/test/transform/resource/before/NonNullOnRecordTypeUse.java
new file mode 100644
index 00000000..5f89695d
--- /dev/null
+++ b/test/transform/resource/before/NonNullOnRecordTypeUse.java
@@ -0,0 +1,6 @@
+// version 14:
+
+import lombok.NonNull;
+
+public record NonNullOnRecordTypeUse(@NonNull int [] a, int @NonNull [] b, int [] @NonNull [] c) {
+} \ No newline at end of file
diff --git a/test/transform/resource/before/NullLibrary3.java b/test/transform/resource/before/NullLibrary3.java
new file mode 100644
index 00000000..d2ff39c0
--- /dev/null
+++ b/test/transform/resource/before/NullLibrary3.java
@@ -0,0 +1,8 @@
+//CONF: lombok.addNullAnnotations = jakarta
+@lombok.EqualsAndHashCode
+@lombok.ToString
+@lombok.AllArgsConstructor
+public class NullLibrary3 {
+ @jakarta.annotation.Nonnull
+ @lombok.With String foo;
+}
diff --git a/test/transform/resource/before/RecordNonNull b/test/transform/resource/before/RecordNonNull
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/transform/resource/before/RecordNonNull