aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/lombok/eclipse/EcjAugments.java (renamed from src/core/lombok/eclipse/EclipseAugments.java)15
-rw-r--r--src/core/lombok/eclipse/HandlerLibrary.java2
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java46
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java54
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java11
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java6
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java7
-rwxr-xr-xsrc/eclipseAgent/lombok/launch/PatchFixesHider.java10
-rw-r--r--test/core/src/lombok/DirectoryRunner.java3
-rw-r--r--test/core/src/lombok/LombokTestSource.java5
-rw-r--r--test/core/src/lombok/RunTestsViaEcj.java96
-rw-r--r--test/stubs/org/checkerframework/checker/objectconstruction/qual/CalledMethods.java17
-rw-r--r--test/stubs/org/checkerframework/checker/objectconstruction/qual/NotCalledMethods.java17
-rw-r--r--test/stubs/org/checkerframework/common/aliasing/qual/Unique.java12
-rw-r--r--test/stubs/org/checkerframework/common/returnsreceiver/qual/This.java12
-rw-r--r--test/stubs/org/checkerframework/dataflow/qual/Pure.java12
-rw-r--r--test/stubs/org/checkerframework/dataflow/qual/SideEffectFree.java12
-rw-r--r--test/transform/resource/after-delombok/BuilderWithDeprecatedAnnOnly.java104
-rw-r--r--test/transform/resource/after-delombok/WithMethodMarkedDeprecatedAnnOnly.java11
-rw-r--r--test/transform/resource/after-ecj/BuilderWithDeprecatedAnnOnly.java88
-rw-r--r--test/transform/resource/after-ecj/GetterSetterJavadocEcj.java86
-rw-r--r--test/transform/resource/after-ecj/SetterDeprecatedEcj.java14
-rw-r--r--test/transform/resource/after-ecj/WithMethodMarkedDeprecatedAnnOnly.java11
-rw-r--r--test/transform/resource/before/BuilderJavadoc.java1
-rw-r--r--test/transform/resource/before/BuilderWithDeprecated.java1
-rw-r--r--test/transform/resource/before/BuilderWithDeprecatedAnnOnly.java10
-rw-r--r--test/transform/resource/before/DelegateAlreadyImplemented.java1
-rw-r--r--test/transform/resource/before/DelegateFlagUsage.java1
-rw-r--r--test/transform/resource/before/DelegateGenerics.java1
-rw-r--r--test/transform/resource/before/DelegateOnGetter.java1
-rw-r--r--test/transform/resource/before/DelegateOnGetterNone.java1
-rw-r--r--test/transform/resource/before/DelegateOnMethods.java1
-rw-r--r--test/transform/resource/before/DelegateOnStatic.java1
-rw-r--r--test/transform/resource/before/DelegateRecursion.java1
-rw-r--r--test/transform/resource/before/DelegateTypesAndExcludes.java1
-rw-r--r--test/transform/resource/before/DelegateWithDeprecated.java1
-rw-r--r--test/transform/resource/before/DelegateWithVarargs.java1
-rw-r--r--test/transform/resource/before/DelegateWithVarargs2.java1
-rw-r--r--test/transform/resource/before/GetterDeprecated.java3
-rw-r--r--test/transform/resource/before/GetterSetterJavadoc.java1
-rw-r--r--test/transform/resource/before/GetterSetterJavadocEcj.java65
-rw-r--r--test/transform/resource/before/OnXJava7StyleOn8.java2
-rw-r--r--test/transform/resource/before/OnXJava8StyleOn7.java2
-rw-r--r--test/transform/resource/before/SetterAndWithMethodJavadoc.java1
-rw-r--r--test/transform/resource/before/SetterDeprecated.java3
-rw-r--r--test/transform/resource/before/SetterDeprecatedEcj.java12
-rw-r--r--test/transform/resource/before/ValDelegateMethodReference.java2
-rw-r--r--test/transform/resource/before/WithMethodMarkedDeprecated.java1
-rw-r--r--test/transform/resource/before/WithMethodMarkedDeprecatedAnnOnly.java10
49 files changed, 717 insertions, 60 deletions
diff --git a/src/core/lombok/eclipse/EclipseAugments.java b/src/core/lombok/eclipse/EcjAugments.java
index 783e25c9..965c4fb6 100644
--- a/src/core/lombok/eclipse/EclipseAugments.java
+++ b/src/core/lombok/eclipse/EcjAugments.java
@@ -33,8 +33,8 @@ import org.eclipse.jdt.internal.core.SourceMethod;
import lombok.core.FieldAugment;
-public final class EclipseAugments {
- private EclipseAugments() {
+public final class EcjAugments {
+ private EcjAugments() {
// Prevent instantiation
}
@@ -42,6 +42,13 @@ public final class EclipseAugments {
public static final FieldAugment<ASTNode, Boolean> ASTNode_handled = FieldAugment.augment(ASTNode.class, boolean.class, "lombok$handled");
public static final FieldAugment<ASTNode, ASTNode> ASTNode_generatedBy = FieldAugment.augment(ASTNode.class, ASTNode.class, "$generatedBy");
public static final FieldAugment<Annotation, Boolean> Annotation_applied = FieldAugment.augment(Annotation.class, boolean.class, "lombok$applied");
- public static final FieldAugment<CompilationUnit, Map<String, String>> CompilationUnit_javadoc = FieldAugment.augment(CompilationUnit.class, Map.class, "$javadoc");
- public static final FieldAugment<CompilationUnit, ConcurrentMap<String, List<SourceMethod>>> CompilationUnit_delegateMethods = FieldAugment.augment(CompilationUnit.class, ConcurrentMap.class, "$delegateMethods");
+
+ public static final class EclipseAugments {
+ private EclipseAugments() {
+ // Prevent instantiation
+ }
+
+ public static final FieldAugment<CompilationUnit, Map<String, String>> CompilationUnit_javadoc = FieldAugment.augment(CompilationUnit.class, Map.class, "$javadoc");
+ public static final FieldAugment<CompilationUnit, ConcurrentMap<String, List<SourceMethod>>> CompilationUnit_delegateMethods = FieldAugment.augment(CompilationUnit.class, ConcurrentMap.class, "$delegateMethods");
+ }
}
diff --git a/src/core/lombok/eclipse/HandlerLibrary.java b/src/core/lombok/eclipse/HandlerLibrary.java
index 0e72fb38..8d69325e 100644
--- a/src/core/lombok/eclipse/HandlerLibrary.java
+++ b/src/core/lombok/eclipse/HandlerLibrary.java
@@ -23,7 +23,7 @@ package lombok.eclipse;
import static lombok.eclipse.Eclipse.*;
import static lombok.eclipse.handlers.EclipseHandlerUtil.*;
-import static lombok.eclipse.EclipseAugments.ASTNode_handled;
+import static lombok.eclipse.EcjAugments.ASTNode_handled;
import java.io.IOException;
import java.lang.annotation.Annotation;
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index d85c2ee8..03f26341 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -23,7 +23,7 @@ package lombok.eclipse.handlers;
import static lombok.core.handlers.HandlerUtil.*;
import static lombok.eclipse.Eclipse.*;
-import static lombok.eclipse.EclipseAugments.*;
+import static lombok.eclipse.EcjAugments.*;
import static lombok.eclipse.handlers.EclipseHandlerUtil.EclipseReflectiveMembers.*;
import java.lang.reflect.Array;
@@ -2649,22 +2649,42 @@ public class EclipseHandlerUtil {
return null;
}
+ private static class EclipseOnlyUtil {
+ public static void setDocComment(CompilationUnitDeclaration cud, TypeDeclaration type, ASTNode node, String doc) {
+ if (cud.compilationResult.compilationUnit instanceof CompilationUnit) {
+ CompilationUnit compilationUnit = (CompilationUnit) cud.compilationResult.compilationUnit;
+ Map<String, String> docs = EclipseAugments.CompilationUnit_javadoc.setIfAbsent(compilationUnit, new HashMap<String, String>());
+
+ if (node instanceof AbstractMethodDeclaration) {
+ AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) node;
+ String signature = getSignature(type, methodDeclaration);
+ /* Add javadoc start marker, add leading asterisks to each line, add javadoc end marker */
+ docs.put(signature, String.format("/**%n%s%n */", doc.replaceAll("(?m)^", " * ")));
+ }
+ }
+ }
+ }
+
+ private static Boolean eclipseMode;
+ private static boolean eclipseMode() {
+ if (eclipseMode != null) return eclipseMode.booleanValue();
+ try {
+ Class.forName("org.eclipse.jdt.internal.core.CompilationUnit");
+ eclipseMode = true;
+ } catch (Exception e) {
+ eclipseMode = false;
+ }
+ return eclipseMode;
+ }
+
public static void setDocComment(CompilationUnitDeclaration cud, EclipseNode eclipseNode, String doc) {
+ if (!eclipseMode()) return;
setDocComment(cud, (TypeDeclaration) upToTypeNode(eclipseNode).get(), eclipseNode.get(), doc);
}
-
+
public static void setDocComment(CompilationUnitDeclaration cud, TypeDeclaration type, ASTNode node, String doc) {
- if (cud.compilationResult.compilationUnit instanceof CompilationUnit) {
- CompilationUnit compilationUnit = (CompilationUnit) cud.compilationResult.compilationUnit;
- Map<String, String> docs = CompilationUnit_javadoc.setIfAbsent(compilationUnit, new HashMap<String, String>());
-
- if (node instanceof AbstractMethodDeclaration) {
- AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) node;
- String signature = getSignature(type, methodDeclaration);
- /* Add javadoc start marker, add leading asterisks to each line, add javadoc end marker */
- docs.put(signature, String.format("/**%n%s%n */", doc.replaceAll("(?m)^", " * ")));
- }
- }
+ if (!eclipseMode()) return;
+ EclipseOnlyUtil.setDocComment(cud, type, node, doc);
}
public static String getSignature(TypeDeclaration type, AbstractMethodDeclaration methodDeclaration) {
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index 2379d0a0..5ff29758 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -144,12 +144,12 @@ public class JavacHandlerUtil {
Options options = Options.instance(context);
return (options.keySet().contains("ide") && !options.keySet().contains("backgroundCompilation"));
}
-
+
public static boolean inNetbeansCompileOnSave(Context context) {
Options options = Options.instance(context);
return (options.keySet().contains("ide") && options.keySet().contains("backgroundCompilation"));
}
-
+
public static JCTree getGeneratedBy(JCTree node) {
return JCTree_generatedNode.get(node);
}
@@ -1026,7 +1026,7 @@ public class JavacHandlerUtil {
public static JavacNode injectField(JavacNode typeNode, JCVariableDecl field) {
return injectField(typeNode, field, false);
}
-
+
public static JavacNode injectField(JavacNode typeNode, JCVariableDecl field, boolean addGenerated) {
return injectField(typeNode, field, addGenerated, false);
}
@@ -1076,6 +1076,17 @@ public class JavacHandlerUtil {
private static Constructor<?> CONSTRUCTOR;
private static Field ANNOTATIONS, UNDERLYING_TYPE;
+ private static void initByLoader(ClassLoader classLoader) {
+ if (TYPE != null) return;
+ Class<?> c;
+ try {
+ c = classLoader.loadClass("com.sun.tools.javac.tree.JCTree$JCAnnotatedType");
+ } catch (Exception e) {
+ return;
+ }
+ init(c);
+ }
+
private static void init(Class<?> in) {
if (TYPE != null) return;
if (!in.getName().equals("com.sun.tools.javac.tree.JCTree$JCAnnotatedType")) return;
@@ -1120,17 +1131,18 @@ public class JavacHandlerUtil {
}
static JCExpression create(List<JCAnnotation> annotations, JCExpression underlyingType) {
+ initByLoader(underlyingType.getClass().getClassLoader());
try {
return (JCExpression) CONSTRUCTOR.newInstance(annotations, underlyingType);
} catch (Exception e) {
- return null;
+ return underlyingType;
}
}
}
-
+
static class JCAnnotationReflect {
private static Field ATTRIBUTE;
-
+
static {
try {
ATTRIBUTE = Permit.getField(JCAnnotation.class, "attribute");
@@ -1199,7 +1211,7 @@ public class JavacHandlerUtil {
Context context = typeNode.getContext();
Symtab symtab = Symtab.instance(context);
JCClassDecl type = (JCClassDecl) typeNode.get();
-
+
if (method.getName().contentEquals("<init>")) {
//Scan for default constructor, and remove it.
int idx = 0;
@@ -1216,11 +1228,11 @@ public class JavacHandlerUtil {
idx++;
}
}
-
+
addSuppressWarningsAll(method.mods, typeNode, method.pos, getGeneratedBy(method), typeNode.getContext());
addGenerated(method.mods, typeNode, method.pos, getGeneratedBy(method), typeNode.getContext());
type.defs = type.defs.append(method);
-
+
List<Symbol.VarSymbol> params = null;
if (method.getParameters() != null && !method.getParameters().isEmpty()) {
ListBuffer<Symbol.VarSymbol> newParams = new ListBuffer<Symbol.VarSymbol>();
@@ -1250,12 +1262,12 @@ public class JavacHandlerUtil {
params = newParams.toList();
if (params.length() != method.getParameters().length()) params = null;
}
-
+
fixMethodMirror(typeNode.getContext(), typeNode.getElement(), method.getModifiers().flags, method.getName(), paramTypes, params, returnType);
-
+
typeNode.add(method, Kind.METHOD);
}
-
+
private static void fixMethodMirror(Context context, Element typeMirror, long access, Name methodName, List<Type> paramTypes, List<Symbol.VarSymbol> params, Type returnType) {
if (typeMirror == null || paramTypes == null || returnType == null) return;
ClassSymbol cs = (ClassSymbol) typeMirror;
@@ -1428,6 +1440,7 @@ public class JavacHandlerUtil {
}
return e;
}
+
/**
* In javac, dotted access of any kind, from {@code java.lang.String} to {@code var.methodName}
* is represented by a fold-left of {@code Select} nodes with the leftmost string represented by
@@ -1831,20 +1844,30 @@ public class JavacHandlerUtil {
public static JCExpression namePlusTypeParamsToTypeReference(JavacTreeMaker maker, JavacNode type, List<JCTypeParameter> params) {
JCClassDecl td = (JCClassDecl) type.get();
boolean instance = (td.mods.flags & Flags.STATIC) == 0;
- return namePlusTypeParamsToTypeReference(maker, type.up(), td.name, instance, params);
+ return namePlusTypeParamsToTypeReference(maker, type.up(), td.name, instance, params, List.<JCAnnotation>nil());
+ }
+
+ public static JCExpression namePlusTypeParamsToTypeReference(JavacTreeMaker maker, JavacNode type, List<JCTypeParameter> params, List<JCAnnotation> annotations) {
+ JCClassDecl td = (JCClassDecl) type.get();
+ boolean instance = (td.mods.flags & Flags.STATIC) == 0;
+ return namePlusTypeParamsToTypeReference(maker, type.up(), td.name, instance, params, annotations);
}
public static JCExpression namePlusTypeParamsToTypeReference(JavacTreeMaker maker, JavacNode parentType, Name typeName, boolean instance, List<JCTypeParameter> params) {
+ return namePlusTypeParamsToTypeReference(maker, parentType, typeName, instance, params, List.<JCAnnotation>nil());
+ }
+
+ public static JCExpression namePlusTypeParamsToTypeReference(JavacTreeMaker maker, JavacNode parentType, Name typeName, boolean instance, List<JCTypeParameter> params, List<JCAnnotation> annotations) {
JCExpression r = null;
-
if (parentType != null && parentType.getKind() == Kind.TYPE) {
JCClassDecl td = (JCClassDecl) parentType.get();
boolean outerInstance = instance && ((td.mods.flags & Flags.STATIC) == 0);
List<JCTypeParameter> outerParams = instance ? td.typarams : List.<JCTypeParameter>nil();
- r = namePlusTypeParamsToTypeReference(maker, parentType.up(), td.name, outerInstance, outerParams);
+ r = namePlusTypeParamsToTypeReference(maker, parentType.up(), td.name, outerInstance, outerParams, List.<JCAnnotation>nil());
}
r = r == null ? maker.Ident(typeName) : maker.Select(r, typeName);
+ if (!annotations.isEmpty()) r = JCAnnotatedTypeReflect.create(annotations, r);
if (!params.isEmpty()) r = maker.TypeApply(r, typeParameterNames(maker, params));
return r;
}
@@ -2078,6 +2101,7 @@ public class JavacHandlerUtil {
public static void copyJavadoc(JavacNode from, JCTree to, CopyJavadoc copyMode) {
copyJavadoc(from, to, copyMode, false);
}
+
/**
* Copies javadoc on one node to the other.
*
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
index 3412000e..75263bdd 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
@@ -50,8 +50,7 @@ import lombok.patcher.scripts.ScriptBuilder;
*/
public class EclipsePatcher implements AgentLauncher.AgentLaunchable {
// At some point I'd like the agent to be capable of auto-detecting if its on eclipse or on ecj. This class is a sure sign we're not in ecj but in eclipse. -ReinierZ
- @SuppressWarnings("unused")
- private static final String ECLIPSE_SIGNATURE_CLASS = "org/eclipse/core/runtime/adaptor/EclipseStarter";
+ private static final String ECLIPSE_SIGNATURE_CLASS = "org.eclipse.core.runtime.adaptor.EclipseStarter";
@Override public void runAgent(String agentArgs, Instrumentation instrumentation, boolean injected, Class<?> launchingContext) throws Exception {
String[] args = agentArgs == null ? new String[0] : agentArgs.split(":");
@@ -73,6 +72,12 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable {
else if (forceEclipse) ecj = false;
else ecj = injected;
+ if (!ecj) try {
+ Class.forName(ECLIPSE_SIGNATURE_CLASS);
+ } catch (ClassNotFoundException e) {
+ ecj = true;
+ }
+
registerPatchScripts(instrumentation, injected, ecj, launchingContext);
}
@@ -117,6 +122,7 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable {
patchExtractInterface(sm);
patchAboutDialog(sm);
patchEclipseDebugPatches(sm);
+ patchJavadoc(sm);
} else {
patchPostCompileHookEcj(sm);
}
@@ -127,7 +133,6 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable {
patchExtensionMethod(sm, ecjOnly);
patchRenameField(sm);
patchNullCheck(sm);
- patchJavadoc(sm);
if (reloadExistingClasses) sm.reloadClasses(instrumentation);
}
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java
index e92ed674..b90d5762 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java
@@ -22,7 +22,7 @@
package lombok.eclipse.agent;
import static lombok.eclipse.Eclipse.*;
-import static lombok.eclipse.EclipseAugments.*;
+import static lombok.eclipse.EcjAugments.*;
import static lombok.eclipse.handlers.EclipseHandlerUtil.*;
import java.lang.reflect.Method;
@@ -724,7 +724,7 @@ public class PatchDelegate {
private static void cleanupDelegateMethods(CompilationUnitDeclaration cud) {
CompilationUnit compilationUnit = getCompilationUnit(cud);
if (compilationUnit != null) {
- CompilationUnit_delegateMethods.clear(compilationUnit);
+ EclipseAugments.CompilationUnit_delegateMethods.clear(compilationUnit);
}
}
@@ -819,7 +819,7 @@ public class PatchDelegate {
if (sourceType != null) {
CompilationUnit compilationUnit = getCompilationUnit(sourceType.getCompilationUnit());
if (compilationUnit != null) {
- ConcurrentMap<String, List<SourceMethod>> map = CompilationUnit_delegateMethods.setIfAbsent(compilationUnit, new ConcurrentHashMap<String, List<SourceMethod>>());
+ ConcurrentMap<String, List<SourceMethod>> map = EclipseAugments.CompilationUnit_delegateMethods.setIfAbsent(compilationUnit, new ConcurrentHashMap<String, List<SourceMethod>>());
List<SourceMethod> newList = new ArrayList<SourceMethod>();
List<SourceMethod> oldList = map.putIfAbsent(sourceType.getTypeQualifiedName(), newList);
return oldList != null ? oldList : newList;
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java b/src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java
index a91e4d8b..19a0383a 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java
@@ -21,7 +21,7 @@
*/
package lombok.eclipse.agent;
-import static lombok.eclipse.EclipseAugments.CompilationUnit_javadoc;
+import static lombok.eclipse.EcjAugments.EclipseAugments.CompilationUnit_javadoc;
import java.lang.reflect.Method;
import java.util.Map;
@@ -36,7 +36,6 @@ import org.eclipse.jdt.internal.core.CompilationUnit;
import org.eclipse.jdt.internal.core.SourceMethod;
import org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2;
-import lombok.eclipse.EclipseAugments;
import lombok.eclipse.handlers.EclipseHandlerUtil;
import lombok.permit.Permit;
@@ -52,7 +51,7 @@ public class PatchJavadoc {
ICompilationUnit iCompilationUnit = sourceMethod.getCompilationUnit();
if (iCompilationUnit instanceof CompilationUnit) {
CompilationUnit compilationUnit = (CompilationUnit) iCompilationUnit;
- Map<String, String> docs = EclipseAugments.CompilationUnit_javadoc.get(compilationUnit);
+ Map<String, String> docs = CompilationUnit_javadoc.get(compilationUnit);
String signature = getSignature(sourceMethod);
String rawJavadoc = docs.get(signature);
@@ -80,7 +79,7 @@ public class PatchJavadoc {
}
return methodDeclaration.print(tab, output);
}
-
+
private static String getSignature(SourceMethod sourceMethod) {
StringBuilder sb = new StringBuilder();
sb.append(sourceMethod.getParent().getElementName());
diff --git a/src/eclipseAgent/lombok/launch/PatchFixesHider.java b/src/eclipseAgent/lombok/launch/PatchFixesHider.java
index a2cda66c..55e8e0bf 100755
--- a/src/eclipseAgent/lombok/launch/PatchFixesHider.java
+++ b/src/eclipseAgent/lombok/launch/PatchFixesHider.java
@@ -66,7 +66,7 @@ import org.eclipse.jdt.internal.core.dom.rewrite.TokenScanner;
import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup;
import org.eclipse.jdt.internal.corext.refactoring.structure.ASTNodeSearchUtil;
-import lombok.eclipse.EclipseAugments;
+import static lombok.eclipse.EcjAugments.ASTNode_generatedBy;
/** These contain a mix of the following:
* <ul>
@@ -545,14 +545,14 @@ final class PatchFixesHider {
public static int fixRetrieveRightBraceOrSemiColonPosition(int retVal, AbstractMethodDeclaration amd) {
if (retVal != -1 || amd == null) return retVal;
- boolean isGenerated = EclipseAugments.ASTNode_generatedBy.get(amd) != null;
+ boolean isGenerated = ASTNode_generatedBy.get(amd) != null;
if (isGenerated) return amd.declarationSourceEnd;
return -1;
}
public static int fixRetrieveRightBraceOrSemiColonPosition(int retVal, FieldDeclaration fd) {
if (retVal != -1 || fd == null) return retVal;
- boolean isGenerated = EclipseAugments.ASTNode_generatedBy.get(fd) != null;
+ boolean isGenerated = ASTNode_generatedBy.get(fd) != null;
if (isGenerated) return fd.declarationSourceEnd;
return -1;
}
@@ -578,13 +578,13 @@ final class PatchFixesHider {
org.eclipse.jdt.internal.compiler.ast.ASTNode internalNode) throws Exception {
if (internalNode == null || domNode == null) return;
- boolean isGenerated = EclipseAugments.ASTNode_generatedBy.get(internalNode) != null;
+ boolean isGenerated = ASTNode_generatedBy.get(internalNode) != null;
if (isGenerated) domNode.getClass().getField("$isGenerated").set(domNode, true);
}
public static void setIsGeneratedFlagForName(org.eclipse.jdt.core.dom.Name name, Object internalNode) throws Exception {
if (internalNode instanceof org.eclipse.jdt.internal.compiler.ast.ASTNode) {
- boolean isGenerated = EclipseAugments.ASTNode_generatedBy.get((org.eclipse.jdt.internal.compiler.ast.ASTNode) internalNode) != null;
+ boolean isGenerated = ASTNode_generatedBy.get((org.eclipse.jdt.internal.compiler.ast.ASTNode) internalNode) != null;
if (isGenerated) name.getClass().getField("$isGenerated").set(name, true);
}
}
diff --git a/test/core/src/lombok/DirectoryRunner.java b/test/core/src/lombok/DirectoryRunner.java
index a174355d..93b18039 100644
--- a/test/core/src/lombok/DirectoryRunner.java
+++ b/test/core/src/lombok/DirectoryRunner.java
@@ -180,7 +180,8 @@ public class DirectoryRunner extends Runner {
case DELOMBOK:
return new RunTestsViaDelombok().createTester(params, file, "javac", params.getVersion());
case ECJ:
- return new RunTestsViaEcj().createTester(params, file, "ecj", params.getVersion());
+ String platform = RunTestsViaEcj.eclipseAvailable() ? "eclipse" : "ecj";
+ return new RunTestsViaEcj().createTester(params, file, platform, params.getVersion());
default:
case JAVAC:
throw new UnsupportedOperationException();
diff --git a/test/core/src/lombok/LombokTestSource.java b/test/core/src/lombok/LombokTestSource.java
index a0a6407a..e23a0f57 100644
--- a/test/core/src/lombok/LombokTestSource.java
+++ b/test/core/src/lombok/LombokTestSource.java
@@ -65,7 +65,10 @@ public class LombokTestSource {
public boolean runOnPlatform(String platform) {
if (platforms == null || platforms.isEmpty()) return true;
- for (String pl : platforms) if (pl.equalsIgnoreCase(platform)) return true;
+ for (String pl : platforms) {
+ if (pl.startsWith("!") && pl.regionMatches(true, 1, platform, 0, platform.length())) return false;
+ if (pl.equalsIgnoreCase(platform)) return true;
+ }
return false;
}
diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java
index b98c19b7..1d840a21 100644
--- a/test/core/src/lombok/RunTestsViaEcj.java
+++ b/test/core/src/lombok/RunTestsViaEcj.java
@@ -35,6 +35,14 @@ import java.util.concurrent.atomic.AtomicReference;
import lombok.eclipse.Eclipse;
import lombok.javac.CapturingDiagnosticListener.CompilerMessage;
+import org.eclipse.core.internal.registry.ExtensionRegistry;
+import org.eclipse.core.internal.runtime.Activator;
+import org.eclipse.core.internal.runtime.PlatformActivator;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.RegistryFactory;
+import org.eclipse.core.runtime.adaptor.EclipseStarter;
+import org.eclipse.core.runtime.spi.IRegistryProvider;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.compiler.CategorizedProblem;
import org.eclipse.jdt.core.compiler.CharOperation;
@@ -49,6 +57,9 @@ import org.eclipse.jdt.internal.compiler.batch.FileSystem;
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
+import org.eclipse.jdt.internal.core.JavaModelManager;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
public class RunTestsViaEcj extends AbstractRunTests {
protected CompilerOptions ecjCompilerOptions() {
@@ -107,7 +118,17 @@ public class RunTestsViaEcj extends AbstractRunTests {
String source = readFile(file);
char[] sourceArray = source.toCharArray();
- final ICompilationUnit sourceUnit = new TestCompilationUnit(file.getName(), source);
+ final ICompilationUnit sourceUnit;
+ try {
+ if (eclipseAvailable()) {
+ sourceUnit = new TestCompilationUnitEclipse(file.getName(), source);
+ } else {
+ sourceUnit = new TestCompilationUnitEcj(file.getName(), source);
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ return false;
+ }
Compiler ecjCompiler = new Compiler(createFileSystem(file, minVersion), ecjErrorHandlingPolicy(), ecjCompilerOptions(), bitbucketRequestor, new DefaultProblemFactory(Locale.ENGLISH)) {
@Override protected synchronized void addCompilationUnit(ICompilationUnit inUnit, CompilationUnitDeclaration parsedUnit) {
@@ -116,6 +137,8 @@ public class RunTestsViaEcj extends AbstractRunTests {
}
};
+ // initializeEclipseBundles();
+
ecjCompiler.compile(new ICompilationUnit[] {sourceUnit});
CompilationResult compilationResult = compilationResult_.get();
@@ -137,7 +160,37 @@ public class RunTestsViaEcj extends AbstractRunTests {
return true;
}
- private boolean eclipseAvailable() {
+ @SuppressWarnings("unused")
+ private static class EclipseInitializer {
+ static void initializeEclipseBundles() throws Exception {
+ // This code does not work yet, it's research-in-progress.
+ // The problem is that parts of the eclipse handler (in `PatchValEclipse` and friends) do not work unless
+ // an actual eclipse exists; PatchVal causes code to run that will end up running `ResourcesPlugin.getWorkspace()`, which
+ // goes down a rabbit hole of pinging off of various static fields (or `getX()` calls which return static fields), all
+ // of which are `null` until the plugin they belong to is properly initialized.
+ // This code is work in progress to 'hack' the initialization of each plugin one-by-one, but I doubt this is the right
+ // way to do it, as I bet it's fragile (will break when eclipse updates rather easily), and who knows how many fields
+ // and things need to be initialized.
+ // A better plan would be to start an actual, real eclipse, by telling `EclipseStarter.startup` to launch some sort of
+ // application (or at least a bunch of bundles/products/apps, including the JDT). This will then take long enough that
+ // it'll need to be cached and re-used for each test or the Eclipse test run would take far too long.
+
+ BundleContext context = EclipseStarter.startup(new String[0], null);
+ RegistryFactory.setDefaultRegistryProvider(new IRegistryProvider() {
+ private final ExtensionRegistry REG = new ExtensionRegistry(null, null, null);
+ @Override public IExtensionRegistry getRegistry() {
+ return REG;
+ }
+ });
+ new Activator().start(context);
+ new PlatformActivator().start(context);
+ for (Bundle b : context.getBundles()) System.out.println("BUNDLE: " + b.getSymbolicName());
+ new ResourcesPlugin().start(context);
+ JavaModelManager.getJavaModelManager().startup();
+ }
+ }
+
+ static boolean eclipseAvailable() {
try {
Class.forName("org.eclipse.jdt.core.dom.CompilationUnit");
} catch (Throwable t) {
@@ -171,7 +224,7 @@ public class RunTestsViaEcj extends AbstractRunTests {
i.remove();
}
}
- if (new File("bin").exists()) classpath.add("bin");
+ if (new File("bin/main").exists()) classpath.add("bin/main");
classpath.add("dist/lombok.jar");
if (bootRuntimePath == null || bootRuntimePath.isEmpty()) throw new IllegalStateException("System property delombok.bootclasspath is not set; set it to the rt of java6 or java8");
classpath.add(bootRuntimePath);
@@ -184,11 +237,44 @@ public class RunTestsViaEcj extends AbstractRunTests {
return new FileSystem(classpath.toArray(new String[0]), new String[] {file.getAbsolutePath()}, "UTF-8");
}
- private static final class TestCompilationUnit extends org.eclipse.jdt.internal.core.CompilationUnit {
+ private static final class TestCompilationUnitEcj implements ICompilationUnit {
+ private final char[] name, source, mainTypeName;
+
+ TestCompilationUnitEcj(String name, String source) {
+ this.source = source.toCharArray();
+ this.name = name.toCharArray();
+
+ char[] fileNameCharArray = getFileName();
+ int start = CharOperation.lastIndexOf(File.separatorChar, fileNameCharArray) + 1;
+ int end = CharOperation.lastIndexOf('.', fileNameCharArray);
+ if (end == -1) {
+ end = fileNameCharArray.length;
+ }
+ mainTypeName = CharOperation.subarray(fileNameCharArray, start, end);
+ }
+
+ @Override public char[] getFileName() {
+ return name;
+ }
+
+ @Override public char[] getContents() {
+ return source;
+ }
+
+ @Override public char[] getMainTypeName() {
+ return mainTypeName;
+ }
+
+ @Override public char[][] getPackageName() {
+ return null;
+ }
+ }
+
+ private static final class TestCompilationUnitEclipse extends org.eclipse.jdt.internal.core.CompilationUnit {
private final char[] source;
private final char[] mainTypeName;
- private TestCompilationUnit(String name, String source) {
+ private TestCompilationUnitEclipse(String name, String source) {
super(null, name, null);
this.source = source.toCharArray();
diff --git a/test/stubs/org/checkerframework/checker/objectconstruction/qual/CalledMethods.java b/test/stubs/org/checkerframework/checker/objectconstruction/qual/CalledMethods.java
new file mode 100644
index 00000000..bddeae39
--- /dev/null
+++ b/test/stubs/org/checkerframework/checker/objectconstruction/qual/CalledMethods.java
@@ -0,0 +1,17 @@
+package org.checkerframework.checker.objectconstruction.qual;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+public @interface CalledMethods {
+ /**
+ * Methods that have been called, on any expression whose type is annotated.
+ *
+ * @return methods that have been called
+ */
+ public String[] value() default {};
+} \ No newline at end of file
diff --git a/test/stubs/org/checkerframework/checker/objectconstruction/qual/NotCalledMethods.java b/test/stubs/org/checkerframework/checker/objectconstruction/qual/NotCalledMethods.java
new file mode 100644
index 00000000..32fe68c9
--- /dev/null
+++ b/test/stubs/org/checkerframework/checker/objectconstruction/qual/NotCalledMethods.java
@@ -0,0 +1,17 @@
+package org.checkerframework.checker.objectconstruction.qual;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+public @interface NotCalledMethods {
+ /**
+ * Methods that have been called, on any expression whose type is annotated.
+ *
+ * @return methods that have been called
+ */
+ public String[] value() default {};
+} \ No newline at end of file
diff --git a/test/stubs/org/checkerframework/common/aliasing/qual/Unique.java b/test/stubs/org/checkerframework/common/aliasing/qual/Unique.java
new file mode 100644
index 00000000..fe7acfca
--- /dev/null
+++ b/test/stubs/org/checkerframework/common/aliasing/qual/Unique.java
@@ -0,0 +1,12 @@
+package org.checkerframework.common.aliasing.qual;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+public @interface Unique {} \ No newline at end of file
diff --git a/test/stubs/org/checkerframework/common/returnsreceiver/qual/This.java b/test/stubs/org/checkerframework/common/returnsreceiver/qual/This.java
new file mode 100644
index 00000000..8ae1cd59
--- /dev/null
+++ b/test/stubs/org/checkerframework/common/returnsreceiver/qual/This.java
@@ -0,0 +1,12 @@
+package org.checkerframework.common.returnsreceiver.qual;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@Inherited
+public @interface This {} \ No newline at end of file
diff --git a/test/stubs/org/checkerframework/dataflow/qual/Pure.java b/test/stubs/org/checkerframework/dataflow/qual/Pure.java
new file mode 100644
index 00000000..d9bb1bf4
--- /dev/null
+++ b/test/stubs/org/checkerframework/dataflow/qual/Pure.java
@@ -0,0 +1,12 @@
+package org.checkerframework.dataflow.qual;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+public @interface Pure {} \ No newline at end of file
diff --git a/test/stubs/org/checkerframework/dataflow/qual/SideEffectFree.java b/test/stubs/org/checkerframework/dataflow/qual/SideEffectFree.java
new file mode 100644
index 00000000..9c32d369
--- /dev/null
+++ b/test/stubs/org/checkerframework/dataflow/qual/SideEffectFree.java
@@ -0,0 +1,12 @@
+package org.checkerframework.dataflow.qual;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+public @interface SideEffectFree {} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/BuilderWithDeprecatedAnnOnly.java b/test/transform/resource/after-delombok/BuilderWithDeprecatedAnnOnly.java
new file mode 100644
index 00000000..f039c047
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderWithDeprecatedAnnOnly.java
@@ -0,0 +1,104 @@
+import com.google.common.collect.ImmutableList;
+public class BuilderWithDeprecatedAnnOnly {
+ @Deprecated
+ int dep1;
+ @Deprecated
+ java.util.List<String> strings;
+ @Deprecated
+ ImmutableList<Integer> numbers;
+ @java.lang.SuppressWarnings("all")
+ BuilderWithDeprecatedAnnOnly(final int dep1, final java.util.List<String> strings, final ImmutableList<Integer> numbers) {
+ this.dep1 = dep1;
+ this.strings = strings;
+ this.numbers = numbers;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderWithDeprecatedAnnOnlyBuilder {
+ @java.lang.SuppressWarnings("all")
+ private int dep1;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<String> strings;
+ @java.lang.SuppressWarnings("all")
+ private com.google.common.collect.ImmutableList.Builder<Integer> numbers;
+ @java.lang.SuppressWarnings("all")
+ BuilderWithDeprecatedAnnOnlyBuilder() {
+ }
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder dep1(final int dep1) {
+ this.dep1 = dep1;
+ return this;
+ }
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder string(final String string) {
+ if (this.strings == null) this.strings = new java.util.ArrayList<String>();
+ this.strings.add(string);
+ return this;
+ }
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder strings(final java.util.Collection<? extends String> strings) {
+ if (strings == null) {
+ throw new java.lang.NullPointerException("strings cannot be null");
+ }
+ if (this.strings == null) this.strings = new java.util.ArrayList<String>();
+ this.strings.addAll(strings);
+ return this;
+ }
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder clearStrings() {
+ if (this.strings != null) this.strings.clear();
+ return this;
+ }
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder number(final Integer number) {
+ if (this.numbers == null) this.numbers = com.google.common.collect.ImmutableList.builder();
+ this.numbers.add(number);
+ return this;
+ }
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder numbers(final java.lang.Iterable<? extends Integer> numbers) {
+ if (numbers == null) {
+ throw new java.lang.NullPointerException("numbers cannot be null");
+ }
+ if (this.numbers == null) this.numbers = com.google.common.collect.ImmutableList.builder();
+ this.numbers.addAll(numbers);
+ return this;
+ }
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder clearNumbers() {
+ this.numbers = null;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderWithDeprecatedAnnOnly build() {
+ java.util.List<String> strings;
+ switch (this.strings == null ? 0 : this.strings.size()) {
+ case 0:
+ strings = java.util.Collections.emptyList();
+ break;
+ case 1:
+ strings = java.util.Collections.singletonList(this.strings.get(0));
+ break;
+ default:
+ strings = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.strings));
+ }
+ com.google.common.collect.ImmutableList<Integer> numbers = this.numbers == null ? com.google.common.collect.ImmutableList.<Integer>of() : this.numbers.build();
+ return new BuilderWithDeprecatedAnnOnly(this.dep1, strings, numbers);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder(dep1=" + this.dep1 + ", strings=" + this.strings + ", numbers=" + this.numbers + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder builder() {
+ return new BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder();
+ }
+}
diff --git a/test/transform/resource/after-delombok/WithMethodMarkedDeprecatedAnnOnly.java b/test/transform/resource/after-delombok/WithMethodMarkedDeprecatedAnnOnly.java
new file mode 100644
index 00000000..551b59bf
--- /dev/null
+++ b/test/transform/resource/after-delombok/WithMethodMarkedDeprecatedAnnOnly.java
@@ -0,0 +1,11 @@
+class WithMethodMarkedDeprecatedAnnOnly {
+ @Deprecated
+ int annotation;
+ WithMethodMarkedDeprecatedAnnOnly(int annotation) {
+ }
+ @java.lang.Deprecated
+ @java.lang.SuppressWarnings("all")
+ public WithMethodMarkedDeprecatedAnnOnly withAnnotation(final int annotation) {
+ return this.annotation == annotation ? this : new WithMethodMarkedDeprecatedAnnOnly(annotation);
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderWithDeprecatedAnnOnly.java b/test/transform/resource/after-ecj/BuilderWithDeprecatedAnnOnly.java
new file mode 100644
index 00000000..d25dacc1
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderWithDeprecatedAnnOnly.java
@@ -0,0 +1,88 @@
+import com.google.common.collect.ImmutableList;
+import lombok.Builder;
+import lombok.Singular;
+public @Builder class BuilderWithDeprecatedAnnOnly {
+ public static @java.lang.SuppressWarnings("all") class BuilderWithDeprecatedAnnOnlyBuilder {
+ private @java.lang.SuppressWarnings("all") int dep1;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> strings;
+ private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder<Integer> numbers;
+ @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnlyBuilder() {
+ super();
+ }
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder dep1(final int dep1) {
+ this.dep1 = dep1;
+ return this;
+ }
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder string(final String string) {
+ if ((this.strings == null))
+ this.strings = new java.util.ArrayList<String>();
+ this.strings.add(string);
+ return this;
+ }
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder strings(final java.util.Collection<? extends String> strings) {
+ if ((strings == null))
+ {
+ throw new java.lang.NullPointerException("strings cannot be null");
+ }
+ if ((this.strings == null))
+ this.strings = new java.util.ArrayList<String>();
+ this.strings.addAll(strings);
+ return this;
+ }
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder clearStrings() {
+ if ((this.strings != null))
+ this.strings.clear();
+ return this;
+ }
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder number(final Integer number) {
+ if ((this.numbers == null))
+ this.numbers = com.google.common.collect.ImmutableList.builder();
+ this.numbers.add(number);
+ return this;
+ }
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder numbers(final java.lang.Iterable<? extends Integer> numbers) {
+ if ((numbers == null))
+ {
+ throw new java.lang.NullPointerException("numbers cannot be null");
+ }
+ if ((this.numbers == null))
+ this.numbers = com.google.common.collect.ImmutableList.builder();
+ this.numbers.addAll(numbers);
+ return this;
+ }
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder clearNumbers() {
+ this.numbers = null;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly build() {
+ java.util.List<String> strings;
+ switch (((this.strings == null) ? 0 : this.strings.size())) {
+ case 0 :
+ strings = java.util.Collections.emptyList();
+ break;
+ case 1 :
+ strings = java.util.Collections.singletonList(this.strings.get(0));
+ break;
+ default :
+ strings = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.strings));
+ }
+ com.google.common.collect.ImmutableList<Integer> numbers = ((this.numbers == null) ? com.google.common.collect.ImmutableList.<Integer>of() : this.numbers.build());
+ return new BuilderWithDeprecatedAnnOnly(this.dep1, strings, numbers);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((((("BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder(dep1=" + this.dep1) + ", strings=") + this.strings) + ", numbers=") + this.numbers) + ")");
+ }
+ }
+ @Deprecated int dep1;
+ @Singular @Deprecated java.util.List<String> strings;
+ @Singular @Deprecated ImmutableList<Integer> numbers;
+ @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly(final int dep1, final java.util.List<String> strings, final ImmutableList<Integer> numbers) {
+ super();
+ this.dep1 = dep1;
+ this.strings = strings;
+ this.numbers = numbers;
+ }
+ public static @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder builder() {
+ return new BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder();
+ }
+}
diff --git a/test/transform/resource/after-ecj/GetterSetterJavadocEcj.java b/test/transform/resource/after-ecj/GetterSetterJavadocEcj.java
new file mode 100644
index 00000000..83c9c3a5
--- /dev/null
+++ b/test/transform/resource/after-ecj/GetterSetterJavadocEcj.java
@@ -0,0 +1,86 @@
+@lombok.Data class GetterSetterJavadoc1 {
+ private int fieldName;
+ public @java.lang.SuppressWarnings("all") int getFieldName() {
+ return this.fieldName;
+ }
+ public @java.lang.SuppressWarnings("all") void setFieldName(final int fieldName) {
+ this.fieldName = fieldName;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof GetterSetterJavadoc1)))
+ return false;
+ final GetterSetterJavadoc1 other = (GetterSetterJavadoc1) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ if ((this.getFieldName() != other.getFieldName()))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof GetterSetterJavadoc1);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = ((result * PRIME) + this.getFieldName());
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("GetterSetterJavadoc1(fieldName=" + this.getFieldName()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") GetterSetterJavadoc1() {
+ super();
+ }
+}
+class GetterSetterJavadoc2 {
+ private @lombok.Getter @lombok.Setter int fieldName;
+ GetterSetterJavadoc2() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") int getFieldName() {
+ return this.fieldName;
+ }
+ public @java.lang.SuppressWarnings("all") void setFieldName(final int fieldName) {
+ this.fieldName = fieldName;
+ }
+}
+class GetterSetterJavadoc3 {
+ private @lombok.Getter @lombok.Setter int fieldName;
+ GetterSetterJavadoc3() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") int getFieldName() {
+ return this.fieldName;
+ }
+ public @java.lang.SuppressWarnings("all") void setFieldName(final int fieldName) {
+ this.fieldName = fieldName;
+ }
+}
+@lombok.experimental.Accessors(chain = true,fluent = true) class GetterSetterJavadoc4 {
+ private @lombok.Getter @lombok.Setter int fieldName;
+ GetterSetterJavadoc4() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") int fieldName() {
+ return this.fieldName;
+ }
+ public @java.lang.SuppressWarnings("all") GetterSetterJavadoc4 fieldName(final int fieldName) {
+ this.fieldName = fieldName;
+ return this;
+ }
+}
+@lombok.experimental.Accessors(chain = true,fluent = true) class GetterSetterJavadoc5 {
+ private @lombok.Getter @lombok.Setter int fieldName;
+ GetterSetterJavadoc5() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") int fieldName() {
+ return this.fieldName;
+ }
+ public @java.lang.SuppressWarnings("all") GetterSetterJavadoc5 fieldName(final int fieldName) {
+ this.fieldName = fieldName;
+ return this;
+ }
+}
diff --git a/test/transform/resource/after-ecj/SetterDeprecatedEcj.java b/test/transform/resource/after-ecj/SetterDeprecatedEcj.java
new file mode 100644
index 00000000..d76612b7
--- /dev/null
+++ b/test/transform/resource/after-ecj/SetterDeprecatedEcj.java
@@ -0,0 +1,14 @@
+import lombok.Setter;
+class SetterDeprecated {
+ @Deprecated @Setter int annotation;
+ @Setter int javadoc;
+ SetterDeprecated() {
+ super();
+ }
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") void setAnnotation(final int annotation) {
+ this.annotation = annotation;
+ }
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") void setJavadoc(final int javadoc) {
+ this.javadoc = javadoc;
+ }
+}
diff --git a/test/transform/resource/after-ecj/WithMethodMarkedDeprecatedAnnOnly.java b/test/transform/resource/after-ecj/WithMethodMarkedDeprecatedAnnOnly.java
new file mode 100644
index 00000000..1dcee0d8
--- /dev/null
+++ b/test/transform/resource/after-ecj/WithMethodMarkedDeprecatedAnnOnly.java
@@ -0,0 +1,11 @@
+import lombok.With;
+class WithMethodMarkedDeprecatedAnnOnly {
+ @Deprecated @With int annotation;
+ WithMethodMarkedDeprecatedAnnOnly(int annotation) {
+ super();
+ }
+ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") WithMethodMarkedDeprecatedAnnOnly withAnnotation(final int annotation) {
+ return ((this.annotation == annotation) ? this : new WithMethodMarkedDeprecatedAnnOnly(annotation));
+ }
+}
+
diff --git a/test/transform/resource/before/BuilderJavadoc.java b/test/transform/resource/before/BuilderJavadoc.java
index 390e2096..d966af28 100644
--- a/test/transform/resource/before/BuilderJavadoc.java
+++ b/test/transform/resource/before/BuilderJavadoc.java
@@ -1,3 +1,4 @@
+//platform !ecj: Javadoc copying not supported on ecj
import java.util.List;
@lombok.Builder
diff --git a/test/transform/resource/before/BuilderWithDeprecated.java b/test/transform/resource/before/BuilderWithDeprecated.java
index 1641ccb4..1b41444c 100644
--- a/test/transform/resource/before/BuilderWithDeprecated.java
+++ b/test/transform/resource/before/BuilderWithDeprecated.java
@@ -1,3 +1,4 @@
+//platform !ecj: Javadoc copying not supported on ecj
import com.google.common.collect.ImmutableList;
import lombok.Builder;
import lombok.Singular;
diff --git a/test/transform/resource/before/BuilderWithDeprecatedAnnOnly.java b/test/transform/resource/before/BuilderWithDeprecatedAnnOnly.java
new file mode 100644
index 00000000..1d2d199c
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithDeprecatedAnnOnly.java
@@ -0,0 +1,10 @@
+import com.google.common.collect.ImmutableList;
+import lombok.Builder;
+import lombok.Singular;
+
+@Builder
+public class BuilderWithDeprecatedAnnOnly {
+ @Deprecated int dep1;
+ @Singular @Deprecated java.util.List<String> strings;
+ @Singular @Deprecated ImmutableList<Integer> numbers;
+}
diff --git a/test/transform/resource/before/DelegateAlreadyImplemented.java b/test/transform/resource/before/DelegateAlreadyImplemented.java
index c43c1949..feaf3c4b 100644
--- a/test/transform/resource/before/DelegateAlreadyImplemented.java
+++ b/test/transform/resource/before/DelegateAlreadyImplemented.java
@@ -1,3 +1,4 @@
+//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run.
public class DelegateAlreadyImplemented<T> {
@lombok.experimental.Delegate
diff --git a/test/transform/resource/before/DelegateFlagUsage.java b/test/transform/resource/before/DelegateFlagUsage.java
index 1f274e24..0b52c764 100644
--- a/test/transform/resource/before/DelegateFlagUsage.java
+++ b/test/transform/resource/before/DelegateFlagUsage.java
@@ -1,3 +1,4 @@
+//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run.
//conf: lombok.delegate.flagUsage = warning
//skip compare content: We're just checking if the flagUsage key works.
public class DelegateFlagUsage {
diff --git a/test/transform/resource/before/DelegateGenerics.java b/test/transform/resource/before/DelegateGenerics.java
index e89158a9..f00c90aa 100644
--- a/test/transform/resource/before/DelegateGenerics.java
+++ b/test/transform/resource/before/DelegateGenerics.java
@@ -1,3 +1,4 @@
+//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run.
public class DelegateGenerics<T> {
@lombok.experimental.Delegate
I1<T> target;
diff --git a/test/transform/resource/before/DelegateOnGetter.java b/test/transform/resource/before/DelegateOnGetter.java
index afe09ff4..ad9d1cfb 100644
--- a/test/transform/resource/before/DelegateOnGetter.java
+++ b/test/transform/resource/before/DelegateOnGetter.java
@@ -1,3 +1,4 @@
+//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run.
import lombok.Delegate;
import lombok.Getter;
diff --git a/test/transform/resource/before/DelegateOnGetterNone.java b/test/transform/resource/before/DelegateOnGetterNone.java
index f9a97e6a..cd471369 100644
--- a/test/transform/resource/before/DelegateOnGetterNone.java
+++ b/test/transform/resource/before/DelegateOnGetterNone.java
@@ -1,3 +1,4 @@
+//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run.
import lombok.AccessLevel;
import lombok.experimental.Delegate;
import lombok.Getter;
diff --git a/test/transform/resource/before/DelegateOnMethods.java b/test/transform/resource/before/DelegateOnMethods.java
index 79189cc1..4ea70d74 100644
--- a/test/transform/resource/before/DelegateOnMethods.java
+++ b/test/transform/resource/before/DelegateOnMethods.java
@@ -1,3 +1,4 @@
+//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run.
import lombok.experimental.Delegate;
abstract class DelegateOnMethods {
diff --git a/test/transform/resource/before/DelegateOnStatic.java b/test/transform/resource/before/DelegateOnStatic.java
index 7a420b20..b9b728bc 100644
--- a/test/transform/resource/before/DelegateOnStatic.java
+++ b/test/transform/resource/before/DelegateOnStatic.java
@@ -1,3 +1,4 @@
+//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run.
//skip compare content
import lombok.experimental.Delegate;
import lombok.Getter;
diff --git a/test/transform/resource/before/DelegateRecursion.java b/test/transform/resource/before/DelegateRecursion.java
index d74107e2..c6428d06 100644
--- a/test/transform/resource/before/DelegateRecursion.java
+++ b/test/transform/resource/before/DelegateRecursion.java
@@ -1,3 +1,4 @@
+//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run.
//skip compare content: This test is to see if the 'delegate recursion is not supported' error pops up.
import lombok.experimental.Delegate;
class DelegateRecursionOuterMost {
diff --git a/test/transform/resource/before/DelegateTypesAndExcludes.java b/test/transform/resource/before/DelegateTypesAndExcludes.java
index 164261d8..2c0f8770 100644
--- a/test/transform/resource/before/DelegateTypesAndExcludes.java
+++ b/test/transform/resource/before/DelegateTypesAndExcludes.java
@@ -1,3 +1,4 @@
+//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run.
import lombok.experimental.Delegate;
class DelegatePlain {
@Delegate(types = Bar.class)
diff --git a/test/transform/resource/before/DelegateWithDeprecated.java b/test/transform/resource/before/DelegateWithDeprecated.java
index a0deb788..bf3519b3 100644
--- a/test/transform/resource/before/DelegateWithDeprecated.java
+++ b/test/transform/resource/before/DelegateWithDeprecated.java
@@ -1,3 +1,4 @@
+//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run.
import lombok.experimental.Delegate;
class DelegateWithDeprecated {
diff --git a/test/transform/resource/before/DelegateWithVarargs.java b/test/transform/resource/before/DelegateWithVarargs.java
index 0c266620..91519884 100644
--- a/test/transform/resource/before/DelegateWithVarargs.java
+++ b/test/transform/resource/before/DelegateWithVarargs.java
@@ -1,3 +1,4 @@
+//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run.
import lombok.experimental.Delegate;
class DelegateWithVarargs {
diff --git a/test/transform/resource/before/DelegateWithVarargs2.java b/test/transform/resource/before/DelegateWithVarargs2.java
index 8a3dbf14..bc3fdf09 100644
--- a/test/transform/resource/before/DelegateWithVarargs2.java
+++ b/test/transform/resource/before/DelegateWithVarargs2.java
@@ -1,3 +1,4 @@
+//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run.
import lombok.experimental.Delegate;
class DelegateWithVarargs2 {
diff --git a/test/transform/resource/before/GetterDeprecated.java b/test/transform/resource/before/GetterDeprecated.java
index 01b66bca..9d67297b 100644
--- a/test/transform/resource/before/GetterDeprecated.java
+++ b/test/transform/resource/before/GetterDeprecated.java
@@ -1,3 +1,4 @@
+//platform !ecj: Javadoc copying not supported on ecj
import lombok.Getter;
class GetterDeprecated {
@@ -8,4 +9,4 @@ class GetterDeprecated {
* @deprecated
*/
@Getter int javadoc;
-} \ No newline at end of file
+}
diff --git a/test/transform/resource/before/GetterSetterJavadoc.java b/test/transform/resource/before/GetterSetterJavadoc.java
index 2ad46f8d..44b970e8 100644
--- a/test/transform/resource/before/GetterSetterJavadoc.java
+++ b/test/transform/resource/before/GetterSetterJavadoc.java
@@ -1,3 +1,4 @@
+//platform !ecj: Javadoc copying not supported on ecj
@lombok.Data
class GetterSetterJavadoc1 {
/**
diff --git a/test/transform/resource/before/GetterSetterJavadocEcj.java b/test/transform/resource/before/GetterSetterJavadocEcj.java
new file mode 100644
index 00000000..1c24851c
--- /dev/null
+++ b/test/transform/resource/before/GetterSetterJavadocEcj.java
@@ -0,0 +1,65 @@
+//platform ecj: Javadoc copying not supported on ecj - testing that the javadoc doesnt cause any crashes
+@lombok.Data
+class GetterSetterJavadoc1 {
+ /**
+ * Some text
+ *
+ * @param fieldName Hello, World1
+ * --- GETTER ---
+ * Getter section
+ *
+ * @return Sky is blue1
+ */
+ private int fieldName;
+}
+
+class GetterSetterJavadoc2 {
+ /**
+ * Some text
+ *
+ * @param fieldName Hello, World2
+ * @return Sky is blue2
+ */
+ @lombok.Getter @lombok.Setter private int fieldName;
+}
+
+class GetterSetterJavadoc3 {
+ /**
+ * Some text
+ *
+ * **SETTER**
+ * Setter section
+ * @param fieldName Hello, World3
+ * **GETTER**
+ * Getter section
+ * @return Sky is blue3
+ */
+ @lombok.Getter @lombok.Setter private int fieldName;
+}
+
+@lombok.experimental.Accessors(chain = true, fluent = true)
+class GetterSetterJavadoc4 {
+ /**
+ * Some text
+ *
+ * @param fieldName Hello, World4
+ * @return Sky is blue4
+ */
+ @lombok.Getter @lombok.Setter private int fieldName;
+}
+
+@lombok.experimental.Accessors(chain = true, fluent = true)
+class GetterSetterJavadoc5 {
+ /**
+ * Some text
+ *
+ * **SETTER**
+ * Setter section
+ * @param fieldName Hello, World5
+ * @return Sky is blue5
+ * **GETTER**
+ * Getter section
+ * @return Sky is blue5
+ */
+ @lombok.Getter @lombok.Setter private int fieldName;
+}
diff --git a/test/transform/resource/before/OnXJava7StyleOn8.java b/test/transform/resource/before/OnXJava7StyleOn8.java
index 582fe6ce..94865c97 100644
--- a/test/transform/resource/before/OnXJava7StyleOn8.java
+++ b/test/transform/resource/before/OnXJava7StyleOn8.java
@@ -1,4 +1,4 @@
-//platform ecj
+//platform ecj,eclipse
//version 8:
public class OnXJava7StyleOn8 {
diff --git a/test/transform/resource/before/OnXJava8StyleOn7.java b/test/transform/resource/before/OnXJava8StyleOn7.java
index c006e468..98f76451 100644
--- a/test/transform/resource/before/OnXJava8StyleOn7.java
+++ b/test/transform/resource/before/OnXJava8StyleOn7.java
@@ -1,4 +1,4 @@
-//platform ecj
+//platform ecj,eclipse
//version :7
public class OnXJava8StyleOn7 {
diff --git a/test/transform/resource/before/SetterAndWithMethodJavadoc.java b/test/transform/resource/before/SetterAndWithMethodJavadoc.java
index ba10b7f2..0317cf27 100644
--- a/test/transform/resource/before/SetterAndWithMethodJavadoc.java
+++ b/test/transform/resource/before/SetterAndWithMethodJavadoc.java
@@ -1,3 +1,4 @@
+//platform !ecj: Javadoc copying not supported on ecj
import lombok.With;
class SetterAndWithMethodJavadoc {
/**
diff --git a/test/transform/resource/before/SetterDeprecated.java b/test/transform/resource/before/SetterDeprecated.java
index e655622f..a4c2ea94 100644
--- a/test/transform/resource/before/SetterDeprecated.java
+++ b/test/transform/resource/before/SetterDeprecated.java
@@ -1,3 +1,4 @@
+//platform !ecj: Javadoc copying not supported on ecj
import lombok.Setter;
class SetterDeprecated {
@@ -8,4 +9,4 @@ class SetterDeprecated {
* @deprecated
*/
@Setter int javadoc;
-} \ No newline at end of file
+}
diff --git a/test/transform/resource/before/SetterDeprecatedEcj.java b/test/transform/resource/before/SetterDeprecatedEcj.java
new file mode 100644
index 00000000..361a4fb7
--- /dev/null
+++ b/test/transform/resource/before/SetterDeprecatedEcj.java
@@ -0,0 +1,12 @@
+//platform ecj: Javadoc copying not supported on ecj
+import lombok.Setter;
+class SetterDeprecated {
+
+ @Deprecated
+ @Setter int annotation;
+
+ /**
+ * @deprecated
+ */
+ @Setter int javadoc;
+}
diff --git a/test/transform/resource/before/ValDelegateMethodReference.java b/test/transform/resource/before/ValDelegateMethodReference.java
index 7adc402a..21b781aa 100644
--- a/test/transform/resource/before/ValDelegateMethodReference.java
+++ b/test/transform/resource/before/ValDelegateMethodReference.java
@@ -1,4 +1,4 @@
-
+//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run.
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Delegate;
diff --git a/test/transform/resource/before/WithMethodMarkedDeprecated.java b/test/transform/resource/before/WithMethodMarkedDeprecated.java
index 7a6549e5..659ea1de 100644
--- a/test/transform/resource/before/WithMethodMarkedDeprecated.java
+++ b/test/transform/resource/before/WithMethodMarkedDeprecated.java
@@ -1,3 +1,4 @@
+//platform !ecj: Javadoc copying not supported on ecj
import lombok.With;
class WithMethodMarkedDeprecated {
diff --git a/test/transform/resource/before/WithMethodMarkedDeprecatedAnnOnly.java b/test/transform/resource/before/WithMethodMarkedDeprecatedAnnOnly.java
new file mode 100644
index 00000000..50509545
--- /dev/null
+++ b/test/transform/resource/before/WithMethodMarkedDeprecatedAnnOnly.java
@@ -0,0 +1,10 @@
+import lombok.With;
+
+class WithMethodMarkedDeprecatedAnnOnly {
+
+ @Deprecated
+ @With int annotation;
+
+ WithMethodMarkedDeprecatedAnnOnly(int annotation) {
+ }
+} \ No newline at end of file