aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/lombok/javac/handlers/HandleBuilder.java3
-rw-r--r--src/utils/lombok/core/ClassLiteral.java39
-rw-r--r--src/utils/lombok/core/FieldSelect.java39
-rw-r--r--src/utils/lombok/eclipse/Eclipse.java4
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java2
-rw-r--r--test/transform/resource/after-delombok/BuilderWithToBuilder.java2
-rw-r--r--test/transform/resource/after-ecj/BuilderSingularToBuilderWithNull.java2
7 files changed, 67 insertions, 24 deletions
diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java
index 63697691..1a471029 100644
--- a/src/core/lombok/javac/handlers/HandleBuilder.java
+++ b/src/core/lombok/javac/handlers/HandleBuilder.java
@@ -516,7 +516,8 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
arg = tgt[0];
} else {
JCExpression eqNull = maker.Binary(CTC_EQUAL, tgt[0], maker.Literal(CTC_BOT, null));
- JCExpression emptyList = maker.Apply(List.<JCExpression>nil(), chainDots(type, "java", "util", "Collections", "emptyList"), List.<JCExpression>nil());
+ List<JCExpression> tas = cloneTypes(maker, bfd.singularData.getTypeArgs(), ast, type.getContext());
+ JCExpression emptyList = maker.Apply(tas, chainDots(type, "java", "util", "Collections", "emptyList"), List.<JCExpression>nil());
arg = maker.Conditional(eqNull, emptyList, tgt[1]);
}
diff --git a/src/utils/lombok/core/ClassLiteral.java b/src/utils/lombok/core/ClassLiteral.java
index 077ead31..2008484b 100644
--- a/src/utils/lombok/core/ClassLiteral.java
+++ b/src/utils/lombok/core/ClassLiteral.java
@@ -1,13 +1,34 @@
+/*
+ * Copyright (C) 2018 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
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
package lombok.core;
public class ClassLiteral {
- private final String className;
-
- public ClassLiteral(String className) {
- this.className = className;
- }
-
- public String getClassName() {
- return className;
- }
+ private final String className;
+
+ public ClassLiteral(String className) {
+ this.className = className;
+ }
+
+ public String getClassName() {
+ return className;
+ }
}
diff --git a/src/utils/lombok/core/FieldSelect.java b/src/utils/lombok/core/FieldSelect.java
index ab784401..4c055105 100644
--- a/src/utils/lombok/core/FieldSelect.java
+++ b/src/utils/lombok/core/FieldSelect.java
@@ -1,13 +1,34 @@
+/*
+ * Copyright (C) 2018 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
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
package lombok.core;
public class FieldSelect {
- private final String finalPart;
-
- public FieldSelect(String finalPart) {
- this.finalPart = finalPart;
- }
-
- public String getFinalPart() {
- return finalPart;
- }
+ private final String finalPart;
+
+ public FieldSelect(String finalPart) {
+ this.finalPart = finalPart;
+ }
+
+ public String getFinalPart() {
+ return finalPart;
+ }
}
diff --git a/src/utils/lombok/eclipse/Eclipse.java b/src/utils/lombok/eclipse/Eclipse.java
index 943a7a7a..5dbe3e2d 100644
--- a/src/utils/lombok/eclipse/Eclipse.java
+++ b/src/utils/lombok/eclipse/Eclipse.java
@@ -186,11 +186,11 @@ public class Eclipse {
default: return null;
}
} else if (e instanceof ClassLiteralAccess) {
- return new ClassLiteral(Eclipse.toQualifiedName(((ClassLiteralAccess)e).type.getTypeName()));
+ return new ClassLiteral(Eclipse.toQualifiedName(((ClassLiteralAccess) e).type.getTypeName()));
} else if (e instanceof SingleNameReference) {
return new FieldSelect(new String(((SingleNameReference)e).token));
} else if (e instanceof QualifiedNameReference) {
- String qName = Eclipse.toQualifiedName(((QualifiedNameReference)e).tokens);
+ String qName = Eclipse.toQualifiedName(((QualifiedNameReference) e).tokens);
int idx = qName.lastIndexOf('.');
return new FieldSelect(idx == -1 ? qName : qName.substring(idx+1));
} else if (e instanceof UnaryExpression) {
diff --git a/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java
index 1f472438..b0563858 100644
--- a/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java
+++ b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java
@@ -58,6 +58,6 @@ class BuilderSingularToBuilderWithNull {
}
@java.lang.SuppressWarnings("all")
public BuilderSingularToBuilderWithNullBuilder toBuilder() {
- return new BuilderSingularToBuilderWithNullBuilder().elems(this.elems == null ? java.util.Collections.emptyList() : this.elems);
+ return new BuilderSingularToBuilderWithNullBuilder().elems(this.elems == null ? java.util.Collections.<String>emptyList() : this.elems);
}
}
diff --git a/test/transform/resource/after-delombok/BuilderWithToBuilder.java b/test/transform/resource/after-delombok/BuilderWithToBuilder.java
index b644a16f..8615a40b 100644
--- a/test/transform/resource/after-delombok/BuilderWithToBuilder.java
+++ b/test/transform/resource/after-delombok/BuilderWithToBuilder.java
@@ -86,7 +86,7 @@ class BuilderWithToBuilder<T> {
}
@java.lang.SuppressWarnings("all")
public BuilderWithToBuilderBuilder<T> toBuilder() {
- return new BuilderWithToBuilderBuilder<T>().one(this.mOne).two(this.mTwo).foo(BuilderWithToBuilder.rrr(this)).bars(this.bars == null ? java.util.Collections.emptyList() : this.bars);
+ return new BuilderWithToBuilderBuilder<T>().one(this.mOne).two(this.mTwo).foo(BuilderWithToBuilder.rrr(this)).bars(this.bars == null ? java.util.Collections.<T>emptyList() : this.bars);
}
}
class ConstructorWithToBuilder<T> {
diff --git a/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNull.java b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNull.java
index 7265e17a..7feff6e9 100644
--- a/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNull.java
+++ b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNull.java
@@ -52,6 +52,6 @@ import lombok.Singular;
return new BuilderSingularToBuilderWithNullBuilder();
}
public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder toBuilder() {
- return new BuilderSingularToBuilderWithNullBuilder().elems(((this.elems == null) ? java.util.Collections.emptyList() : this.elems));
+ return new BuilderSingularToBuilderWithNullBuilder().elems(((this.elems == null) ? java.util.Collections.<String>emptyList() : this.elems));
}
}