aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2013-07-16 00:51:31 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2013-07-16 00:51:31 +0200
commit7af9add9996f2efab6cccc50c5503b3457534930 (patch)
treebd224bd341da31e1b5aba5e718f43b6fd1227e8d /test/transform/resource
parentec0cc4348cf71d872b796d0733fb64fc576ef5df (diff)
downloadlombok-7af9add9996f2efab6cccc50c5503b3457534930.tar.gz
lombok-7af9add9996f2efab6cccc50c5503b3457534930.tar.bz2
lombok-7af9add9996f2efab6cccc50c5503b3457534930.zip
* Fixed issues with @FieldDefaults and @Value (you can NOT override
@Value's final-by-default and private-by-default with it; now appropriate warnings are emitted) * Builder now errors out on presence of most lombok annotations on an explicit builder class. * Builder now takes @FieldDefaults/@Value into account. * Builder on type now generates the constructor as package private instead of private to avoid synthetic accessor constructors. * added a bunch of test cases. * added a test case feature: If the expected file is omitted entirely but there are expected messages, the differences in the output itself are ignored. * streamlined checking for boolean-ness (removed some duplicate code) * added 'fluent' and 'chain' to @Builder.
Diffstat (limited to 'test/transform/resource')
-rw-r--r--test/transform/resource/after-delombok/BuilderChainAndFluent.java31
-rw-r--r--test/transform/resource/after-delombok/BuilderSimple.java2
-rw-r--r--test/transform/resource/after-ecj/BuilderChainAndFluent.java25
-rw-r--r--test/transform/resource/after-ecj/BuilderSimple.java2
-rw-r--r--test/transform/resource/before/BuilderChainAndFluent.java4
-rw-r--r--test/transform/resource/before/BuilderInvalidUse.java18
-rw-r--r--test/transform/resource/messages-delombok/BuilderInvalidUse.java.messages2
-rw-r--r--test/transform/resource/messages-ecj/BuilderInvalidUse.java.messages2
8 files changed, 84 insertions, 2 deletions
diff --git a/test/transform/resource/after-delombok/BuilderChainAndFluent.java b/test/transform/resource/after-delombok/BuilderChainAndFluent.java
new file mode 100644
index 00000000..d4975bff
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderChainAndFluent.java
@@ -0,0 +1,31 @@
+class BuilderChainAndFluent {
+ private final int yes;
+ @java.lang.SuppressWarnings("all")
+ BuilderChainAndFluent(final int yes) {
+ this.yes = yes;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderChainAndFluentBuilder {
+ private int yes;
+ @java.lang.SuppressWarnings("all")
+ BuilderChainAndFluentBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public void setYes(final int yes) {
+ this.yes = yes;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderChainAndFluent build() {
+ return new BuilderChainAndFluent(yes);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderChainAndFluent.BuilderChainAndFluentBuilder(yes=" + this.yes + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static BuilderChainAndFluentBuilder builder() {
+ return new BuilderChainAndFluentBuilder();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/BuilderSimple.java b/test/transform/resource/after-delombok/BuilderSimple.java
index 24ac369c..11c0e58c 100644
--- a/test/transform/resource/after-delombok/BuilderSimple.java
+++ b/test/transform/resource/after-delombok/BuilderSimple.java
@@ -5,7 +5,7 @@ class BuilderSimple<T> {
private List<T> also;
private int $butNotMe;
@java.lang.SuppressWarnings("all")
- private BuilderSimple(final int yes, final List<T> also) {
+ BuilderSimple(final int yes, final List<T> also) {
this.yes = yes;
this.also = also;
}
diff --git a/test/transform/resource/after-ecj/BuilderChainAndFluent.java b/test/transform/resource/after-ecj/BuilderChainAndFluent.java
new file mode 100644
index 00000000..6a307105
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderChainAndFluent.java
@@ -0,0 +1,25 @@
+@lombok.experimental.Builder(fluent = false,chain = false) class BuilderChainAndFluent {
+ public static @java.lang.SuppressWarnings("all") class BuilderChainAndFluentBuilder {
+ private int yes;
+ @java.lang.SuppressWarnings("all") BuilderChainAndFluentBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") void setYes(final int yes) {
+ this.yes = yes;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderChainAndFluent build() {
+ return new BuilderChainAndFluent(yes);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("BuilderChainAndFluent.BuilderChainAndFluentBuilder(yes=" + this.yes) + ")");
+ }
+ }
+ private final int yes;
+ @java.lang.SuppressWarnings("all") BuilderChainAndFluent(final int yes) {
+ super();
+ this.yes = yes;
+ }
+ public static @java.lang.SuppressWarnings("all") BuilderChainAndFluentBuilder builder() {
+ return new BuilderChainAndFluentBuilder();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderSimple.java b/test/transform/resource/after-ecj/BuilderSimple.java
index 228b1928..85db360d 100644
--- a/test/transform/resource/after-ecj/BuilderSimple.java
+++ b/test/transform/resource/after-ecj/BuilderSimple.java
@@ -25,7 +25,7 @@ import java.util.List;
private final int yes;
private List<T> also;
private int $butNotMe;
- private @java.lang.SuppressWarnings("all") BuilderSimple(final int yes, final List<T> also) {
+ @java.lang.SuppressWarnings("all") BuilderSimple(final int yes, final List<T> also) {
super();
this.yes = yes;
this.also = also;
diff --git a/test/transform/resource/before/BuilderChainAndFluent.java b/test/transform/resource/before/BuilderChainAndFluent.java
new file mode 100644
index 00000000..4d08741b
--- /dev/null
+++ b/test/transform/resource/before/BuilderChainAndFluent.java
@@ -0,0 +1,4 @@
+@lombok.experimental.Builder(fluent = false, chain = false)
+class BuilderChainAndFluent {
+ private final int yes;
+}
diff --git a/test/transform/resource/before/BuilderInvalidUse.java b/test/transform/resource/before/BuilderInvalidUse.java
new file mode 100644
index 00000000..07f37d3d
--- /dev/null
+++ b/test/transform/resource/before/BuilderInvalidUse.java
@@ -0,0 +1,18 @@
+@lombok.experimental.Builder
+class BuilderInvalidUse {
+ private int something;
+
+ @lombok.Getter @lombok.Setter @lombok.experimental.FieldDefaults(makeFinal = true) @lombok.experimental.Wither @lombok.Data @lombok.ToString @lombok.EqualsAndHashCode
+ @lombok.AllArgsConstructor
+ public static class BuilderInvalidUseBuilder {
+
+ }
+}
+
+@lombok.experimental.Builder
+class AlsoInvalid {
+ @lombok.Value
+ public static class AlsoInvalidBuilder {
+
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/messages-delombok/BuilderInvalidUse.java.messages b/test/transform/resource/messages-delombok/BuilderInvalidUse.java.messages
new file mode 100644
index 00000000..aeeb0c86
--- /dev/null
+++ b/test/transform/resource/messages-delombok/BuilderInvalidUse.java.messages
@@ -0,0 +1,2 @@
+1:1 @Getter, @Setter, @Wither, @Data, @ToString, @EqualsAndHashCode, @AllArgsConstructor are not allowed on builder classes.
+12:1 @Value is not allowed on builder classes. \ No newline at end of file
diff --git a/test/transform/resource/messages-ecj/BuilderInvalidUse.java.messages b/test/transform/resource/messages-ecj/BuilderInvalidUse.java.messages
new file mode 100644
index 00000000..8ffc6e26
--- /dev/null
+++ b/test/transform/resource/messages-ecj/BuilderInvalidUse.java.messages
@@ -0,0 +1,2 @@
+1:0 @Getter, @Setter, @FieldDefaults, @Wither, @Data, @ToString, @EqualsAndHashCode, @AllArgsConstructor are not allowed on builder classes.
+12:331 @Value is not allowed on builder classes. \ No newline at end of file