aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/core/lombok/eclipse/handlers/HandleBuilder.java27
-rw-r--r--src/core/lombok/eclipse/handlers/HandleSuperBuilder.java16
-rw-r--r--test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java5
-rw-r--r--test/transform/resource/after-ecj/SimpleTypeResolution.java2
-rw-r--r--test/transform/resource/messages-ecj/CheckerFrameworkBasic.java.messages2
-rw-r--r--test/transform/resource/messages-ecj/CheckerFrameworkSuperBuilder.java.messages2
6 files changed, 31 insertions, 23 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java
index f848469f..801fe7e7 100755
--- a/src/core/lombok/eclipse/handlers/HandleBuilder.java
+++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java
@@ -57,6 +57,7 @@ import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression;
import org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference;
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.Receiver;
import org.eclipse.jdt.internal.compiler.ast.ReturnStatement;
import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation;
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
@@ -683,7 +684,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
return decl;
}
- static Argument[] generateBuildArgs(CheckerFrameworkVersion cfv, EclipseNode type, List<BuilderFieldData> builderFields, ASTNode source) {
+ static Receiver generateBuildReceiver(CheckerFrameworkVersion cfv, EclipseNode type, List<BuilderFieldData> builderFields, ASTNode source) {
if (!cfv.generateCalledMethods()) return null;
List<char[]> mandatories = new ArrayList<char[]>();
@@ -706,9 +707,11 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
}
ann.memberValue = arr;
}
- Argument arg = new Argument(new char[] { 't', 'h', 'i', 's' }, 0, generateTypeReference(type, source.sourceStart), Modifier.FINAL);
- arg.annotations = new Annotation[] {ann};
- return new Argument[] {arg};
+
+ QualifiedTypeReference typeReference = (QualifiedTypeReference) generateTypeReference(type, source.sourceStart);
+ typeReference.annotations = new Annotation[typeReference.tokens.length][];
+ typeReference.annotations[0] = new Annotation[] {ann};
+ return new Receiver(new char[] { 't', 'h', 'i', 's' }, 0, typeReference, null, Modifier.FINAL);
}
public MethodDeclaration generateBuildMethod(CheckerFrameworkVersion cfv, EclipseNode tdParent, boolean isStatic, String name, char[] staticName, TypeReference returnType, List<BuilderFieldData> builderFields, EclipseNode type, TypeReference[] thrownExceptions, boolean addCleaning, ASTNode source, AccessLevel access) {
@@ -802,7 +805,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
if (cfv.generateSideEffectFree()) {
out.annotations = new Annotation[] {generateNamedAnnotation(source, CheckerFrameworkVersion.NAME__SIDE_EFFECT_FREE)};
}
- out.arguments = generateBuildArgs(cfv, type, builderFields, source);
+ out.receiver = generateBuildReceiver(cfv, type, builderFields, source);
if (staticName == null) createRelevantNonNullAnnotation(type, out);
out.traverse(new SetGeneratedByVisitor(source), (ClassScope) null);
return out;
@@ -953,16 +956,14 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
MethodDeclaration setter = HandleSetter.createSetter(td, deprecate, fieldNode, setterName, paramName, nameOfSetFlag, chain, toEclipseModifier(access),
sourceNode, methodAnnsList, annotations != null ? Arrays.asList(copyAnnotations(source, annotations)) : Collections.<Annotation>emptyList());
if (cfv.generateCalledMethods()) {
- Argument[] arr = setter.arguments == null ? new Argument[0] : setter.arguments;
- Argument[] newArr = new Argument[arr.length + 1];
- System.arraycopy(arr, 0, newArr, 1, arr.length);
- newArr[0] = new Argument(new char[] { 't', 'h', 'i', 's' }, 0, generateTypeReference(builderType, 0), Modifier.FINAL);
char[][] nameNotCalled = fromQualifiedName(CheckerFrameworkVersion.NAME__NOT_CALLED);
- SingleMemberAnnotation ann = new SingleMemberAnnotation(new QualifiedTypeReference(nameNotCalled, poss(
- source, nameNotCalled.length)), source.sourceStart);
+ SingleMemberAnnotation ann = new SingleMemberAnnotation(new QualifiedTypeReference(nameNotCalled, poss(source, nameNotCalled.length)), source.sourceStart);
ann.memberValue = new StringLiteral(setterName.toCharArray(), 0, 0, 0);
- newArr[0].annotations = new Annotation[] {ann};
- setter.arguments = newArr;
+
+ QualifiedTypeReference typeReference = (QualifiedTypeReference) generateTypeReference(builderType, 0);
+ typeReference.annotations = new Annotation[typeReference.tokens.length][];
+ typeReference.annotations[0] = new Annotation[] {ann};
+ setter.receiver = new Receiver(new char[] { 't', 'h', 'i', 's' }, 0, typeReference, null, Modifier.FINAL);
}
injectMethod(builderType, setter);
}
diff --git a/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java b/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java
index cc4d55be..2ba456da 100644
--- a/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java
+++ b/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java
@@ -57,6 +57,7 @@ import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference
import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.Receiver;
import org.eclipse.jdt.internal.compiler.ast.ReturnStatement;
import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation;
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
@@ -831,7 +832,7 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> {
if (overrideAnn != null && sefAnn != null) out.annotations = new Annotation[] {overrideAnn, sefAnn};
else if (overrideAnn != null) out.annotations = new Annotation[] {overrideAnn};
else if (sefAnn != null) out.annotations = new Annotation[] {sefAnn};
- out.arguments = HandleBuilder.generateBuildArgs(cfv, builderType, builderFields, source);
+ out.receiver = HandleBuilder.generateBuildReceiver(cfv, builderType, builderFields, source);
out.traverse(new SetGeneratedByVisitor(source), (ClassScope) null);
return out;
}
@@ -856,7 +857,7 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> {
allocationStatement.arguments = new Expression[] {new ThisReference(0, 0)};
statements.add(new ReturnStatement(allocationStatement, 0, 0));
out.statements = statements.isEmpty() ? null : statements.toArray(new Statement[0]);
- out.arguments = HandleBuilder.generateBuildArgs(cfv, builderType, builderFields, source);
+ out.receiver = HandleBuilder.generateBuildReceiver(cfv, builderType, builderFields, source);
createRelevantNonNullAnnotation(builderType, out);
out.traverse(new SetGeneratedByVisitor(source), (ClassScope) null);
return out;
@@ -970,15 +971,14 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> {
MethodDeclaration setter = HandleSetter.createSetter(td, deprecate, fieldNode, setterName, paramName, nameOfSetFlag, returnType, returnStatement, ClassFileConstants.AccPublic,
sourceNode, methodAnnsList, annosOnParam != null ? Arrays.asList(copyAnnotations(source, annosOnParam)) : Collections.<Annotation>emptyList());
if (cfv.generateCalledMethods()) {
- Argument[] arr = setter.arguments == null ? new Argument[0] : setter.arguments;
- Argument[] newArr = new Argument[arr.length + 1];
- System.arraycopy(arr, 0, newArr, 1, arr.length);
- newArr[0] = new Argument(new char[] { 't', 'h', 'i', 's' }, 0, generateTypeReference(builderType, 0), Modifier.FINAL);
char[][] nameNotCalled = fromQualifiedName(CheckerFrameworkVersion.NAME__NOT_CALLED);
SingleMemberAnnotation ann = new SingleMemberAnnotation(new QualifiedTypeReference(nameNotCalled, poss(source, nameNotCalled.length)), source.sourceStart);
ann.memberValue = new StringLiteral(setterName.toCharArray(), 0, 0, 0);
- newArr[0].annotations = new Annotation[] {ann};
- setter.arguments = newArr;
+
+ QualifiedTypeReference typeReference = (QualifiedTypeReference) generateTypeReference(builderType, 0);
+ typeReference.annotations = new Annotation[typeReference.tokens.length][];
+ typeReference.annotations[0] = new Annotation[] {ann};
+ setter.receiver = new Receiver(new char[] { 't', 'h', 'i', 's' }, 0, typeReference, null, Modifier.FINAL);
}
injectMethod(builderType, setter);
}
diff --git a/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java b/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java
index 5bd4e1b3..43568236 100644
--- a/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java
+++ b/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java
@@ -9,6 +9,7 @@ class CheckerFrameworkSuperBuilder {
private @java.lang.SuppressWarnings("all") int z;
private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> names;
public ParentBuilder() {
+ super();
}
protected abstract @org.checkerframework.checker.builder.qual.ReturnsReceiver @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") B self();
public abstract @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") C build(final @org.checkerframework.checker.builder.qual.CalledMethods({"y", "z"}) CheckerFrameworkSuperBuilder.Parent.ParentBuilder this);
@@ -52,6 +53,7 @@ class CheckerFrameworkSuperBuilder {
}
private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends CheckerFrameworkSuperBuilder.Parent.ParentBuilder<CheckerFrameworkSuperBuilder.Parent, CheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl> {
private ParentBuilderImpl() {
+ super();
}
protected @java.lang.Override @org.checkerframework.checker.builder.qual.ReturnsReceiver @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl self() {
return this;
@@ -98,6 +100,7 @@ class CheckerFrameworkSuperBuilder {
private @java.lang.SuppressWarnings("all") boolean a$set;
private @java.lang.SuppressWarnings("all") int b;
public ChildBuilder() {
+ super();
}
protected abstract @java.lang.Override @org.checkerframework.checker.builder.qual.ReturnsReceiver @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") B self();
public abstract @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") C build(final @org.checkerframework.checker.builder.qual.CalledMethods("b") CheckerFrameworkSuperBuilder.Child.ChildBuilder this);
@@ -116,6 +119,7 @@ class CheckerFrameworkSuperBuilder {
}
private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends CheckerFrameworkSuperBuilder.Child.ChildBuilder<CheckerFrameworkSuperBuilder.Child, CheckerFrameworkSuperBuilder.Child.ChildBuilderImpl> {
private ChildBuilderImpl() {
+ super();
}
protected @java.lang.Override @org.checkerframework.checker.builder.qual.ReturnsReceiver @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.Child.ChildBuilderImpl self() {
return this;
@@ -142,5 +146,6 @@ class CheckerFrameworkSuperBuilder {
}
}
CheckerFrameworkSuperBuilder() {
+ super();
}
}
diff --git a/test/transform/resource/after-ecj/SimpleTypeResolution.java b/test/transform/resource/after-ecj/SimpleTypeResolution.java
index c413623e..d8321ca4 100644
--- a/test/transform/resource/after-ecj/SimpleTypeResolution.java
+++ b/test/transform/resource/after-ecj/SimpleTypeResolution.java
@@ -1,11 +1,13 @@
class SimpleTypeResolutionFail {
private @Getter int x;
SimpleTypeResolutionFail() {
+ super();
}
}
class SimpleTypeResolutionSuccess {
private @lombok.Getter int x;
SimpleTypeResolutionSuccess() {
+ super();
}
public @java.lang.SuppressWarnings("all") int getX() {
return this.x;
diff --git a/test/transform/resource/messages-ecj/CheckerFrameworkBasic.java.messages b/test/transform/resource/messages-ecj/CheckerFrameworkBasic.java.messages
index 9bfcba0c..8cc7fb58 100644
--- a/test/transform/resource/messages-ecj/CheckerFrameworkBasic.java.messages
+++ b/test/transform/resource/messages-ecj/CheckerFrameworkBasic.java.messages
@@ -1 +1 @@
-8 org.checkerframework cannot be resolved to a type
+6 org.checkerframework.common cannot be resolved to a type
diff --git a/test/transform/resource/messages-ecj/CheckerFrameworkSuperBuilder.java.messages b/test/transform/resource/messages-ecj/CheckerFrameworkSuperBuilder.java.messages
index d385a95c..8cc7fb58 100644
--- a/test/transform/resource/messages-ecj/CheckerFrameworkSuperBuilder.java.messages
+++ b/test/transform/resource/messages-ecj/CheckerFrameworkSuperBuilder.java.messages
@@ -1 +1 @@
-6 org.checkerframework cannot be resolved to a type
+6 org.checkerframework.common cannot be resolved to a type