aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2021-04-18 06:33:36 +0200
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2021-04-18 06:33:36 +0200
commit8e7fcac2e39f7eb8809130ae73b4d17965a5d9f2 (patch)
tree04a4e22b84b8a89b9f0327935ef7a264a7b21908 /test
parent3f6d668f8343d2f78736ea36c7b5aa33013fea73 (diff)
downloadlombok-8e7fcac2e39f7eb8809130ae73b4d17965a5d9f2.tar.gz
lombok-8e7fcac2e39f7eb8809130ae73b4d17965a5d9f2.tar.bz2
lombok-8e7fcac2e39f7eb8809130ae73b4d17965a5d9f2.zip
[records] [@NonNull] slight refactor to ensure any generated canonical constructor is visible to downstream APs
We used to remove the canonical constructor on a record that javac generates, and replace it with our own, as we put null checks in it. However, the type mirrors and such Annotation Processors use already have the implicit canonical constructor available. Instead of trying to remove those, let's just take the existing implicit constructor and add to that (and mark it explicit, of course).
Diffstat (limited to 'test')
-rw-r--r--test/transform/resource/after-delombok/NonNullExistingConstructorOnRecord.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/transform/resource/after-delombok/NonNullExistingConstructorOnRecord.java b/test/transform/resource/after-delombok/NonNullExistingConstructorOnRecord.java
index 45364815..dec91261 100644
--- a/test/transform/resource/after-delombok/NonNullExistingConstructorOnRecord.java
+++ b/test/transform/resource/after-delombok/NonNullExistingConstructorOnRecord.java
@@ -1,12 +1,6 @@
// version 16:
import lombok.NonNull;
public record NonNullExistingConstructorOnRecord(@NonNull String a, @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");
- }
- }
@java.lang.SuppressWarnings("all")
public NonNullExistingConstructorOnRecord {
if (a == null) {
@@ -16,4 +10,10 @@ public record NonNullExistingConstructorOnRecord(@NonNull String a, @NonNull Str
throw new java.lang.NullPointerException("b is marked non-null but is null");
}
}
+ public NonNullExistingConstructorOnRecord(@NonNull String b) {
+ this("default", b);
+ if (b == null) {
+ throw new java.lang.NullPointerException("b is marked non-null but is null");
+ }
+ }
}