diff options
Diffstat (limited to 'test')
29 files changed, 752 insertions, 35 deletions
diff --git a/test/core/src/lombok/LombokTestSource.java b/test/core/src/lombok/LombokTestSource.java index c686bf19..1f3f5e1a 100644 --- a/test/core/src/lombok/LombokTestSource.java +++ b/test/core/src/lombok/LombokTestSource.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 The Project Lombok Authors. + * Copyright (C) 2014-2015 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,6 +26,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; @@ -207,19 +208,27 @@ public class LombokTestSource { List<String> directives = new ArrayList<String>(); { - @Cleanup val rawIn = new FileInputStream(file); - BufferedReader in = new BufferedReader(new InputStreamReader(rawIn, "UTF-8")); - for (String i = in.readLine(); i != null; i = in.readLine()) { - if (i.isEmpty()) continue; - - if (i.startsWith("//")) { - directives.add(i.substring(2)); - } else { - break; + InputStream rawIn = new FileInputStream(file); + try { + BufferedReader in = new BufferedReader(new InputStreamReader(rawIn, "UTF-8")); + try { + for (String i = in.readLine(); i != null; i = in.readLine()) { + if (i.isEmpty()) continue; + + if (i.startsWith("//")) { + directives.add(i.substring(2)); + } else { + break; + } + } + } + finally { + in.close(); } } - in.close(); - rawIn.close(); + finally { + rawIn.close(); + } } return new LombokTestSource(file, "", null, directives); @@ -235,25 +244,33 @@ public class LombokTestSource { File sourceFile = new File(sourceFolder, fileName); if (sourceFile.exists()) { - @Cleanup val rawIn = new FileInputStream(sourceFile); - BufferedReader in = new BufferedReader(new InputStreamReader(rawIn, encoding)); - for (String i = in.readLine(); i != null; i = in.readLine()) { - if (content != null) { - content.append(i).append("\n"); - continue; + InputStream rawIn = new FileInputStream(sourceFile); + try { + BufferedReader in = new BufferedReader(new InputStreamReader(rawIn, encoding)); + try { + for (String i = in.readLine(); i != null; i = in.readLine()) { + if (content != null) { + content.append(i).append("\n"); + continue; + } + + if (i.isEmpty()) continue; + + if (i.startsWith("//")) { + directives.add(i.substring(2)); + } else { + content = new StringBuilder(); + content.append(i).append("\n"); + } + } } - - if (i.isEmpty()) continue; - - if (i.startsWith("//")) { - directives.add(i.substring(2)); - } else { - content = new StringBuilder(); - content.append(i).append("\n"); + finally { + in.close(); } } - in.close(); - rawIn.close(); + finally { + rawIn.close(); + } } if (content == null) content = new StringBuilder(); @@ -262,9 +279,13 @@ public class LombokTestSource { if (messagesFolder != null) { File messagesFile = new File(messagesFolder, fileName + ".messages"); try { - @Cleanup val rawIn = new FileInputStream(messagesFile); - messages = CompilerMessageMatcher.readAll(rawIn); - rawIn.close(); + InputStream rawIn = new FileInputStream(messagesFile); + try { + messages = CompilerMessageMatcher.readAll(rawIn); + } + finally { + rawIn.close(); + } } catch (FileNotFoundException e) { messages = null; } diff --git a/test/pretty/resource/after/TypeAnnotations.java b/test/pretty/resource/after/TypeAnnotations.java new file mode 100644 index 00000000..760b5ef8 --- /dev/null +++ b/test/pretty/resource/after/TypeAnnotations.java @@ -0,0 +1,22 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.List; +import java.util.Map; +public class TypeAnnotations { + @Target({ElementType.TYPE_USE, ElementType.LOCAL_VARIABLE}) + @interface Foo { + } + @Target(ElementType.TYPE_USE) + @interface Bar { + } + public List<@Foo String> test(@Foo String param) { + @Bar + String local = "bar"; + @Foo + java.io.@Foo File[] array = {}; + return new java.util.@Foo ArrayList<java.lang.@Foo String>(); + } + public <@Foo T extends java.lang.@Foo Number> T test2(@Bar String... varargs) { + return null; + } +} diff --git a/test/pretty/resource/before/TypeAnnotations.java b/test/pretty/resource/before/TypeAnnotations.java new file mode 100644 index 00000000..a39337da --- /dev/null +++ b/test/pretty/resource/before/TypeAnnotations.java @@ -0,0 +1,23 @@ +// version 8: +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.List; +import java.util.Map; + +public class TypeAnnotations { + @Target({ElementType.TYPE_USE, ElementType.LOCAL_VARIABLE}) + @interface Foo {} + + @Target(ElementType.TYPE_USE) + @interface Bar {} + + public List<@Foo String> test(@Foo String param) { + @Bar String local = "bar"; + @Foo java.io.@Foo File[] array = {}; + return new java.util.@Foo ArrayList<java.lang.@Foo String>(); + } + + public <@Foo T extends java.lang.@Foo Number> T test2(@Bar String... varargs) { + return null; + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithToBuilder.java b/test/transform/resource/after-delombok/BuilderWithToBuilder.java new file mode 100644 index 00000000..eb61a6db --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithToBuilder.java @@ -0,0 +1,216 @@ +import java.util.List; +class BuilderWithToBuilder<T> { + private String mOne; + private String mTwo; + private T foo; + private List<T> bars; + public static <K> K rrr(BuilderWithToBuilder<K> x) { + return x.foo; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + BuilderWithToBuilder(final String one, final String two, final T foo, final List<T> bars) { + this.mOne = one; + this.mTwo = two; + this.foo = foo; + this.bars = bars; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public static class BuilderWithToBuilderBuilder<T> { + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + private String one; + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + private String two; + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + private T foo; + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + private java.util.ArrayList<T> bars; + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + BuilderWithToBuilderBuilder() { + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public BuilderWithToBuilderBuilder<T> one(final String one) { + this.one = one; + return this; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public BuilderWithToBuilderBuilder<T> two(final String two) { + this.two = two; + return this; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public BuilderWithToBuilderBuilder<T> foo(final T foo) { + this.foo = foo; + return this; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public BuilderWithToBuilderBuilder<T> bar(final T bar) { + if (this.bars == null) this.bars = new java.util.ArrayList<T>(); + this.bars.add(bar); + return this; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public BuilderWithToBuilderBuilder<T> bars(final java.util.Collection<? extends T> bars) { + if (this.bars == null) this.bars = new java.util.ArrayList<T>(); + this.bars.addAll(bars); + return this; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public BuilderWithToBuilder<T> build() { + java.util.List<T> bars; + switch (this.bars == null ? 0 : this.bars.size()) { + case 0: + bars = java.util.Collections.emptyList(); + break; + case 1: + bars = java.util.Collections.singletonList(this.bars.get(0)); + break; + default: + bars = java.util.Collections.unmodifiableList(new java.util.ArrayList<T>(this.bars)); + } + return new BuilderWithToBuilder<T>(one, two, foo, bars); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public java.lang.String toString() { + return "BuilderWithToBuilder.BuilderWithToBuilderBuilder(one=" + this.one + ", two=" + this.two + ", foo=" + this.foo + ", bars=" + this.bars + ")"; + } + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public static <T> BuilderWithToBuilderBuilder<T> builder() { + return new BuilderWithToBuilderBuilder<T>(); + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public BuilderWithToBuilderBuilder<T> toBuilder() { + return new BuilderWithToBuilderBuilder<T>().one(this.mOne).two(this.mTwo).foo(BuilderWithToBuilder.rrr(this)).bars(this.bars); + } +} +class ConstructorWithToBuilder<T> { + private String mOne; + private String mTwo; + private T foo; + @lombok.Singular + private List<T> bars; + public ConstructorWithToBuilder(String mOne, T bar) { + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public static class ConstructorWithToBuilderBuilder<T> { + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + private String mOne; + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + private T bar; + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + ConstructorWithToBuilderBuilder() { + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public ConstructorWithToBuilderBuilder<T> mOne(final String mOne) { + this.mOne = mOne; + return this; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public ConstructorWithToBuilderBuilder<T> bar(final T bar) { + this.bar = bar; + return this; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public ConstructorWithToBuilder<T> build() { + return new ConstructorWithToBuilder<T>(mOne, bar); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public java.lang.String toString() { + return "ConstructorWithToBuilder.ConstructorWithToBuilderBuilder(mOne=" + this.mOne + ", bar=" + this.bar + ")"; + } + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public static <T> ConstructorWithToBuilderBuilder<T> builder() { + return new ConstructorWithToBuilderBuilder<T>(); + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public ConstructorWithToBuilderBuilder<T> toBuilder() { + return new ConstructorWithToBuilderBuilder<T>().mOne(this.mOne).bar(this.foo); + } +} +class StaticWithToBuilder<T, K> { + private String mOne; + private String mTwo; + private T foo; + private K bar; + @lombok.Singular + private List<T> bars; + public static <Z> StaticWithToBuilder<Z, String> test(String mOne, Z bar) { + return new StaticWithToBuilder<Z, String>(); + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public static class StaticWithToBuilderBuilder<Z> { + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + private String mOne; + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + private Z bar; + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + StaticWithToBuilderBuilder() { + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public StaticWithToBuilderBuilder<Z> mOne(final String mOne) { + this.mOne = mOne; + return this; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public StaticWithToBuilderBuilder<Z> bar(final Z bar) { + this.bar = bar; + return this; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public StaticWithToBuilder build() { + return StaticWithToBuilder.<Z>test(mOne, bar); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public java.lang.String toString() { + return "StaticWithToBuilder.StaticWithToBuilderBuilder(mOne=" + this.mOne + ", bar=" + this.bar + ")"; + } + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public static <Z> StaticWithToBuilderBuilder<Z> builder() { + return new StaticWithToBuilderBuilder<Z>(); + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public StaticWithToBuilderBuilder<T> toBuilder() { + return new StaticWithToBuilderBuilder<T>().mOne(this.mOne).bar(this.foo); + } +} diff --git a/test/transform/resource/after-delombok/Constructors.java b/test/transform/resource/after-delombok/Constructors.java index 466ae9ee..c138a00c 100644 --- a/test/transform/resource/after-delombok/Constructors.java +++ b/test/transform/resource/after-delombok/Constructors.java @@ -98,3 +98,22 @@ class AllArgsConstructorPackageAccess { this.x = x; } } +class NoArgsConstructor2 { + final int x; + final double y; + final char c; + final boolean b; + final float f; + final String s; + byte z; + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public NoArgsConstructor2() { + this.x = 0; + this.y = 0.0; + this.c = '\000'; + this.b = false; + this.f = 0.0F; + this.s = null; + } +} diff --git a/test/transform/resource/after-delombok/FieldDefaultsViaConfig.java b/test/transform/resource/after-delombok/FieldDefaultsViaConfig.java new file mode 100644 index 00000000..096769b6 --- /dev/null +++ b/test/transform/resource/after-delombok/FieldDefaultsViaConfig.java @@ -0,0 +1,11 @@ +class FieldDefaultsViaConfig1 { + private final int x; + private int y; + FieldDefaultsViaConfig1(int x) { + this.x = x; + } +} +class FieldDefaultsViaConfig2 { + final int x = 2; + protected final int y = 0; +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/FieldDefaultsViaConfigAndRequiredArgsConstructor.java b/test/transform/resource/after-delombok/FieldDefaultsViaConfigAndRequiredArgsConstructor.java new file mode 100644 index 00000000..ebe6e2ed --- /dev/null +++ b/test/transform/resource/after-delombok/FieldDefaultsViaConfigAndRequiredArgsConstructor.java @@ -0,0 +1,9 @@ +class FieldDefaultsViaConfigAndRequiredArgsConstructor { + final int x; + @java.beans.ConstructorProperties({"x"}) + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public FieldDefaultsViaConfigAndRequiredArgsConstructor(final int x) { + this.x = x; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/Helper.java b/test/transform/resource/after-delombok/Helper.java new file mode 100644 index 00000000..52f50dd2 --- /dev/null +++ b/test/transform/resource/after-delombok/Helper.java @@ -0,0 +1,16 @@ +class HelperTest { + void test() { + class H1 { + void foo() { + System.out.println("Hello"); + } + } + final H1 $H1 = new H1(); + $H1.foo(); + class H2 { + void bar() { + $H1.foo(); + } + } + } +} diff --git a/test/transform/resource/after-delombok/NonNullOnParameterOfDefaultMethod.java b/test/transform/resource/after-delombok/NonNullOnParameterOfDefaultMethod.java new file mode 100644 index 00000000..e220296f --- /dev/null +++ b/test/transform/resource/after-delombok/NonNullOnParameterOfDefaultMethod.java @@ -0,0 +1,10 @@ +// version 8: +interface NonNullOnParameterOfDefaultMethod { + void test(@lombok.NonNull String arg); + default void test2(@lombok.NonNull String arg) { + if (arg == null) { + throw new java.lang.NullPointerException("arg"); + } + System.out.println(arg); + } +} diff --git a/test/transform/resource/after-delombok/ValueStaticField.java b/test/transform/resource/after-delombok/ValueStaticField.java new file mode 100644 index 00000000..cec136f4 --- /dev/null +++ b/test/transform/resource/after-delombok/ValueStaticField.java @@ -0,0 +1,29 @@ +final class ValueStaticField { + private static int x; + private static final String PASSWORD = "Ken sent me"; + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public ValueStaticField() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof ValueStaticField)) return false; + return true; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public int hashCode() { + int result = 1; + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public java.lang.String toString() { + return "ValueStaticField()"; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/BuilderWithToBuilder.java b/test/transform/resource/after-ecj/BuilderWithToBuilder.java new file mode 100644 index 00000000..423865ff --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithToBuilder.java @@ -0,0 +1,150 @@ +import java.util.List; +import lombok.Builder; +@Builder(toBuilder = true) @lombok.experimental.Accessors(prefix = "m") class BuilderWithToBuilder<T> { + public static @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") class BuilderWithToBuilderBuilder<T> { + private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") String one; + private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") String two; + private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") T foo; + private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.util.ArrayList<T> bars; + @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithToBuilderBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithToBuilderBuilder<T> one(final String one) { + this.one = one; + return this; + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithToBuilderBuilder<T> two(final String two) { + this.two = two; + return this; + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithToBuilderBuilder<T> foo(final T foo) { + this.foo = foo; + return this; + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithToBuilderBuilder<T> bar(T bar) { + if ((this.bars == null)) + this.bars = new java.util.ArrayList<T>(); + this.bars.add(bar); + return this; + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithToBuilderBuilder<T> bars(java.util.Collection<? extends T> bars) { + if ((this.bars == null)) + this.bars = new java.util.ArrayList<T>(); + this.bars.addAll(bars); + return this; + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithToBuilder<T> build() { + java.util.List<T> bars; + switch (((this.bars == null) ? 0 : this.bars.size())) { + case 0 : + bars = java.util.Collections.emptyList(); + break; + case 1 : + bars = java.util.Collections.singletonList(this.bars.get(0)); + break; + default : + bars = java.util.Collections.unmodifiableList(new java.util.ArrayList<T>(this.bars)); + } + return new BuilderWithToBuilder<T>(one, two, foo, bars); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { + return (((((((("BuilderWithToBuilder.BuilderWithToBuilderBuilder(one=" + this.one) + ", two=") + this.two) + ", foo=") + this.foo) + ", bars=") + this.bars) + ")"); + } + } + private String mOne; + private String mTwo; + private @Builder.ObtainVia(method = "rrr",isStatic = true) T foo; + private @lombok.Singular List<T> bars; + public static <K>K rrr(BuilderWithToBuilder<K> x) { + return x.foo; + } + @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithToBuilder(final String one, final String two, final T foo, final List<T> bars) { + super(); + this.mOne = one; + this.mTwo = two; + this.foo = foo; + this.bars = bars; + } + public static @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") <T>BuilderWithToBuilderBuilder<T> builder() { + return new BuilderWithToBuilderBuilder<T>(); + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithToBuilderBuilder<T> toBuilder() { + return new BuilderWithToBuilderBuilder<T>().one(this.mOne).two(this.mTwo).foo(BuilderWithToBuilder.rrr(this)).bars(this.bars); + } +} +@lombok.experimental.Accessors(prefix = "m") class ConstructorWithToBuilder<T> { + public static @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") class ConstructorWithToBuilderBuilder<T> { + private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") String mOne; + private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") T bar; + @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") ConstructorWithToBuilderBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") ConstructorWithToBuilderBuilder<T> mOne(final String mOne) { + this.mOne = mOne; + return this; + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") ConstructorWithToBuilderBuilder<T> bar(final T bar) { + this.bar = bar; + return this; + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") ConstructorWithToBuilder<T> build() { + return new ConstructorWithToBuilder<T>(mOne, bar); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { + return (((("ConstructorWithToBuilder.ConstructorWithToBuilderBuilder(mOne=" + this.mOne) + ", bar=") + this.bar) + ")"); + } + } + private String mOne; + private String mTwo; + private T foo; + private @lombok.Singular List<T> bars; + public @Builder(toBuilder = true) ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T bar) { + super(); + } + public static @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") <T>ConstructorWithToBuilderBuilder<T> builder() { + return new ConstructorWithToBuilderBuilder<T>(); + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") ConstructorWithToBuilderBuilder<T> toBuilder() { + return new ConstructorWithToBuilderBuilder<T>().mOne(this.mOne).bar(this.foo); + } +} +@lombok.experimental.Accessors(prefix = "m") class StaticWithToBuilder<T, K> { + public static @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") class StaticWithToBuilderBuilder<Z> { + private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") String mOne; + private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") Z bar; + @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") StaticWithToBuilderBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") StaticWithToBuilderBuilder<Z> mOne(final String mOne) { + this.mOne = mOne; + return this; + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") StaticWithToBuilderBuilder<Z> bar(final Z bar) { + this.bar = bar; + return this; + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") StaticWithToBuilder<Z, String> build() { + return StaticWithToBuilder.<Z>test(mOne, bar); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { + return (((("StaticWithToBuilder.StaticWithToBuilderBuilder(mOne=" + this.mOne) + ", bar=") + this.bar) + ")"); + } + } + private String mOne; + private String mTwo; + private T foo; + private K bar; + private @lombok.Singular List<T> bars; + StaticWithToBuilder() { + super(); + } + public static @Builder(toBuilder = true) <Z>StaticWithToBuilder<Z, String> test(String mOne, @Builder.ObtainVia(field = "foo") Z bar) { + return new StaticWithToBuilder<Z, String>(); + } + public static @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") <Z>StaticWithToBuilderBuilder<Z> builder() { + return new StaticWithToBuilderBuilder<Z>(); + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") StaticWithToBuilderBuilder<T> toBuilder() { + return new StaticWithToBuilderBuilder<T>().mOne(this.mOne).bar(this.foo); + } +} diff --git a/test/transform/resource/after-ecj/Constructors.java b/test/transform/resource/after-ecj/Constructors.java index 998872a2..4cc24a81 100644 --- a/test/transform/resource/after-ecj/Constructors.java +++ b/test/transform/resource/after-ecj/Constructors.java @@ -77,4 +77,22 @@ super(); this.x = x; } +} +@lombok.NoArgsConstructor(force = true) class NoArgsConstructor2 { + final int x; + final double y; + final char c; + final boolean b; + final float f; + final String s; + byte z; + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") NoArgsConstructor2() { + super(); + this.x = 0; + this.y = 0D; + this.c = '\0'; + this.b = false; + this.f = 0F; + this.s = null; + } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/FieldDefaultsViaConfig.java b/test/transform/resource/after-ecj/FieldDefaultsViaConfig.java new file mode 100644 index 00000000..689d2601 --- /dev/null +++ b/test/transform/resource/after-ecj/FieldDefaultsViaConfig.java @@ -0,0 +1,15 @@ +class FieldDefaultsViaConfig1 { + private final int x; + private @lombok.experimental.NonFinal int y; + FieldDefaultsViaConfig1(int x) { + super(); + this.x = x; + } +} +@lombok.experimental.FieldDefaults(level = lombok.AccessLevel.PROTECTED) class FieldDefaultsViaConfig2 { + final @lombok.experimental.PackagePrivate int x = 2; + protected final int y = 0; + FieldDefaultsViaConfig2() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/FieldDefaultsViaConfigAndRequiredArgsConstructor.java b/test/transform/resource/after-ecj/FieldDefaultsViaConfigAndRequiredArgsConstructor.java new file mode 100644 index 00000000..6a727f1d --- /dev/null +++ b/test/transform/resource/after-ecj/FieldDefaultsViaConfigAndRequiredArgsConstructor.java @@ -0,0 +1,7 @@ +@lombok.RequiredArgsConstructor class FieldDefaultsViaConfigAndRequiredArgsConstructor { + final int x; + public @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") FieldDefaultsViaConfigAndRequiredArgsConstructor(final int x) { + super(); + this.x = x; + } +} diff --git a/test/transform/resource/after-ecj/Helper.java b/test/transform/resource/after-ecj/Helper.java new file mode 100644 index 00000000..1b4e8bd2 --- /dev/null +++ b/test/transform/resource/after-ecj/Helper.java @@ -0,0 +1,26 @@ +import lombok.experimental.Helper; +class HelperTest { + HelperTest() { + super(); + } + void test() { + @Helper class H1 { + H1() { + super(); + } + void foo() { + System.out.println("Hello"); + } + } + final H1 $H1 = new H1(); + $H1.foo(); + @Helper class H2 { + H2() { + super(); + } + void bar() { + $H1.foo(); + } + } + } +} diff --git a/test/transform/resource/after-ecj/NonNullOnParameterOfDefaultMethod.java b/test/transform/resource/after-ecj/NonNullOnParameterOfDefaultMethod.java new file mode 100644 index 00000000..85e99702 --- /dev/null +++ b/test/transform/resource/after-ecj/NonNullOnParameterOfDefaultMethod.java @@ -0,0 +1,10 @@ +interface NonNullOnParameterOfDefaultMethod { + void test(@lombok.NonNull String arg); + default void test2(@lombok.NonNull String arg) { + if ((arg == null)) + { + throw new java.lang.NullPointerException("arg"); + } + System.out.println(arg); + } +} diff --git a/test/transform/resource/after-ecj/ValueStaticField.java b/test/transform/resource/after-ecj/ValueStaticField.java new file mode 100644 index 00000000..4ce84a02 --- /dev/null +++ b/test/transform/resource/after-ecj/ValueStaticField.java @@ -0,0 +1,24 @@ +import lombok.Value; +final @Value class ValueStaticField { + private static int x; + private static final String PASSWORD = "Ken sent me"; + <clinit>() { + } + public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof ValueStaticField))) + return false; + return true; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") int hashCode() { + int result = 1; + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { + return "ValueStaticField()"; + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") ValueStaticField() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/BuilderWithToBuilder.java b/test/transform/resource/before/BuilderWithToBuilder.java new file mode 100644 index 00000000..63e16ae8 --- /dev/null +++ b/test/transform/resource/before/BuilderWithToBuilder.java @@ -0,0 +1,31 @@ +import java.util.List; +import lombok.Builder; +@Builder(toBuilder = true) @lombok.experimental.Accessors(prefix = "m") +class BuilderWithToBuilder<T> { + private String mOne, mTwo; + @Builder.ObtainVia(method = "rrr", isStatic = true) private T foo; + @lombok.Singular private List<T> bars; + public static <K> K rrr(BuilderWithToBuilder<K> x) { + return x.foo; + } +} +@lombok.experimental.Accessors(prefix = "m") +class ConstructorWithToBuilder<T> { + private String mOne, mTwo; + private T foo; + @lombok.Singular private List<T> bars; + @Builder(toBuilder = true) + public ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T bar) { + } +} +@lombok.experimental.Accessors(prefix = "m") +class StaticWithToBuilder<T, K> { + private String mOne, mTwo; + private T foo; + private K bar; + @lombok.Singular private List<T> bars; + @Builder(toBuilder = true) + public static <Z> StaticWithToBuilder<Z, String> test(String mOne, @Builder.ObtainVia(field = "foo") Z bar) { + return new StaticWithToBuilder<Z, String>(); + } +} diff --git a/test/transform/resource/before/Constructors.java b/test/transform/resource/before/Constructors.java index c80acf2b..3569986f 100644 --- a/test/transform/resource/before/Constructors.java +++ b/test/transform/resource/before/Constructors.java @@ -32,4 +32,13 @@ } @lombok.AllArgsConstructor(access=lombok.AccessLevel.PACKAGE) class AllArgsConstructorPackageAccess { final String x; -}
\ No newline at end of file +} +@lombok.NoArgsConstructor(force = true) class NoArgsConstructor2 { + final int x; + final double y; + final char c; + final boolean b; + final float f; + final String s; + byte z; +} diff --git a/test/transform/resource/before/FieldDefaultsViaConfig.java b/test/transform/resource/before/FieldDefaultsViaConfig.java new file mode 100644 index 00000000..61f6daca --- /dev/null +++ b/test/transform/resource/before/FieldDefaultsViaConfig.java @@ -0,0 +1,16 @@ +//CONF: lombok.fieldDefaults.defaultFinal = true +//CONF: lombok.fieldDefaults.defaultPrivate = true +class FieldDefaultsViaConfig1 { + int x; + @lombok.experimental.NonFinal int y; + + FieldDefaultsViaConfig1(int x) { + this.x = x; + } +} + +@lombok.experimental.FieldDefaults(level = lombok.AccessLevel.PROTECTED) +class FieldDefaultsViaConfig2 { + @lombok.experimental.PackagePrivate int x = 2; + int y = 0; +} diff --git a/test/transform/resource/before/FieldDefaultsViaConfigAndRequiredArgsConstructor.java b/test/transform/resource/before/FieldDefaultsViaConfigAndRequiredArgsConstructor.java new file mode 100644 index 00000000..8c0607d7 --- /dev/null +++ b/test/transform/resource/before/FieldDefaultsViaConfigAndRequiredArgsConstructor.java @@ -0,0 +1,5 @@ +//CONF: lombok.fieldDefaults.defaultFinal = true +@lombok.RequiredArgsConstructor +class FieldDefaultsViaConfigAndRequiredArgsConstructor { + int x; +} diff --git a/test/transform/resource/before/Helper.java b/test/transform/resource/before/Helper.java new file mode 100644 index 00000000..145d740f --- /dev/null +++ b/test/transform/resource/before/Helper.java @@ -0,0 +1,19 @@ +import lombok.experimental.Helper; + +class HelperTest { + void test() { + @Helper class H1 { + void foo() { + System.out.println("Hello"); + } + } + + foo(); + + @Helper class H2 { + void bar() { + foo(); + } + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/NonNullOnParameterOfDefaultMethod.java b/test/transform/resource/before/NonNullOnParameterOfDefaultMethod.java new file mode 100644 index 00000000..ab343ef0 --- /dev/null +++ b/test/transform/resource/before/NonNullOnParameterOfDefaultMethod.java @@ -0,0 +1,7 @@ +// version 8: +interface NonNullOnParameterOfDefaultMethod { + void test(@lombok.NonNull String arg); + default void test2(@lombok.NonNull String arg) { + System.out.println(arg); + } +} diff --git a/test/transform/resource/before/ValueStaticField.java b/test/transform/resource/before/ValueStaticField.java new file mode 100644 index 00000000..f731758a --- /dev/null +++ b/test/transform/resource/before/ValueStaticField.java @@ -0,0 +1,5 @@ +import lombok.Value; +@Value class ValueStaticField { + static int x; + static String PASSWORD = "Ken sent me"; +} diff --git a/test/transform/resource/messages-delombok/Helper.java.messages b/test/transform/resource/messages-delombok/Helper.java.messages new file mode 100644 index 00000000..05260c0b --- /dev/null +++ b/test/transform/resource/messages-delombok/Helper.java.messages @@ -0,0 +1 @@ +13 No methods of this helper class are ever used.
\ No newline at end of file diff --git a/test/transform/resource/messages-delombok/NonNullOnParameterAbstract.java.messages b/test/transform/resource/messages-delombok/NonNullOnParameterAbstract.java.messages deleted file mode 100644 index fd5bffd5..00000000 --- a/test/transform/resource/messages-delombok/NonNullOnParameterAbstract.java.messages +++ /dev/null @@ -1 +0,0 @@ -6 @NonNull is meaningless on a parameter of an abstract method. diff --git a/test/transform/resource/messages-ecj/Helper.java.messages b/test/transform/resource/messages-ecj/Helper.java.messages new file mode 100644 index 00000000..7207e136 --- /dev/null +++ b/test/transform/resource/messages-ecj/Helper.java.messages @@ -0,0 +1 @@ +13 No methods of this helper class are ever used. diff --git a/test/transform/resource/messages-ecj/NonNullOnParameterAbstract.java.messages b/test/transform/resource/messages-ecj/NonNullOnParameterAbstract.java.messages deleted file mode 100644 index 8eb312ef..00000000 --- a/test/transform/resource/messages-ecj/NonNullOnParameterAbstract.java.messages +++ /dev/null @@ -1 +0,0 @@ -6 @NonNull is meaningless on a parameter of an abstract method.
\ No newline at end of file diff --git a/test/transform/resource/messages-idempotent/NonNullOnParameterAbstract.java.messages b/test/transform/resource/messages-idempotent/NonNullOnParameterAbstract.java.messages deleted file mode 100644 index 0d9fcfdc..00000000 --- a/test/transform/resource/messages-idempotent/NonNullOnParameterAbstract.java.messages +++ /dev/null @@ -1 +0,0 @@ -9 @NonNull is meaningless on a parameter of an abstract method.
\ No newline at end of file |