diff options
85 files changed, 729 insertions, 382 deletions
diff --git a/doc/changelog.markdown b/doc/changelog.markdown index cb515cae..bbda9dfe 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -5,6 +5,8 @@ Lombok Changelog * BUGFIX: Eclipse would throw an OOME if using `@ExtensionMethod`. [Issue #390](http://code.google.com/p/projectlombok/issues/detail?id=390) * BUGFIX: {Netbeans} `@Cleanup` and `@Synchronized` cause far fewer issues in the netbeans editor. [Issue #393](http://code.google.com/p/projectlombok/issues/detail?id=393) * BUGFIX: {Installer} Erroneous messages about the installer complaining about needing root access when installing or removing lombok from eclipse installs has been fixed. The installer edge of this problem was actually already fixed in v0.11.2. [Issue #363](http://code.google.com/p/projectlombok/issues/detail?id=363) +* BUGFIX: `@ExtensionMethod` had all sorts of issues in javac. [Issue #399](http://code.google.com/p/projectlombok/issues/detail?id=399) +* BUGFIX: Generating static constructors with javac when you have fields with generics, i.e. `Class<T>`, caused errors. [Issue #396](http://code.google.com/p/projectlombok/issues/detail?id=396) ### v0.11.2 "Dashing Kakapo" (July 3rd, 2012) * FEATURE: {Experimental} `@ExtensionMethod` is now available to add extensions to diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index 8b330816..ed18dd45 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -798,18 +798,19 @@ public class EclipseHandlerUtil { } } - private static final Map<FieldDeclaration, GetterMethod> generatedLazyGetters = new WeakHashMap<FieldDeclaration, GetterMethod>(); + private static final Map<FieldDeclaration, Object> generatedLazyGettersWithPrimitiveBoolean = new WeakHashMap<FieldDeclaration, Object>(); + private static final Object MARKER = new Object(); static void registerCreatedLazyGetter(FieldDeclaration field, char[] methodName, TypeReference returnType) { - generatedLazyGetters.put(field, new GetterMethod(methodName, returnType)); + if (!nameEquals(returnType.getTypeName(), "boolean") || returnType.dimensions() > 0) return; + generatedLazyGettersWithPrimitiveBoolean.put(field, MARKER); } private static GetterMethod findGetter(EclipseNode field) { FieldDeclaration fieldDeclaration = (FieldDeclaration) field.get(); - GetterMethod gm = generatedLazyGetters.get(fieldDeclaration); - if (gm != null) return gm; + boolean forceBool = generatedLazyGettersWithPrimitiveBoolean.containsKey(fieldDeclaration); TypeReference fieldType = fieldDeclaration.type; - boolean isBoolean = nameEquals(fieldType.getTypeName(), "boolean") && fieldType.dimensions() == 0; + boolean isBoolean = forceBool || (nameEquals(fieldType.getTypeName(), "boolean") && fieldType.dimensions() == 0); EclipseNode typeNode = field.up(); for (String potentialGetterName : toAllGetterNames(field, isBoolean)) { diff --git a/src/core/lombok/eclipse/handlers/HandleConstructor.java b/src/core/lombok/eclipse/handlers/HandleConstructor.java index eec41577..25d47870 100644 --- a/src/core/lombok/eclipse/handlers/HandleConstructor.java +++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java @@ -156,20 +156,29 @@ public class HandleConstructor { } public void generateConstructor(EclipseNode typeNode, AccessLevel level, List<EclipseNode> fields, String staticName, boolean skipIfConstructorExists, boolean suppressConstructorProperties, ASTNode source) { + boolean staticConstrRequired = staticName != null && !staticName.equals(""); + if (skipIfConstructorExists && constructorExists(typeNode) != MemberExistsResult.NOT_EXISTS) return; if (skipIfConstructorExists) { for (EclipseNode child : typeNode.down()) { if (child.getKind() == Kind.ANNOTATION) { if (annotationTypeMatches(NoArgsConstructor.class, child) || annotationTypeMatches(AllArgsConstructor.class, child) || - annotationTypeMatches(RequiredArgsConstructor.class, child)) + annotationTypeMatches(RequiredArgsConstructor.class, child)) { + + if (staticConstrRequired) { + // @Data has asked us to generate a constructor, but we're going to skip this instruction, as an explicit 'make a constructor' annotation + // will take care of it. However, @Data also wants a specific static name; this will be ignored; the appropriate way to do this is to use + // the 'staticName' parameter of the @XArgsConstructor you've stuck on your type. + // We should warn that we're ignoring @Data's 'staticConstructor' param. + typeNode.addWarning("Ignoring static constructor name: explicit @XxxArgsConstructor annotation present; its `staticName` parameter will be used.", source.sourceStart, source.sourceEnd); + } return; + } } } } - boolean staticConstrRequired = staticName != null && !staticName.equals(""); - ConstructorDeclaration constr = createConstructor(staticConstrRequired ? AccessLevel.PRIVATE : level, typeNode, fields, suppressConstructorProperties, source); injectMethod(typeNode, constr); if (staticConstrRequired) { diff --git a/src/core/lombok/javac/JavacResolution.java b/src/core/lombok/javac/JavacResolution.java index 6da60907..73bb38b0 100644 --- a/src/core/lombok/javac/JavacResolution.java +++ b/src/core/lombok/javac/JavacResolution.java @@ -456,12 +456,18 @@ public class JavacResolution { if (upper == null || upper.toString().equals("java.lang.Object")) { return maker.Wildcard(maker.TypeBoundKind(BoundKind.UNBOUND), null); } + if (upper.getTypeArguments().contains(type)) { + return maker.Wildcard(maker.TypeBoundKind(BoundKind.UNBOUND), null); + } return maker.Wildcard(maker.TypeBoundKind(BoundKind.EXTENDS), typeToJCTree(upper, ast, false, false)); } else { return maker.Wildcard(maker.TypeBoundKind(BoundKind.SUPER), typeToJCTree(lower, ast, false, false)); } } if (upper != null) { + if (upper.getTypeArguments().contains(type)) { + return maker.Wildcard(maker.TypeBoundKind(BoundKind.UNBOUND), null); + } return typeToJCTree(upper, ast, allowCompound, allowVoid); } diff --git a/src/core/lombok/javac/handlers/HandleConstructor.java b/src/core/lombok/javac/handlers/HandleConstructor.java index a2463728..d701b41e 100644 --- a/src/core/lombok/javac/handlers/HandleConstructor.java +++ b/src/core/lombok/javac/handlers/HandleConstructor.java @@ -43,12 +43,10 @@ import com.sun.tools.javac.tree.JCTree.JCBlock; import com.sun.tools.javac.tree.JCTree.JCClassDecl; import com.sun.tools.javac.tree.JCTree.JCExpression; import com.sun.tools.javac.tree.JCTree.JCFieldAccess; -import com.sun.tools.javac.tree.JCTree.JCIdent; import com.sun.tools.javac.tree.JCTree.JCMethodDecl; import com.sun.tools.javac.tree.JCTree.JCModifiers; import com.sun.tools.javac.tree.JCTree.JCReturn; import com.sun.tools.javac.tree.JCTree.JCStatement; -import com.sun.tools.javac.tree.JCTree.JCTypeApply; import com.sun.tools.javac.tree.JCTree.JCTypeParameter; import com.sun.tools.javac.tree.JCTree.JCVariableDecl; import com.sun.tools.javac.util.List; @@ -154,20 +152,29 @@ public class HandleConstructor { } public void generateConstructor(JavacNode typeNode, AccessLevel level, List<JavacNode> fields, String staticName, boolean skipIfConstructorExists, boolean suppressConstructorProperties, JavacNode source) { + boolean staticConstrRequired = staticName != null && !staticName.equals(""); + if (skipIfConstructorExists && constructorExists(typeNode) != MemberExistsResult.NOT_EXISTS) return; if (skipIfConstructorExists) { for (JavacNode child : typeNode.down()) { if (child.getKind() == Kind.ANNOTATION) { if (annotationTypeMatches(NoArgsConstructor.class, child) || annotationTypeMatches(AllArgsConstructor.class, child) || - annotationTypeMatches(RequiredArgsConstructor.class, child)) + annotationTypeMatches(RequiredArgsConstructor.class, child)) { + + if (staticConstrRequired) { + // @Data has asked us to generate a constructor, but we're going to skip this instruction, as an explicit 'make a constructor' annotation + // will take care of it. However, @Data also wants a specific static name; this will be ignored; the appropriate way to do this is to use + // the 'staticName' parameter of the @XArgsConstructor you've stuck on your type. + // We should warn that we're ignoring @Data's 'staticConstructor' param. + source.addWarning("Ignoring static constructor name: explicit @XxxArgsConstructor annotation present; its `staticName` parameter will be used."); + } return; + } } } } - boolean staticConstrRequired = staticName != null && !staticName.equals(""); - JCMethodDecl constr = createConstructor(staticConstrRequired ? AccessLevel.PRIVATE : level, typeNode, fields, suppressConstructorProperties, source.get()); injectMethod(typeNode, constr); if (staticConstrRequired) { @@ -259,16 +266,7 @@ public class HandleConstructor { for (JavacNode fieldNode : fields) { JCVariableDecl field = (JCVariableDecl) fieldNode.get(); - JCExpression pType; - if (field.vartype instanceof JCIdent) pType = maker.Ident(((JCIdent)field.vartype).name); - else if (field.vartype instanceof JCTypeApply) { - JCTypeApply typeApply = (JCTypeApply) field.vartype; - ListBuffer<JCExpression> tArgs = ListBuffer.lb(); - for (JCExpression arg : typeApply.arguments) tArgs.append(arg); - pType = maker.TypeApply(typeApply.clazz, tArgs.toList()); - } else { - pType = field.vartype; - } + JCExpression pType = cloneType(maker, field.vartype, source); List<JCAnnotation> nonNulls = findAnnotations(fieldNode, TransformationsUtil.NON_NULL_PATTERN); List<JCAnnotation> nullables = findAnnotations(fieldNode, TransformationsUtil.NULLABLE_PATTERN); JCVariableDecl param = maker.VarDef(maker.Modifiers(Flags.FINAL, nonNulls.appendList(nullables)), field.name, pType, null); diff --git a/src/core/lombok/javac/handlers/HandleExtensionMethod.java b/src/core/lombok/javac/handlers/HandleExtensionMethod.java index 2df6be45..92d7c0e4 100644 --- a/src/core/lombok/javac/handlers/HandleExtensionMethod.java +++ b/src/core/lombok/javac/handlers/HandleExtensionMethod.java @@ -55,7 +55,6 @@ import com.sun.tools.javac.tree.JCTree.JCExpression; import com.sun.tools.javac.tree.JCTree.JCFieldAccess; import com.sun.tools.javac.tree.JCTree.JCIdent; import com.sun.tools.javac.tree.JCTree.JCMethodInvocation; -import com.sun.tools.javac.tree.TreeMaker; /** * Handles the {@link ExtensionMethod} annotation for javac. @@ -180,10 +179,7 @@ public class HandleExtensionMethod extends JavacAnnotationHandler<ExtensionMetho Type firstArgType = types.erasure(extensionMethodType.asMethodType().argtypes.get(0)); if (!types.isAssignable(receiverType, firstArgType)) continue; methodCall.args = methodCall.args.prepend(receiver); - - TreeMaker maker = annotationNode.getTreeMaker(); - JCIdent extensionClassIdent = maker.Ident(annotationNode.toName(extensionProvider.toString())); - methodCall.meth = maker.Select(extensionClassIdent, annotationNode.toName(methodName)); + methodCall.meth = chainDotsString(annotationNode, extensionProvider.toString() + "." + methodName); return; } } diff --git a/src/core/lombok/javac/handlers/HandleSynchronized.java b/src/core/lombok/javac/handlers/HandleSynchronized.java index 04668317..1ba8d131 100644 --- a/src/core/lombok/javac/handlers/HandleSynchronized.java +++ b/src/core/lombok/javac/handlers/HandleSynchronized.java @@ -78,16 +78,16 @@ public class HandleSynchronized extends JavacAnnotationHandler<Synchronized> { lockName = isStatic ? STATIC_LOCK_NAME : INSTANCE_LOCK_NAME; } - TreeMaker maker = methodNode.getTreeMaker(); + TreeMaker maker = methodNode.getTreeMaker().at(ast.pos); if (fieldExists(lockName, methodNode) == MemberExistsResult.NOT_EXISTS) { if (!autoMake) { annotationNode.addError("The field " + lockName + " does not exist."); return; } - JCExpression objectType = chainDots(methodNode, "java", "lang", "Object"); + JCExpression objectType = chainDots(methodNode, ast.pos, "java", "lang", "Object"); //We use 'new Object[0];' because unlike 'new Object();', empty arrays *ARE* serializable! - JCNewArray newObjectArray = maker.NewArray(chainDots(methodNode, "java", "lang", "Object"), + JCNewArray newObjectArray = maker.NewArray(chainDots(methodNode, ast.pos, "java", "lang", "Object"), List.<JCExpression>of(maker.Literal(Javac.getCtcInt(TypeTags.class, "INT"), 0)), null); JCVariableDecl fieldDecl = recursiveSetGeneratedBy(maker.VarDef( maker.Modifiers(Flags.PRIVATE | Flags.FINAL | (isStatic ? Flags.STATIC : 0)), @@ -99,7 +99,7 @@ public class HandleSynchronized extends JavacAnnotationHandler<Synchronized> { JCExpression lockNode; if (isStatic) { - lockNode = chainDots(methodNode, methodNode.up().getName(), lockName); + lockNode = chainDots(methodNode, ast.pos, methodNode.up().getName(), lockName); } else { lockNode = maker.Select(maker.Ident(methodNode.toName("this")), methodNode.toName(lockName)); } diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index f2cdee6d..b0f2a890 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -45,14 +45,17 @@ import lombok.experimental.Accessors; import lombok.javac.Javac; import lombok.javac.JavacNode; +import com.sun.tools.javac.code.BoundKind; import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.code.TypeTags; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree.JCAnnotation; +import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; import com.sun.tools.javac.tree.JCTree.JCAssign; import com.sun.tools.javac.tree.JCTree.JCClassDecl; import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; import com.sun.tools.javac.tree.JCTree.JCExpression; +import com.sun.tools.javac.tree.JCTree.JCFieldAccess; import com.sun.tools.javac.tree.JCTree.JCIdent; import com.sun.tools.javac.tree.JCTree.JCImport; import com.sun.tools.javac.tree.JCTree.JCLiteral; @@ -60,9 +63,13 @@ import com.sun.tools.javac.tree.JCTree.JCMethodDecl; import com.sun.tools.javac.tree.JCTree.JCMethodInvocation; import com.sun.tools.javac.tree.JCTree.JCModifiers; import com.sun.tools.javac.tree.JCTree.JCNewArray; +import com.sun.tools.javac.tree.JCTree.JCPrimitiveTypeTree; import com.sun.tools.javac.tree.JCTree.JCStatement; import com.sun.tools.javac.tree.JCTree.JCTypeParameter; +import com.sun.tools.javac.tree.JCTree.JCTypeApply; import com.sun.tools.javac.tree.JCTree.JCVariableDecl; +import com.sun.tools.javac.tree.JCTree.JCWildcard; +import com.sun.tools.javac.tree.JCTree.TypeBoundKind; import com.sun.tools.javac.tree.TreeMaker; import com.sun.tools.javac.tree.TreeScanner; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; @@ -244,6 +251,7 @@ public class JavacHandlerUtil { * Only does this if the DeleteLombokAnnotations class is in the context. */ public static void deleteAnnotationIfNeccessary(JavacNode annotation, Class<? extends Annotation> annotationType) { + if (inNetbeansEditor(annotation)) return; if (!annotation.shouldDeleteLombokAnnotations()) return; JavacNode parentNode = annotation.directUp(); switch (parentNode.getKind()) { @@ -274,6 +282,7 @@ public class JavacHandlerUtil { } public static void deleteImportFromCompilationUnit(JavacNode node, String name) { + if (inNetbeansEditor(node)) return; if (!node.shouldDeleteLombokAnnotations()) return; ListBuffer<JCTree> newDefs = ListBuffer.lb(); @@ -768,6 +777,8 @@ public class JavacHandlerUtil { * 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 * a {@code Ident} node. This method generates such an expression. + * <p> + * The position of the generated node(s) will be unpositioned (-1). * * For example, maker.Select(maker.Select(maker.Ident(NAME[java]), NAME[lang]), NAME[String]). * @@ -775,12 +786,30 @@ public class JavacHandlerUtil { * @see com.sun.tools.javac.tree.JCTree.JCFieldAccess */ public static JCExpression chainDots(JavacNode node, String... elems) { + return chainDots(node, -1, elems); + } + + /** + * 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 + * a {@code Ident} node. This method generates such an expression. + * <p> + * The position of the generated node(s) will be equal to the {@code pos} parameter. + * + * For example, maker.Select(maker.Select(maker.Ident(NAME[java]), NAME[lang]), NAME[String]). + * + * @see com.sun.tools.javac.tree.JCTree.JCIdent + * @see com.sun.tools.javac.tree.JCTree.JCFieldAccess + */ + public static JCExpression chainDots(JavacNode node, int pos, String... elems) { assert elems != null; assert elems.length > 0; - JCExpression e = node.getTreeMaker().Ident(node.toName(elems[0])); + TreeMaker maker = node.getTreeMaker(); + if (pos != -1) maker = maker.at(pos); + JCExpression e = maker.Ident(node.toName(elems[0])); for (int i = 1 ; i < elems.length ; i++) { - e = node.getTreeMaker().Select(e, node.toName(elems[i])); + e = maker.Select(e, node.toName(elems[i])); } return e; @@ -798,7 +827,7 @@ public class JavacHandlerUtil { * @see com.sun.tools.javac.tree.JCTree.JCFieldAccess */ public static JCExpression chainDotsString(JavacNode node, String elems) { - return chainDots(node, elems.split("\\.")); + return chainDots(node, elems.split("\\.")); } /** @@ -922,4 +951,71 @@ public class JavacHandlerUtil { return node; } + + /** + * Creates a full clone of a given javac AST type node. Every part is cloned (every identifier, every select, every wildcard, every type apply). + * + * If there's any node in the tree that we don't know how to clone, that part isn't cloned. However, we wouldn't know what could possibly show up that we + * can't currently clone; that's just a safeguard. + * + * This should be used if the type looks the same in the code, but resolves differently. For example, a static method that has some generics in it named after + * the class's own parameter, but as its a static method, the static method's notion of {@code T} is different from the class notion of {@code T}. If you're duplicating + * a type used in the class context, you need to use this method. + */ + public static JCExpression cloneType(TreeMaker maker, JCExpression in, JCTree source) { + JCExpression out = cloneType0(maker, in); + if (out != null) recursiveSetGeneratedBy(out, source); + return out; + } + + private static JCExpression cloneType0(TreeMaker maker, JCTree in) { + if (in == null) return null; + + if (in instanceof JCPrimitiveTypeTree) return (JCExpression) in; + + if (in instanceof JCIdent) { + return maker.Ident(((JCIdent) in).name); + } + + if (in instanceof JCFieldAccess) { + JCFieldAccess fa = (JCFieldAccess) in; + return maker.Select(cloneType0(maker, fa.selected), fa.name); + } + + if (in instanceof JCArrayTypeTree) { + JCArrayTypeTree att = (JCArrayTypeTree) in; + return maker.TypeArray(cloneType0(maker, att.elemtype)); + } + + if (in instanceof JCTypeApply) { + JCTypeApply ta = (JCTypeApply) in; + ListBuffer<JCExpression> lb = ListBuffer.lb(); + for (JCExpression typeArg : ta.arguments) { + lb.append(cloneType0(maker, typeArg)); + } + return maker.TypeApply(cloneType0(maker, ta.clazz), lb.toList()); + } + + if (in instanceof JCWildcard) { + JCWildcard w = (JCWildcard) in; + JCExpression newInner = cloneType0(maker, w.inner); + TypeBoundKind newKind; + switch (w.getKind()) { + case SUPER_WILDCARD: + newKind = maker.TypeBoundKind(BoundKind.SUPER); + break; + case EXTENDS_WILDCARD: + newKind = maker.TypeBoundKind(BoundKind.EXTENDS); + break; + default: + case UNBOUNDED_WILDCARD: + newKind = maker.TypeBoundKind(BoundKind.UNBOUND); + break; + } + return maker.Wildcard(newKind, newInner); + } + + // This is somewhat unsafe, but it's better than outright throwing an exception here. Returning null will just cause an exception down the pipeline. + return (JCExpression) in; + } } diff --git a/src/delombok/lombok/delombok/Delombok.java b/src/delombok/lombok/delombok/Delombok.java index a639a1f6..3f521274 100644 --- a/src/delombok/lombok/delombok/Delombok.java +++ b/src/delombok/lombok/delombok/Delombok.java @@ -381,6 +381,7 @@ public class Delombok { } JavaCompiler delegate = compiler.processAnnotations(compiler.enterTrees(toJavacList(roots))); + delegate.flow(delegate.attribute(delegate.todo)); for (JCCompilationUnit unit : roots) { DelombokResult result = new DelombokResult(catcher.getComments(unit), unit, force || options.isChanged(unit)); if (verbose) feedback.printf("File: %s [%s]\n", unit.sourcefile.getName(), result.isChanged() ? "delomboked" : "unchanged"); diff --git a/src/delombok/lombok/delombok/PrettyCommentsPrinter.java b/src/delombok/lombok/delombok/PrettyCommentsPrinter.java index 095928ad..2f47ccf6 100644 --- a/src/delombok/lombok/delombok/PrettyCommentsPrinter.java +++ b/src/delombok/lombok/delombok/PrettyCommentsPrinter.java @@ -1037,8 +1037,17 @@ public class PrettyCommentsPrinter extends JCTree.Visitor { throw new UncheckedIOException(e); } } - + + private boolean isNoArgsSuperCall(JCExpression expr) { + if (!(expr instanceof JCMethodInvocation)) return false; + JCMethodInvocation tree = (JCMethodInvocation) expr; + if (!tree.typeargs.isEmpty() || !tree.args.isEmpty()) return false; + if (!(tree.meth instanceof JCIdent)) return false; + return ((JCIdent) tree.meth).name.toString().equals("super"); + } + public void visitExec(JCExpressionStatement tree) { + if (isNoArgsSuperCall(tree.expr)) return; try { printExpr(tree.expr); if (prec == TreeInfo.notExpression) print(";"); diff --git a/test/core/src/lombok/AbstractRunTests.java b/test/core/src/lombok/AbstractRunTests.java index b2200bbd..02c4803a 100644 --- a/test/core/src/lombok/AbstractRunTests.java +++ b/test/core/src/lombok/AbstractRunTests.java @@ -26,6 +26,7 @@ import static org.junit.Assert.*; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.StringReader; @@ -35,6 +36,11 @@ import java.util.List; public abstract class AbstractRunTests { protected static final String LINE_SEPARATOR = System.getProperty("line.separator"); + private final File dumpActualFilesHere; + + public AbstractRunTests() { + this.dumpActualFilesHere = findPlaceToDumpActualFiles(); + } public boolean compareFile(DirectoryRunner.TestParams params, File file) throws Throwable { StringBuilder messages = new StringBuilder(); @@ -82,6 +88,25 @@ public abstract class AbstractRunTests { return readFile(new File(dir, file.getName() + (messages ? ".messages" : ""))); } + private static File findPlaceToDumpActualFiles() { + String location = System.getProperty("lombok.tests.dump_actual_files"); + if (location != null) { + File dumpActualFilesHere = new File(location); + dumpActualFilesHere.mkdirs(); + return dumpActualFilesHere; + } + return null; + } + + private static void dumpToFile(File file, String content) throws IOException { + FileOutputStream fos = new FileOutputStream(file); + try { + fos.write(content.getBytes("UTF-8")); + } finally { + fos.close(); + } + } + private void compare(String name, String expectedFile, String actualFile, String expectedMessages, String actualMessages, boolean printErrors) throws Throwable { try { compareContent(name, expectedFile, actualFile); @@ -99,6 +124,9 @@ public abstract class AbstractRunTests { } System.out.println("*******************"); } + if (dumpActualFilesHere != null) { + dumpToFile(new File(dumpActualFilesHere, name), actualFile); + } throw e; } try { @@ -113,6 +141,9 @@ public abstract class AbstractRunTests { System.out.println(actualMessages); System.out.println("*******************"); } + if (dumpActualFilesHere != null) { + dumpToFile(new File(dumpActualFilesHere, name + ".messages"), actualMessages); + } throw e; } } diff --git a/test/transform/resource/after-delombok/ConflictingStaticConstructorNames.java b/test/transform/resource/after-delombok/ConflictingStaticConstructorNames.java new file mode 100644 index 00000000..172ed298 --- /dev/null +++ b/test/transform/resource/after-delombok/ConflictingStaticConstructorNames.java @@ -0,0 +1,29 @@ +class ConflictingStaticConstructorNames { + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof ConflictingStaticConstructorNames)) return false; + final ConflictingStaticConstructorNames other = (ConflictingStaticConstructorNames)o; + if (!other.canEqual((java.lang.Object)this)) return false; + return true; + } + @java.lang.SuppressWarnings("all") + public boolean canEqual(final java.lang.Object other) { + return other instanceof ConflictingStaticConstructorNames; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + int result = 1; + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "ConflictingStaticConstructorNames()"; + } + @java.lang.SuppressWarnings("all") + public ConflictingStaticConstructorNames() { + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/Constructors.java b/test/transform/resource/after-delombok/Constructors.java index db48b6b8..d4633dbc 100644 --- a/test/transform/resource/after-delombok/Constructors.java +++ b/test/transform/resource/after-delombok/Constructors.java @@ -58,4 +58,18 @@ class RequiredArgsConstructorStaticNameGenerics<T extends Number> { public static <T extends Number> RequiredArgsConstructorStaticNameGenerics<T> of(final T x) { return new RequiredArgsConstructorStaticNameGenerics<T>(x); } +} +class RequiredArgsConstructorStaticNameGenerics2<T extends Number> { + final Class<T> x; + String name; + + @java.lang.SuppressWarnings("all") + private RequiredArgsConstructorStaticNameGenerics2(final Class<T> x) { + this.x = x; + } + + @java.lang.SuppressWarnings("all") + public static <T extends Number> RequiredArgsConstructorStaticNameGenerics2<T> of(final Class<T> x) { + return new RequiredArgsConstructorStaticNameGenerics2<T>(x); + } }
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/DataPlain.java b/test/transform/resource/after-delombok/DataPlain.java index cb002e07..a8cb37af 100644 --- a/test/transform/resource/after-delombok/DataPlain.java +++ b/test/transform/resource/after-delombok/DataPlain.java @@ -155,7 +155,6 @@ final class Data3 { final class Data4 extends java.util.Timer { int x; Data4() { - super(); } @java.lang.SuppressWarnings("all") public int getX() { diff --git a/test/transform/resource/after-delombok/ExtensionMethodPlain.java b/test/transform/resource/after-delombok/ExtensionMethodPlain.java new file mode 100644 index 00000000..707a0258 --- /dev/null +++ b/test/transform/resource/after-delombok/ExtensionMethodPlain.java @@ -0,0 +1,17 @@ +class ExtensionMethodPlain { + public String test() { + int[] intArray = {5, 3, 8, 2}; + java.util.Arrays.sort(intArray); + String iAmNull = null; + return ExtensionMethodPlain.Extensions.or(iAmNull, ExtensionMethodPlain.Extensions.toTitleCase("hELlO, WORlD!")); + } + static class Extensions { + public static <T> T or(T obj, T ifNull) { + return obj != null ? obj : ifNull; + } + public static String toTitleCase(String in) { + if (in.isEmpty()) return in; + return "" + Character.toTitleCase(in.charAt(0)) + in.substring(1).toLowerCase(); + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/SneakyThrowsPlain.java b/test/transform/resource/after-delombok/SneakyThrowsPlain.java index 5c0890b5..f712ab55 100644 --- a/test/transform/resource/after-delombok/SneakyThrowsPlain.java +++ b/test/transform/resource/after-delombok/SneakyThrowsPlain.java @@ -1,6 +1,5 @@ class SneakyThrowsPlain { SneakyThrowsPlain() { - super(); try { System.out.println("constructor"); } catch (final java.lang.Throwable $ex) { diff --git a/test/transform/resource/after-delombok/SynchronizedName.java b/test/transform/resource/after-delombok/SynchronizedName.java index e7dd23ff..ab3c0431 100644 --- a/test/transform/resource/after-delombok/SynchronizedName.java +++ b/test/transform/resource/after-delombok/SynchronizedName.java @@ -1,19 +1,12 @@ class SynchronizedName { private Object read = new Object(); private static Object READ = new Object(); + void test1() { synchronized (this.read) { System.out.println("one"); } } - void test2() { - System.out.println("two"); - } - static void test3() { - synchronized (SynchronizedName.read) { - System.out.println("three"); - } - } void test4() { synchronized (this.READ) { System.out.println("four"); @@ -24,4 +17,4 @@ class SynchronizedName { System.out.println("five"); } } -} +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/SynchronizedNameNoSuchField.java b/test/transform/resource/after-delombok/SynchronizedNameNoSuchField.java new file mode 100644 index 00000000..d252985f --- /dev/null +++ b/test/transform/resource/after-delombok/SynchronizedNameNoSuchField.java @@ -0,0 +1,7 @@ +class SynchronizedNameNoSuchField { + private Object read = new Object(); + private static Object READ = new Object(); + void test2() { + System.out.println("two"); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/SynchronizedNameStaticToInstanceRef.java b/test/transform/resource/after-delombok/SynchronizedNameStaticToInstanceRef.java new file mode 100644 index 00000000..8441570b --- /dev/null +++ b/test/transform/resource/after-delombok/SynchronizedNameStaticToInstanceRef.java @@ -0,0 +1,9 @@ +class SynchronizedNameStaticToInstanceRef { + private Object read = new Object(); + private static Object READ = new Object(); + static void test3() { + synchronized (SynchronizedNameStaticToInstanceRef.read) { + System.out.println("three"); + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/Accessors.java b/test/transform/resource/after-ecj/Accessors.java index ae7eb0bb..292db928 100644 --- a/test/transform/resource/after-ecj/Accessors.java +++ b/test/transform/resource/after-ecj/Accessors.java @@ -1,5 +1,8 @@ class AccessorsFluent { private @lombok.Getter @lombok.Setter @lombok.experimental.Accessors(fluent = true) String fieldName = ""; + AccessorsFluent() { + super(); + } public @java.lang.SuppressWarnings("all") String fieldName() { return this.fieldName; } @@ -7,13 +10,13 @@ class AccessorsFluent { this.fieldName = fieldName; return this; } - AccessorsFluent() { - super(); - } } @lombok.experimental.Accessors(fluent = true) @lombok.Getter class AccessorsFluentOnClass { private @lombok.Setter String fieldName = ""; private @lombok.experimental.Accessors String otherFieldWithOverride = ""; + AccessorsFluentOnClass() { + super(); + } public @java.lang.SuppressWarnings("all") AccessorsFluentOnClass fieldName(final String fieldName) { this.fieldName = fieldName; return this; @@ -24,45 +27,48 @@ class AccessorsFluent { public @java.lang.SuppressWarnings("all") String getOtherFieldWithOverride() { return this.otherFieldWithOverride; } - AccessorsFluentOnClass() { - super(); - } } class AccessorsChain { private @lombok.Setter @lombok.experimental.Accessors(chain = true) boolean isRunning; + AccessorsChain() { + super(); + } public @java.lang.SuppressWarnings("all") AccessorsChain setRunning(final boolean isRunning) { this.isRunning = isRunning; return this; } - AccessorsChain() { - super(); - } } @lombok.experimental.Accessors(prefix = "f") class AccessorsPrefix { private @lombok.Setter String fieldName; private @lombok.Setter String fActualField; - public @java.lang.SuppressWarnings("all") void setActualField(final String fActualField) { - this.fActualField = fActualField; - } AccessorsPrefix() { super(); } + public @java.lang.SuppressWarnings("all") void setActualField(final String fActualField) { + this.fActualField = fActualField; + } } @lombok.experimental.Accessors(prefix = {"f", ""}) class AccessorsPrefix2 { private @lombok.Setter String fieldName; private @lombok.Setter String fActualField; + AccessorsPrefix2() { + super(); + } public @java.lang.SuppressWarnings("all") void setFieldName(final String fieldName) { this.fieldName = fieldName; } public @java.lang.SuppressWarnings("all") void setActualField(final String fActualField) { this.fActualField = fActualField; } - AccessorsPrefix2() { - super(); - } } @lombok.experimental.Accessors(prefix = "f") @lombok.ToString @lombok.EqualsAndHashCode class AccessorsPrefix3 { private String fName; + AccessorsPrefix3() { + super(); + } + private String getName() { + return fName; + } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("AccessorsPrefix3(fName=" + this.getName()) + ")"); } @@ -90,40 +96,34 @@ class AccessorsChain { result = ((result * PRIME) + (($fName == null) ? 0 : $fName.hashCode())); return result; } - AccessorsPrefix3() { - super(); - } - private String getName() { - return fName; - } } class AccessorsFluentGenerics<T extends Number> { private @lombok.Setter @lombok.experimental.Accessors(fluent = true) String name; + AccessorsFluentGenerics() { + super(); + } public @java.lang.SuppressWarnings("all") AccessorsFluentGenerics<T> name(final String name) { this.name = name; return this; } - AccessorsFluentGenerics() { - super(); - } } class AccessorsFluentNoChaining { private @lombok.Setter @lombok.experimental.Accessors(fluent = true,chain = false) String name; - public @java.lang.SuppressWarnings("all") void name(final String name) { - this.name = name; - } AccessorsFluentNoChaining() { super(); } + public @java.lang.SuppressWarnings("all") void name(final String name) { + this.name = name; + } } class AccessorsFluentStatic<T extends Number> { private static @lombok.Setter @lombok.experimental.Accessors(fluent = true) String name; <clinit>() { } - public static @java.lang.SuppressWarnings("all") void name(final String name) { - AccessorsFluentStatic.name = name; - } AccessorsFluentStatic() { super(); } + public static @java.lang.SuppressWarnings("all") void name(final String name) { + AccessorsFluentStatic.name = name; + } } diff --git a/test/transform/resource/after-ecj/ClassNamedAfterGetter.java b/test/transform/resource/after-ecj/ClassNamedAfterGetter.java index fb9df0ea..fdb6f122 100644 --- a/test/transform/resource/after-ecj/ClassNamedAfterGetter.java +++ b/test/transform/resource/after-ecj/ClassNamedAfterGetter.java @@ -1,9 +1,9 @@ class GetFoo { private @lombok.Getter int foo; - public @java.lang.SuppressWarnings("all") int getFoo() { - return this.foo; - } GetFoo() { super(); } + public @java.lang.SuppressWarnings("all") int getFoo() { + return this.foo; + } } diff --git a/test/transform/resource/after-ecj/CommentsInterspersed.java b/test/transform/resource/after-ecj/CommentsInterspersed.java index 60c69aed..d708ad72 100644 --- a/test/transform/resource/after-ecj/CommentsInterspersed.java +++ b/test/transform/resource/after-ecj/CommentsInterspersed.java @@ -2,11 +2,11 @@ import lombok.Getter; public class CommentsInterspersed { private int x; private @Getter String test = "foo"; - public @java.lang.SuppressWarnings("all") String getTest() { - return this.test; - } public CommentsInterspersed() { super(); } public native void gwtTest(); + public @java.lang.SuppressWarnings("all") String getTest() { + return this.test; + } } diff --git a/test/transform/resource/after-ecj/ConflictingStaticConstructorNames.java b/test/transform/resource/after-ecj/ConflictingStaticConstructorNames.java new file mode 100644 index 00000000..8da11258 --- /dev/null +++ b/test/transform/resource/after-ecj/ConflictingStaticConstructorNames.java @@ -0,0 +1,25 @@ +@lombok.Data(staticConstructor = "of") @lombok.NoArgsConstructor class ConflictingStaticConstructorNames { + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof ConflictingStaticConstructorNames))) + return false; + final @java.lang.SuppressWarnings("all") ConflictingStaticConstructorNames other = (ConflictingStaticConstructorNames) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof ConflictingStaticConstructorNames); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + int result = 1; + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return "ConflictingStaticConstructorNames()"; + } + public @java.lang.SuppressWarnings("all") ConflictingStaticConstructorNames() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/Constructors.java b/test/transform/resource/after-ecj/Constructors.java index e6dd8a21..e994702f 100644 --- a/test/transform/resource/after-ecj/Constructors.java +++ b/test/transform/resource/after-ecj/Constructors.java @@ -51,4 +51,15 @@ public static @java.lang.SuppressWarnings("all") <T extends Number>RequiredArgsConstructorStaticNameGenerics<T> of(final T x) { return new RequiredArgsConstructorStaticNameGenerics<T>(x); } +} +@lombok.RequiredArgsConstructor(staticName = "of") class RequiredArgsConstructorStaticNameGenerics2<T extends Number> { + final Class<T> x; + String name; + private @java.lang.SuppressWarnings("all") RequiredArgsConstructorStaticNameGenerics2(final Class<T> x) { + super(); + this.x = x; + } + public static @java.lang.SuppressWarnings("all") <T extends Number>RequiredArgsConstructorStaticNameGenerics2<T> of(final Class<T> x) { + return new RequiredArgsConstructorStaticNameGenerics2<T>(x); + } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/DataExtended.java b/test/transform/resource/after-ecj/DataExtended.java index dfc64f2d..1de635e3 100644 --- a/test/transform/resource/after-ecj/DataExtended.java +++ b/test/transform/resource/after-ecj/DataExtended.java @@ -1,8 +1,5 @@ @lombok.Data @lombok.ToString(doNotUseGetters = true) class DataExtended { int x; - public @java.lang.SuppressWarnings("all") DataExtended() { - super(); - } public @java.lang.SuppressWarnings("all") int getX() { return this.x; } @@ -30,6 +27,9 @@ result = ((result * PRIME) + this.getX()); return result; } + public @java.lang.SuppressWarnings("all") DataExtended() { + super(); + } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("DataExtended(x=" + this.x) + ")"); } diff --git a/test/transform/resource/after-ecj/DataIgnore.java b/test/transform/resource/after-ecj/DataIgnore.java index 109bf1d6..7d99a20f 100644 --- a/test/transform/resource/after-ecj/DataIgnore.java +++ b/test/transform/resource/after-ecj/DataIgnore.java @@ -1,10 +1,6 @@ @lombok.Data class DataIgnore { final int x; String $name; - public @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") DataIgnore(final int x) { - super(); - this.x = x; - } public @java.lang.SuppressWarnings("all") int getX() { return this.x; } @@ -32,4 +28,8 @@ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("DataIgnore(x=" + this.getX()) + ")"); } + public @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") DataIgnore(final int x) { + super(); + this.x = x; + } } diff --git a/test/transform/resource/after-ecj/DataOnEnum.java b/test/transform/resource/after-ecj/DataOnEnum.java index 8bab5925..0f07088e 100644 --- a/test/transform/resource/after-ecj/DataOnEnum.java +++ b/test/transform/resource/after-ecj/DataOnEnum.java @@ -3,14 +3,14 @@ public @lombok.Getter @lombok.ToString @lombok.RequiredArgsConstructor enum Data private final String someField; <clinit>() { } - private @java.lang.SuppressWarnings("all") DataOnEnum(final String someField) { - super(); - this.someField = someField; - } public @java.lang.SuppressWarnings("all") String getSomeField() { return this.someField; } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("DataOnEnum(someField=" + this.getSomeField()) + ")"); } -}
\ No newline at end of file + private @java.lang.SuppressWarnings("all") DataOnEnum(final String someField) { + super(); + this.someField = someField; + } +} diff --git a/test/transform/resource/after-ecj/DataOnLocalClass.java b/test/transform/resource/after-ecj/DataOnLocalClass.java index 76a4b47d..137edf50 100644 --- a/test/transform/resource/after-ecj/DataOnLocalClass.java +++ b/test/transform/resource/after-ecj/DataOnLocalClass.java @@ -7,10 +7,6 @@ class DataOnLocalClass1 { @Data class Local { final int x; String name; - public @java.lang.SuppressWarnings("all") Local(final int x) { - super(); - this.x = x; - } public @java.lang.SuppressWarnings("all") int getX() { return this.x; } @@ -50,6 +46,10 @@ class DataOnLocalClass1 { public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("Local(x=" + this.getX()) + ", name=") + this.getName()) + ")"); } + public @java.lang.SuppressWarnings("all") Local(final int x) { + super(); + this.x = x; + } } } } @@ -58,12 +58,6 @@ class DataOnLocalClass2 { @Data class Local { @Data class InnerLocal { @lombok.NonNull String name; - public @java.lang.SuppressWarnings("all") InnerLocal(final @lombok.NonNull String name) { - super(); - if ((name == null)) - throw new java.lang.NullPointerException("name"); - this.name = name; - } public @lombok.NonNull @java.lang.SuppressWarnings("all") String getName() { return this.name; } @@ -99,12 +93,14 @@ class DataOnLocalClass2 { public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("Local.InnerLocal(name=" + this.getName()) + ")"); } + public @java.lang.SuppressWarnings("all") InnerLocal(final @lombok.NonNull String name) { + super(); + if ((name == null)) + throw new java.lang.NullPointerException("name"); + this.name = name; + } } final int x; - public @java.lang.SuppressWarnings("all") Local(final int x) { - super(); - this.x = x; - } public @java.lang.SuppressWarnings("all") int getX() { return this.x; } @@ -132,9 +128,13 @@ class DataOnLocalClass2 { public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("Local(x=" + this.getX()) + ")"); } + public @java.lang.SuppressWarnings("all") Local(final int x) { + super(); + this.x = x; + } } } DataOnLocalClass2() { super(); } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/DataPlain.java b/test/transform/resource/after-ecj/DataPlain.java index 0828bc44..1b33070b 100644 --- a/test/transform/resource/after-ecj/DataPlain.java +++ b/test/transform/resource/after-ecj/DataPlain.java @@ -2,10 +2,6 @@ import lombok.Data; @lombok.Data class Data1 { final int x; String name; - public @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") Data1(final int x) { - super(); - this.x = x; - } public @java.lang.SuppressWarnings("all") int getX() { return this.x; } @@ -45,14 +41,14 @@ import lombok.Data; public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("Data1(x=" + this.getX()) + ", name=") + this.getName()) + ")"); } + public @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") Data1(final int x) { + super(); + this.x = x; + } } @Data class Data2 { final int x; String name; - public @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") Data2(final int x) { - super(); - this.x = x; - } public @java.lang.SuppressWarnings("all") int getX() { return this.x; } @@ -92,14 +88,14 @@ import lombok.Data; public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("Data2(x=" + this.getX()) + ", name=") + this.getName()) + ")"); } + public @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") Data2(final int x) { + super(); + this.x = x; + } } final @Data class Data3 { final int x; String name; - public @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") Data3(final int x) { - super(); - this.x = x; - } public @java.lang.SuppressWarnings("all") int getX() { return this.x; } @@ -134,9 +130,16 @@ final @Data class Data3 { public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("Data3(x=" + this.getX()) + ", name=") + this.getName()) + ")"); } + public @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") Data3(final int x) { + super(); + this.x = x; + } } final @Data @lombok.EqualsAndHashCode(callSuper = true) class Data4 extends java.util.Timer { int x; + Data4() { + super(); + } public @java.lang.SuppressWarnings("all") int getX() { return this.x; } @@ -170,14 +173,8 @@ final @Data @lombok.EqualsAndHashCode(callSuper = true) class Data4 extends java result = ((result * PRIME) + this.getX()); return result; } - Data4() { - super(); - } } @Data class Data5 { - public @java.lang.SuppressWarnings("all") Data5() { - super(); - } public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; @@ -198,11 +195,11 @@ final @Data @lombok.EqualsAndHashCode(callSuper = true) class Data4 extends java public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return "Data5()"; } -} -final @Data class Data6 { - public @java.lang.SuppressWarnings("all") Data6() { + public @java.lang.SuppressWarnings("all") Data5() { super(); } +} +final @Data class Data6 { public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; @@ -217,4 +214,7 @@ final @Data class Data6 { public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return "Data6()"; } -}
\ No newline at end of file + public @java.lang.SuppressWarnings("all") Data6() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/DataWithGetter.java b/test/transform/resource/after-ecj/DataWithGetter.java index cc9ce1c0..9d3dfd3e 100644 --- a/test/transform/resource/after-ecj/DataWithGetter.java +++ b/test/transform/resource/after-ecj/DataWithGetter.java @@ -2,10 +2,6 @@ private int x; private int y; private final String z; - public @java.beans.ConstructorProperties({"z"}) @java.lang.SuppressWarnings("all") DataWithGetter(final String z) { - super(); - this.z = z; - } public @java.lang.SuppressWarnings("all") void setX(final int x) { this.x = x; } @@ -45,6 +41,10 @@ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((((("DataWithGetter(x=" + this.getX()) + ", y=") + this.getY()) + ", z=") + this.getZ()) + ")"); } + public @java.beans.ConstructorProperties({"z"}) @java.lang.SuppressWarnings("all") DataWithGetter(final String z) { + super(); + this.z = z; + } public @java.lang.SuppressWarnings("all") int getX() { return this.x; } @@ -54,4 +54,4 @@ public @java.lang.SuppressWarnings("all") String getZ() { return this.z; } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/DataWithGetterNone.java b/test/transform/resource/after-ecj/DataWithGetterNone.java index 6fa5659e..b6b391c8 100644 --- a/test/transform/resource/after-ecj/DataWithGetterNone.java +++ b/test/transform/resource/after-ecj/DataWithGetterNone.java @@ -2,10 +2,6 @@ private int x; private int y; private final String z; - public @java.beans.ConstructorProperties({"z"}) @java.lang.SuppressWarnings("all") DataWithGetterNone(final String z) { - super(); - this.z = z; - } public @java.lang.SuppressWarnings("all") void setX(final int x) { this.x = x; } @@ -45,4 +41,8 @@ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((((("DataWithGetterNone(x=" + this.x) + ", y=") + this.y) + ", z=") + this.z) + ")"); } -}
\ No newline at end of file + public @java.beans.ConstructorProperties({"z"}) @java.lang.SuppressWarnings("all") DataWithGetterNone(final String z) { + super(); + this.z = z; + } +} diff --git a/test/transform/resource/after-ecj/DelegateOnGetter.java b/test/transform/resource/after-ecj/DelegateOnGetter.java index 4b10bf7f..4eab3791 100644 --- a/test/transform/resource/after-ecj/DelegateOnGetter.java +++ b/test/transform/resource/after-ecj/DelegateOnGetter.java @@ -6,6 +6,9 @@ class DelegateOnGetter { int getInt(); } private final @Delegate @Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<Bar>> bar = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<Bar>>(); + DelegateOnGetter() { + super(); + } public @Delegate @java.lang.SuppressWarnings("all") Bar getBar() { java.util.concurrent.atomic.AtomicReference<Bar> value = this.bar.get(); if ((value == null)) @@ -38,7 +41,4 @@ class DelegateOnGetter { public @java.lang.SuppressWarnings("all") void setList(final java.util.ArrayList<java.lang.String> list) { this.getBar().setList(list); } - DelegateOnGetter() { - super(); - } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/DelegateOnGetterNone.java b/test/transform/resource/after-ecj/DelegateOnGetterNone.java index 0e303936..a5f52a42 100644 --- a/test/transform/resource/after-ecj/DelegateOnGetterNone.java +++ b/test/transform/resource/after-ecj/DelegateOnGetterNone.java @@ -7,13 +7,13 @@ import lombok.Getter; int getInt(); } private final @Delegate @Getter(AccessLevel.NONE) Bar bar = null; + DelegateOnGetterNone() { + super(); + } public @java.lang.SuppressWarnings("all") int getInt() { return this.bar.getInt(); } public @java.lang.SuppressWarnings("all") void setList(final java.util.ArrayList<java.lang.String> list) { this.bar.setList(list); } - DelegateOnGetterNone() { - super(); - } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/DelegateOnMethods.java b/test/transform/resource/after-ecj/DelegateOnMethods.java index 37922e2a..928ea32e 100644 --- a/test/transform/resource/after-ecj/DelegateOnMethods.java +++ b/test/transform/resource/after-ecj/DelegateOnMethods.java @@ -3,11 +3,11 @@ abstract class DelegateOnMethods { public static interface Bar { void bar(java.util.ArrayList<java.lang.String> list); } - public @java.lang.SuppressWarnings("all") void bar(final java.util.ArrayList<java.lang.String> list) { - this.getBar().bar(list); - } DelegateOnMethods() { super(); } public abstract @Delegate Bar getBar(); -}
\ No newline at end of file + public @java.lang.SuppressWarnings("all") void bar(final java.util.ArrayList<java.lang.String> list) { + this.getBar().bar(list); + } +} diff --git a/test/transform/resource/after-ecj/DelegateRecursion.java b/test/transform/resource/after-ecj/DelegateRecursion.java index 3d9db9ef..7d1705a7 100644 --- a/test/transform/resource/after-ecj/DelegateRecursion.java +++ b/test/transform/resource/after-ecj/DelegateRecursion.java @@ -1,21 +1,21 @@ import lombok.Delegate; class DelegateRecursionOuterMost { private final @Delegate DelegateRecursionCenter center = new DelegateRecursionCenter(); - public @java.lang.SuppressWarnings("all") void innerMostMethod() { - this.center.innerMostMethod(); - } DelegateRecursionOuterMost() { super(); } + public @java.lang.SuppressWarnings("all") void innerMostMethod() { + this.center.innerMostMethod(); + } } class DelegateRecursionCenter { private final @Delegate DelegateRecursionInnerMost inner = new DelegateRecursionInnerMost(); - public @java.lang.SuppressWarnings("all") void innerMostMethod() { - this.inner.innerMostMethod(); - } DelegateRecursionCenter() { super(); } + public @java.lang.SuppressWarnings("all") void innerMostMethod() { + this.inner.innerMostMethod(); + } } class DelegateRecursionInnerMost { DelegateRecursionInnerMost() { @@ -23,4 +23,4 @@ class DelegateRecursionInnerMost { } public void innerMostMethod() { } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/DelegateTypesAndExcludes.java b/test/transform/resource/after-ecj/DelegateTypesAndExcludes.java index 821c0851..45d4edc7 100644 --- a/test/transform/resource/after-ecj/DelegateTypesAndExcludes.java +++ b/test/transform/resource/after-ecj/DelegateTypesAndExcludes.java @@ -24,13 +24,13 @@ class DelegatePlain { } private final @Delegate(types = Bar.class) BarImpl bar = new BarImpl(); private final @Delegate(types = Foo.class,excludes = Bar.class) FooImpl foo = new FooImpl(); + DelegatePlain() { + super(); + } public @java.lang.SuppressWarnings("all") void bar(final java.util.ArrayList<java.lang.String> list) { this.bar.bar(list); } public @java.lang.SuppressWarnings("all") void foo() { this.foo.foo(); } - DelegatePlain() { - super(); - } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/DelegateWithDeprecated.java b/test/transform/resource/after-ecj/DelegateWithDeprecated.java index 2a4fdf98..9c3623d8 100644 --- a/test/transform/resource/after-ecj/DelegateWithDeprecated.java +++ b/test/transform/resource/after-ecj/DelegateWithDeprecated.java @@ -6,6 +6,9 @@ class DelegateWithDeprecated { void notDeprecated(); } private @Delegate Bar bar; + DelegateWithDeprecated() { + super(); + } public @java.lang.Deprecated @java.lang.SuppressWarnings("all") void deprecatedAnnotation() { this.bar.deprecatedAnnotation(); } @@ -15,7 +18,4 @@ class DelegateWithDeprecated { public @java.lang.SuppressWarnings("all") void notDeprecated() { this.bar.notDeprecated(); } - DelegateWithDeprecated() { - super(); - } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/EqualsAndHashCode.java b/test/transform/resource/after-ecj/EqualsAndHashCode.java index ebbc1ffe..33ef799d 100644 --- a/test/transform/resource/after-ecj/EqualsAndHashCode.java +++ b/test/transform/resource/after-ecj/EqualsAndHashCode.java @@ -4,6 +4,9 @@ Object[] z; String a; String b; + EqualsAndHashCode() { + super(); + } public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; @@ -43,15 +46,15 @@ result = ((result * PRIME) + (($b == null) ? 0 : $b.hashCode())); return result; } - EqualsAndHashCode() { - super(); - } } final @lombok.EqualsAndHashCode class EqualsAndHashCode2 { int x; long y; float f; double d; + EqualsAndHashCode2() { + super(); + } public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; @@ -79,11 +82,11 @@ final @lombok.EqualsAndHashCode class EqualsAndHashCode2 { result = ((result * PRIME) + (int) ($d ^ ($d >>> 32))); return result; } - EqualsAndHashCode2() { - super(); - } } final @lombok.EqualsAndHashCode(callSuper = false) class EqualsAndHashCode3 extends EqualsAndHashCode { + EqualsAndHashCode3() { + super(); + } public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; @@ -101,11 +104,11 @@ final @lombok.EqualsAndHashCode(callSuper = false) class EqualsAndHashCode3 exte int result = 1; return result; } - EqualsAndHashCode3() { - super(); - } } @lombok.EqualsAndHashCode(callSuper = true) class EqualsAndHashCode4 extends EqualsAndHashCode { + EqualsAndHashCode4() { + super(); + } public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; @@ -127,7 +130,4 @@ final @lombok.EqualsAndHashCode(callSuper = false) class EqualsAndHashCode3 exte result = ((result * PRIME) + super.hashCode()); return result; } - EqualsAndHashCode4() { - super(); - } } diff --git a/test/transform/resource/after-ecj/ExtensionMethodPlain.java b/test/transform/resource/after-ecj/ExtensionMethodPlain.java new file mode 100644 index 00000000..6e719853 --- /dev/null +++ b/test/transform/resource/after-ecj/ExtensionMethodPlain.java @@ -0,0 +1,25 @@ +import lombok.experimental.ExtensionMethod; +@ExtensionMethod({java.util.Arrays.class, ExtensionMethodPlain.Extensions.class}) class ExtensionMethodPlain { + static class Extensions { + Extensions() { + super(); + } + public static <T>T or(T obj, T ifNull) { + return ((obj != null) ? obj : ifNull); + } + public static String toTitleCase(String in) { + if (in.isEmpty()) + return in; + return (("" + Character.toTitleCase(in.charAt(0))) + in.substring(1).toLowerCase()); + } + } + ExtensionMethodPlain() { + super(); + } + public String test() { + int[] intArray = {5, 3, 8, 2}; + java.util.Arrays.sort(intArray); + String iAmNull = null; + return ExtensionMethodPlain.Extensions.or(iAmNull, ExtensionMethodPlain.Extensions.toTitleCase("hELlO, WORlD!")); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/GetterAccessLevel.java b/test/transform/resource/after-ecj/GetterAccessLevel.java index f0de95e7..14edfb56 100644 --- a/test/transform/resource/after-ecj/GetterAccessLevel.java +++ b/test/transform/resource/after-ecj/GetterAccessLevel.java @@ -10,6 +10,9 @@ class GetterAccessLevel { @lombok.Getter(lombok.AccessLevel.PROTECTED) String protectedString; @lombok.Getter(lombok.AccessLevel.PUBLIC) String publicString; @lombok.Getter(value = lombok.AccessLevel.PUBLIC) String value; + GetterAccessLevel() { + super(); + } private @java.lang.SuppressWarnings("all") boolean isPrivate() { return this.isPrivate; } @@ -37,7 +40,4 @@ class GetterAccessLevel { public @java.lang.SuppressWarnings("all") String getValue() { return this.value; } - GetterAccessLevel() { - super(); - } } diff --git a/test/transform/resource/after-ecj/GetterAlreadyExists.java b/test/transform/resource/after-ecj/GetterAlreadyExists.java index d5bb7e60..04f5b81e 100644 --- a/test/transform/resource/after-ecj/GetterAlreadyExists.java +++ b/test/transform/resource/after-ecj/GetterAlreadyExists.java @@ -1,14 +1,14 @@ class Getter1 { @lombok.Getter boolean foo; - public @java.lang.SuppressWarnings("all") boolean isFoo() { - return this.foo; - } Getter1() { super(); } boolean hasFoo() { return true; } + public @java.lang.SuppressWarnings("all") boolean isFoo() { + return this.foo; + } } class Getter2 { @lombok.Getter boolean foo; @@ -30,27 +30,27 @@ class Getter3 { } class Getter4 { @lombok.Getter String foo; - public @java.lang.SuppressWarnings("all") String getFoo() { - return this.foo; - } Getter4() { super(); } String hasFoo() { return null; } -} -class Getter5 { - @lombok.Getter String foo; public @java.lang.SuppressWarnings("all") String getFoo() { return this.foo; } +} +class Getter5 { + @lombok.Getter String foo; Getter5() { super(); } String isFoo() { return null; } + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } } class Getter6 { @lombok.Getter String foo; @@ -63,27 +63,27 @@ class Getter6 { } class Getter7 { @lombok.Getter String foo; - public @java.lang.SuppressWarnings("all") String getFoo() { - return this.foo; - } Getter7() { super(); } boolean hasFoo() { return false; } -} -class Getter8 { - @lombok.Getter String foo; public @java.lang.SuppressWarnings("all") String getFoo() { return this.foo; } +} +class Getter8 { + @lombok.Getter String foo; Getter8() { super(); } boolean isFoo() { return false; } + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } } class Getter9 { @lombok.Getter String foo; @@ -96,15 +96,15 @@ class Getter9 { } class Getter10 { @lombok.Getter boolean foo; - public @java.lang.SuppressWarnings("all") boolean isFoo() { - return this.foo; - } Getter10() { super(); } static boolean hasFoo() { return false; } + public @java.lang.SuppressWarnings("all") boolean isFoo() { + return this.foo; + } } class Getter11 { @lombok.Getter boolean foo; @@ -126,27 +126,27 @@ class Getter12 { } class Getter13 { @lombok.Getter String foo; - public @java.lang.SuppressWarnings("all") String getFoo() { - return this.foo; - } Getter13() { super(); } static boolean hasFoo() { return false; } -} -class Getter14 { - @lombok.Getter String foo; public @java.lang.SuppressWarnings("all") String getFoo() { return this.foo; } +} +class Getter14 { + @lombok.Getter String foo; Getter14() { super(); } static boolean isFoo() { return false; } + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } } class Getter15 { @lombok.Getter String foo; @@ -159,27 +159,27 @@ class Getter15 { } class Getter16 { @lombok.Getter String foo; - public @java.lang.SuppressWarnings("all") String getFoo() { - return this.foo; - } Getter16() { super(); } static String hasFoo() { return ""; } -} -class Getter17 { - @lombok.Getter String foo; public @java.lang.SuppressWarnings("all") String getFoo() { return this.foo; } +} +class Getter17 { + @lombok.Getter String foo; Getter17() { super(); } static String isFoo() { return ""; } + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } } class Getter18 { @lombok.Getter String foo; diff --git a/test/transform/resource/after-ecj/GetterBoolean.java b/test/transform/resource/after-ecj/GetterBoolean.java index 121af119..a7dc2e2f 100644 --- a/test/transform/resource/after-ecj/GetterBoolean.java +++ b/test/transform/resource/after-ecj/GetterBoolean.java @@ -2,6 +2,9 @@ class Getter { @lombok.Getter boolean foo; @lombok.Getter boolean isBar; @lombok.Getter boolean hasBaz; + Getter() { + super(); + } public @java.lang.SuppressWarnings("all") boolean isFoo() { return this.foo; } @@ -11,21 +14,18 @@ class Getter { public @java.lang.SuppressWarnings("all") boolean isHasBaz() { return this.hasBaz; } - Getter() { - super(); - } } class MoreGetter { @lombok.Getter boolean foo; - public @java.lang.SuppressWarnings("all") boolean isFoo() { - return this.foo; - } MoreGetter() { super(); } boolean hasFoo() { return true; } + public @java.lang.SuppressWarnings("all") boolean isFoo() { + return this.foo; + } } class YetMoreGetter { @lombok.Getter boolean foo; @@ -35,4 +35,4 @@ class YetMoreGetter { boolean getFoo() { return true; } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/GetterDeprecated.java b/test/transform/resource/after-ecj/GetterDeprecated.java index c19198dd..546f7fb7 100644 --- a/test/transform/resource/after-ecj/GetterDeprecated.java +++ b/test/transform/resource/after-ecj/GetterDeprecated.java @@ -2,13 +2,13 @@ import lombok.Getter; class GetterDeprecated { @Deprecated @Getter int annotation; @Getter int javadoc; + GetterDeprecated() { + super(); + } public @java.lang.Deprecated @java.lang.SuppressWarnings("all") int getAnnotation() { return this.annotation; } public @java.lang.Deprecated @java.lang.SuppressWarnings("all") int getJavadoc() { return this.javadoc; } - GetterDeprecated() { - super(); - } } diff --git a/test/transform/resource/after-ecj/GetterEnum.java b/test/transform/resource/after-ecj/GetterEnum.java index 3536a6e8..fd70ce9e 100644 --- a/test/transform/resource/after-ecj/GetterEnum.java +++ b/test/transform/resource/after-ecj/GetterEnum.java @@ -7,15 +7,15 @@ import lombok.RequiredArgsConstructor; private final @Getter String name; <clinit>() { } - private @java.lang.SuppressWarnings("all") GetterEnum(final int id, final String name) { - super(); - this.id = id; - this.name = name; - } public @java.lang.SuppressWarnings("all") int getId() { return this.id; } public @java.lang.SuppressWarnings("all") String getName() { return this.name; } -}
\ No newline at end of file + private @java.lang.SuppressWarnings("all") GetterEnum(final int id, final String name) { + super(); + this.id = id; + this.name = name; + } +} diff --git a/test/transform/resource/after-ecj/GetterLazy.java b/test/transform/resource/after-ecj/GetterLazy.java index 89aaa40f..0f5027b9 100644 --- a/test/transform/resource/after-ecj/GetterLazy.java +++ b/test/transform/resource/after-ecj/GetterLazy.java @@ -5,6 +5,9 @@ class GetterLazy { } } private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<ValueType>> fieldName = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<ValueType>>(); + GetterLazy() { + super(); + } public @java.lang.SuppressWarnings("all") ValueType getFieldName() { java.util.concurrent.atomic.AtomicReference<ValueType> value = this.fieldName.get(); if ((value == null)) @@ -22,7 +25,4 @@ class GetterLazy { } return value.get(); } - GetterLazy() { - super(); - } } diff --git a/test/transform/resource/after-ecj/GetterLazyBoolean.java b/test/transform/resource/after-ecj/GetterLazyBoolean.java index 689101c8..8c890827 100644 --- a/test/transform/resource/after-ecj/GetterLazyBoolean.java +++ b/test/transform/resource/after-ecj/GetterLazyBoolean.java @@ -1,6 +1,12 @@ @lombok.EqualsAndHashCode(of = "booleanValue") @lombok.ToString(of = "booleanValue") class GetterLazyBoolean { private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>> booleanValue = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>>(); private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>> otherBooleanValue = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>>(); + GetterLazyBoolean() { + super(); + } + private static boolean calculateBoolean() { + return true; + } public @java.lang.SuppressWarnings("all") boolean isBooleanValue() { java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> value = this.booleanValue.get(); if ((value == null)) @@ -59,10 +65,4 @@ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("GetterLazyBoolean(booleanValue=" + this.isBooleanValue()) + ")"); } - GetterLazyBoolean() { - super(); - } - private static boolean calculateBoolean() { - return true; - } } diff --git a/test/transform/resource/after-ecj/GetterLazyEahcToString.java b/test/transform/resource/after-ecj/GetterLazyEahcToString.java index 9faab0de..1ca848af 100644 --- a/test/transform/resource/after-ecj/GetterLazyEahcToString.java +++ b/test/transform/resource/after-ecj/GetterLazyEahcToString.java @@ -1,6 +1,9 @@ @lombok.EqualsAndHashCode(doNotUseGetters = true) @lombok.ToString(doNotUseGetters = true) class GetterLazyEahcToString { private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<String>> value = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<String>>(); private final @lombok.Getter String value2 = ""; + GetterLazyEahcToString() { + super(); + } public @java.lang.SuppressWarnings("all") String getValue() { java.util.concurrent.atomic.AtomicReference<String> value = this.value.get(); if ((value == null)) @@ -54,7 +57,4 @@ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("GetterLazyEahcToString(value=" + this.getValue()) + ", value2=") + this.value2) + ")"); } - GetterLazyEahcToString() { - super(); - } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/GetterLazyInvalid.java b/test/transform/resource/after-ecj/GetterLazyInvalid.java index eaa22d71..da89c333 100644 --- a/test/transform/resource/after-ecj/GetterLazyInvalid.java +++ b/test/transform/resource/after-ecj/GetterLazyInvalid.java @@ -24,12 +24,12 @@ class GetterLazyInvalidNone { } @lombok.Getter(lazy = true) class GetterLazyInvalidClass { private final String fieldName = ""; - public @java.lang.SuppressWarnings("all") String getFieldName() { - return this.fieldName; - } GetterLazyInvalidClass() { super(); } + public @java.lang.SuppressWarnings("all") String getFieldName() { + return this.fieldName; + } } class GetterLazyInvalidNoInit { private final @lombok.Getter(lazy = true) String fieldName; @@ -37,4 +37,4 @@ class GetterLazyInvalidNoInit { super(); this.fieldName = "foo"; } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/GetterLazyNative.java b/test/transform/resource/after-ecj/GetterLazyNative.java index da1357a0..b67abfc9 100644 --- a/test/transform/resource/after-ecj/GetterLazyNative.java +++ b/test/transform/resource/after-ecj/GetterLazyNative.java @@ -8,6 +8,9 @@ class GetterLazyNative { private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Double>> doubleField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Double>>(); private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Character>> charField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Character>>(); private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<int[]>> intArrayField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<int[]>>(); + GetterLazyNative() { + super(); + } public @java.lang.SuppressWarnings("all") boolean isBooleanField() { java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> value = this.booleanField.get(); if ((value == null)) @@ -161,7 +164,4 @@ class GetterLazyNative { } return value.get(); } - GetterLazyNative() { - super(); - } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/GetterNone.java b/test/transform/resource/after-ecj/GetterNone.java index 2ab252ea..f08726d0 100644 --- a/test/transform/resource/after-ecj/GetterNone.java +++ b/test/transform/resource/after-ecj/GetterNone.java @@ -3,10 +3,10 @@ import lombok.Getter; @Getter class GetterNone { int i; @Getter(AccessLevel.NONE) int foo; - public @java.lang.SuppressWarnings("all") int getI() { - return this.i; - } GetterNone() { super(); } -}
\ No newline at end of file + public @java.lang.SuppressWarnings("all") int getI() { + return this.i; + } +} diff --git a/test/transform/resource/after-ecj/GetterOnClass.java b/test/transform/resource/after-ecj/GetterOnClass.java index 421aa150..7668c9d3 100644 --- a/test/transform/resource/after-ecj/GetterOnClass.java +++ b/test/transform/resource/after-ecj/GetterOnClass.java @@ -1,68 +1,67 @@ @lombok.Getter class GetterOnClass1 { @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; boolean isPublic; - public @java.lang.SuppressWarnings("all") boolean isPublic() { - return this.isPublic; - } GetterOnClass1() { super(); } - + public @java.lang.SuppressWarnings("all") boolean isPublic() { + return this.isPublic; + } } @lombok.Getter(lombok.AccessLevel.PROTECTED) class GetterOnClass2 { @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; boolean isProtected; @lombok.Getter(lombok.AccessLevel.PACKAGE) boolean isPackage; + GetterOnClass2() { + super(); + } @java.lang.SuppressWarnings("all") boolean isPackage() { return this.isPackage; } protected @java.lang.SuppressWarnings("all") boolean isProtected() { return this.isProtected; } - GetterOnClass2() { - super(); - } } @lombok.Getter(lombok.AccessLevel.PACKAGE) class GetterOnClass3 { @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; boolean isPackage; - @java.lang.SuppressWarnings("all") boolean isPackage() { - return this.isPackage; - } GetterOnClass3() { super(); } + @java.lang.SuppressWarnings("all") boolean isPackage() { + return this.isPackage; + } } @lombok.Getter(lombok.AccessLevel.PRIVATE) class GetterOnClass4 { @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; boolean isPrivate; - private @java.lang.SuppressWarnings("all") boolean isPrivate() { - return this.isPrivate; - } GetterOnClass4() { super(); } + private @java.lang.SuppressWarnings("all") boolean isPrivate() { + return this.isPrivate; + } } @lombok.Getter(lombok.AccessLevel.PUBLIC) class GetterOnClass5 { @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; boolean isPublic; - public @java.lang.SuppressWarnings("all") boolean isPublic() { - return this.isPublic; - } GetterOnClass5() { super(); } + public @java.lang.SuppressWarnings("all") boolean isPublic() { + return this.isPublic; + } } @lombok.Getter class GetterOnClass6 { String couldBeNull; @lombok.NonNull String nonNull; + GetterOnClass6() { + super(); + } public @java.lang.SuppressWarnings("all") String getCouldBeNull() { return this.couldBeNull; } public @lombok.NonNull @java.lang.SuppressWarnings("all") String getNonNull() { return this.nonNull; } - GetterOnClass6() { - super(); - } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/GetterOnStatic.java b/test/transform/resource/after-ecj/GetterOnStatic.java index 538f25cb..ee90b897 100644 --- a/test/transform/resource/after-ecj/GetterOnStatic.java +++ b/test/transform/resource/after-ecj/GetterOnStatic.java @@ -3,13 +3,13 @@ class Getter { static @lombok.Getter int bar; <clinit>() { } + Getter() { + super(); + } public static @java.lang.SuppressWarnings("all") boolean isFoo() { return Getter.foo; } public static @java.lang.SuppressWarnings("all") int getBar() { return Getter.bar; } - Getter() { - super(); - } } diff --git a/test/transform/resource/after-ecj/GetterPlain.java b/test/transform/resource/after-ecj/GetterPlain.java index cd096ca3..10f0f9d7 100644 --- a/test/transform/resource/after-ecj/GetterPlain.java +++ b/test/transform/resource/after-ecj/GetterPlain.java @@ -2,13 +2,13 @@ import lombok.Getter; class GetterPlain { @lombok.Getter int i; @Getter int foo; + GetterPlain() { + super(); + } public @java.lang.SuppressWarnings("all") int getI() { return this.i; } public @java.lang.SuppressWarnings("all") int getFoo() { return this.foo; } - GetterPlain() { - super(); - } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/GetterWithDollar.java b/test/transform/resource/after-ecj/GetterWithDollar.java index b102ba66..f4bc799c 100644 --- a/test/transform/resource/after-ecj/GetterWithDollar.java +++ b/test/transform/resource/after-ecj/GetterWithDollar.java @@ -1,22 +1,22 @@ class GetterWithDollar1 { @lombok.Getter int $i; - public @java.lang.SuppressWarnings("all") int get$i() { - return this.$i; - } GetterWithDollar1() { super(); } + public @java.lang.SuppressWarnings("all") int get$i() { + return this.$i; + } } class GetterWithDollar2 { @lombok.Getter int $i; @lombok.Getter int i; + GetterWithDollar2() { + super(); + } public @java.lang.SuppressWarnings("all") int get$i() { return this.$i; } public @java.lang.SuppressWarnings("all") int getI() { return this.i; } - GetterWithDollar2() { - super(); - } } diff --git a/test/transform/resource/after-ecj/MultiFieldGetter.java b/test/transform/resource/after-ecj/MultiFieldGetter.java index 16368f25..151c61c8 100644 --- a/test/transform/resource/after-ecj/MultiFieldGetter.java +++ b/test/transform/resource/after-ecj/MultiFieldGetter.java @@ -3,26 +3,26 @@ import lombok.AccessLevel; class MultiFieldGetter { @Getter(AccessLevel.PROTECTED) int x; @Getter(AccessLevel.PROTECTED) int y; + MultiFieldGetter() { + super(); + } protected @java.lang.SuppressWarnings("all") int getX() { return this.x; } protected @java.lang.SuppressWarnings("all") int getY() { return this.y; } - MultiFieldGetter() { - super(); - } } @Getter class MultiFieldGetter2 { @Getter(AccessLevel.PACKAGE) int x; @Getter(AccessLevel.PACKAGE) int y; + MultiFieldGetter2() { + super(); + } @java.lang.SuppressWarnings("all") int getX() { return this.x; } @java.lang.SuppressWarnings("all") int getY() { return this.y; } - MultiFieldGetter2() { - super(); - } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/SetterAccessLevel.java b/test/transform/resource/after-ecj/SetterAccessLevel.java index 58baac51..4c1a0b97 100644 --- a/test/transform/resource/after-ecj/SetterAccessLevel.java +++ b/test/transform/resource/after-ecj/SetterAccessLevel.java @@ -5,6 +5,9 @@ class SetterAccessLevel { @lombok.Setter(lombok.AccessLevel.PROTECTED) boolean isProtected; @lombok.Setter(lombok.AccessLevel.PUBLIC) boolean isPublic; @lombok.Setter(value = lombok.AccessLevel.PUBLIC) boolean value; + SetterAccessLevel() { + super(); + } private @java.lang.SuppressWarnings("all") void setPrivate(final boolean isPrivate) { this.isPrivate = isPrivate; } @@ -20,7 +23,4 @@ class SetterAccessLevel { public @java.lang.SuppressWarnings("all") void setValue(final boolean value) { this.value = value; } - SetterAccessLevel() { - super(); - } } diff --git a/test/transform/resource/after-ecj/SetterAlreadyExists.java b/test/transform/resource/after-ecj/SetterAlreadyExists.java index 4c8a212d..91b011b6 100644 --- a/test/transform/resource/after-ecj/SetterAlreadyExists.java +++ b/test/transform/resource/after-ecj/SetterAlreadyExists.java @@ -32,25 +32,25 @@ class Setter4 { } class Setter5 { @lombok.Setter String foo; - public @java.lang.SuppressWarnings("all") void setFoo(final String foo) { - this.foo = foo; - } Setter5() { super(); } void setFoo() { } -} -class Setter6 { - @lombok.Setter String foo; public @java.lang.SuppressWarnings("all") void setFoo(final String foo) { this.foo = foo; } +} +class Setter6 { + @lombok.Setter String foo; Setter6() { super(); } void setFoo(String foo, int x) { } + public @java.lang.SuppressWarnings("all") void setFoo(final String foo) { + this.foo = foo; + } } class Setter7 { @lombok.Setter String foo; @@ -75,4 +75,4 @@ class Setter9 { } void setFoo(boolean foo) { } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/SetterDeprecated.java b/test/transform/resource/after-ecj/SetterDeprecated.java index b12ae34d..d76612b7 100644 --- a/test/transform/resource/after-ecj/SetterDeprecated.java +++ b/test/transform/resource/after-ecj/SetterDeprecated.java @@ -2,13 +2,13 @@ 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; } - SetterDeprecated() { - super(); - } } diff --git a/test/transform/resource/after-ecj/SetterOnClass.java b/test/transform/resource/after-ecj/SetterOnClass.java index 370c0335..da928f24 100644 --- a/test/transform/resource/after-ecj/SetterOnClass.java +++ b/test/transform/resource/after-ecj/SetterOnClass.java @@ -1,60 +1,63 @@ @lombok.Setter class SetterOnClass1 { @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; boolean isPublic; - public @java.lang.SuppressWarnings("all") void setPublic(final boolean isPublic) { - this.isPublic = isPublic; - } SetterOnClass1() { super(); } + public @java.lang.SuppressWarnings("all") void setPublic(final boolean isPublic) { + this.isPublic = isPublic; + } } @lombok.Setter(lombok.AccessLevel.PROTECTED) class SetterOnClass2 { @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; boolean isProtected; @lombok.Setter(lombok.AccessLevel.PACKAGE) boolean isPackage; + SetterOnClass2() { + super(); + } @java.lang.SuppressWarnings("all") void setPackage(final boolean isPackage) { this.isPackage = isPackage; } protected @java.lang.SuppressWarnings("all") void setProtected(final boolean isProtected) { this.isProtected = isProtected; } - SetterOnClass2() { - super(); - } } @lombok.Setter(lombok.AccessLevel.PACKAGE) class SetterOnClass3 { @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; boolean isPackage; - @java.lang.SuppressWarnings("all") void setPackage(final boolean isPackage) { - this.isPackage = isPackage; - } SetterOnClass3() { super(); } + @java.lang.SuppressWarnings("all") void setPackage(final boolean isPackage) { + this.isPackage = isPackage; + } } @lombok.Setter(lombok.AccessLevel.PRIVATE) class SetterOnClass4 { @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; boolean isPrivate; - private @java.lang.SuppressWarnings("all") void setPrivate(final boolean isPrivate) { - this.isPrivate = isPrivate; - } SetterOnClass4() { super(); } + private @java.lang.SuppressWarnings("all") void setPrivate(final boolean isPrivate) { + this.isPrivate = isPrivate; + } } @lombok.Setter(lombok.AccessLevel.PUBLIC) class SetterOnClass5 { @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; boolean isPublic; - public @java.lang.SuppressWarnings("all") void setPublic(final boolean isPublic) { - this.isPublic = isPublic; - } SetterOnClass5() { super(); } + public @java.lang.SuppressWarnings("all") void setPublic(final boolean isPublic) { + this.isPublic = isPublic; + } } @lombok.Setter class SetterOnClass6 { String couldBeNull; @lombok.NonNull String nonNull; + SetterOnClass6() { + super(); + } public @java.lang.SuppressWarnings("all") void setCouldBeNull(final String couldBeNull) { this.couldBeNull = couldBeNull; } @@ -63,7 +66,4 @@ throw new java.lang.NullPointerException("nonNull"); this.nonNull = nonNull; } - SetterOnClass6() { - super(); - } } diff --git a/test/transform/resource/after-ecj/SetterOnStatic.java b/test/transform/resource/after-ecj/SetterOnStatic.java index c1e4d3d1..8a5abdd8 100644 --- a/test/transform/resource/after-ecj/SetterOnStatic.java +++ b/test/transform/resource/after-ecj/SetterOnStatic.java @@ -3,13 +3,13 @@ class Setter { static @lombok.Setter int bar; <clinit>() { } + Setter() { + super(); + } public static @java.lang.SuppressWarnings("all") void setFoo(final boolean foo) { Setter.foo = foo; } public static @java.lang.SuppressWarnings("all") void setBar(final int bar) { Setter.bar = bar; } - Setter() { - super(); - } } diff --git a/test/transform/resource/after-ecj/SetterPlain.java b/test/transform/resource/after-ecj/SetterPlain.java index 08154244..a4b40295 100644 --- a/test/transform/resource/after-ecj/SetterPlain.java +++ b/test/transform/resource/after-ecj/SetterPlain.java @@ -2,13 +2,13 @@ import lombok.Setter; class SetterPlain { @lombok.Setter int i; @Setter int foo; + SetterPlain() { + super(); + } public @java.lang.SuppressWarnings("all") void setI(final int i) { this.i = i; } public @java.lang.SuppressWarnings("all") void setFoo(final int foo) { this.foo = foo; } - SetterPlain() { - super(); - } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/SetterWithDollar.java b/test/transform/resource/after-ecj/SetterWithDollar.java index bf27536b..c5bc14f1 100644 --- a/test/transform/resource/after-ecj/SetterWithDollar.java +++ b/test/transform/resource/after-ecj/SetterWithDollar.java @@ -1,22 +1,22 @@ class SetterWithDollar1 { @lombok.Setter int $i; - public @java.lang.SuppressWarnings("all") void set$i(final int $i) { - this.$i = $i; - } SetterWithDollar1() { super(); } + public @java.lang.SuppressWarnings("all") void set$i(final int $i) { + this.$i = $i; + } } class SetterWithDollar2 { @lombok.Setter int $i; @lombok.Setter int i; + SetterWithDollar2() { + super(); + } public @java.lang.SuppressWarnings("all") void set$i(final int $i) { this.$i = $i; } public @java.lang.SuppressWarnings("all") void setI(final int i) { this.i = i; } - SetterWithDollar2() { - super(); - } } diff --git a/test/transform/resource/after-ecj/SimpleTypeResolution.java b/test/transform/resource/after-ecj/SimpleTypeResolution.java index b049c62e..c413623e 100644 --- a/test/transform/resource/after-ecj/SimpleTypeResolution.java +++ b/test/transform/resource/after-ecj/SimpleTypeResolution.java @@ -5,9 +5,9 @@ class SimpleTypeResolutionFail { } class SimpleTypeResolutionSuccess { private @lombok.Getter int x; + SimpleTypeResolutionSuccess() { + } public @java.lang.SuppressWarnings("all") int getX() { return this.x; } - SimpleTypeResolutionSuccess() { - } } diff --git a/test/transform/resource/after-ecj/SynchronizedName.java b/test/transform/resource/after-ecj/SynchronizedName.java index a7edd3e7..b7474373 100644 --- a/test/transform/resource/after-ecj/SynchronizedName.java +++ b/test/transform/resource/after-ecj/SynchronizedName.java @@ -12,15 +12,6 @@ class SynchronizedName { System.out.println("one"); } } - @lombok.Synchronized("write") void test2() { - System.out.println("two"); - } - static @lombok.Synchronized("read") void test3() { - synchronized (SynchronizedName.read) - { - System.out.println("three"); - } - } @lombok.Synchronized("READ") void test4() { synchronized (this.READ) { @@ -33,4 +24,4 @@ class SynchronizedName { System.out.println("five"); } } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/SynchronizedNameNoSuchField.java b/test/transform/resource/after-ecj/SynchronizedNameNoSuchField.java new file mode 100644 index 00000000..7c78b945 --- /dev/null +++ b/test/transform/resource/after-ecj/SynchronizedNameNoSuchField.java @@ -0,0 +1,12 @@ +class SynchronizedNameNoSuchField { + private Object read = new Object(); + private static Object READ = new Object(); + <clinit>() { + } + SynchronizedNameNoSuchField() { + super(); + } + @lombok.Synchronized("write") void test2() { + System.out.println("two"); + } +} diff --git a/test/transform/resource/after-ecj/SynchronizedNameStaticToInstanceRef.java b/test/transform/resource/after-ecj/SynchronizedNameStaticToInstanceRef.java new file mode 100644 index 00000000..103c714c --- /dev/null +++ b/test/transform/resource/after-ecj/SynchronizedNameStaticToInstanceRef.java @@ -0,0 +1,15 @@ +class SynchronizedNameStaticToInstanceRef { + private Object read = new Object(); + private static Object READ = new Object(); + <clinit>() { + } + SynchronizedNameStaticToInstanceRef() { + super(); + } + static @lombok.Synchronized("read") void test3() { + synchronized (SynchronizedNameStaticToInstanceRef.read) + { + System.out.println("three"); + } + } +} diff --git a/test/transform/resource/after-ecj/ToStringInner.java b/test/transform/resource/after-ecj/ToStringInner.java index dc8696c5..a8624823 100644 --- a/test/transform/resource/after-ecj/ToStringInner.java +++ b/test/transform/resource/after-ecj/ToStringInner.java @@ -2,31 +2,31 @@ import lombok.ToString; @ToString class ToStringOuter { @ToString class ToStringInner { int y; - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("ToStringOuter.ToStringInner(y=" + this.y) + ")"); - } ToStringInner() { super(); } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("ToStringOuter.ToStringInner(y=" + this.y) + ")"); + } } static @ToString class ToStringStaticInner { int y; - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("ToStringOuter.ToStringStaticInner(y=" + this.y) + ")"); - } ToStringStaticInner() { super(); } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("ToStringOuter.ToStringStaticInner(y=" + this.y) + ")"); + } } class ToStringMiddle { @ToString class ToStringMoreInner { String name; - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("ToStringOuter.ToStringMiddle.ToStringMoreInner(name=" + this.name) + ")"); - } ToStringMoreInner() { super(); } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("ToStringOuter.ToStringMiddle.ToStringMoreInner(name=" + this.name) + ")"); + } } ToStringMiddle() { super(); @@ -34,10 +34,10 @@ import lombok.ToString; } int x; String name; - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("ToStringOuter(x=" + this.x) + ", name=") + this.name) + ")"); - } ToStringOuter() { super(); } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("ToStringOuter(x=" + this.x) + ", name=") + this.name) + ")"); + } } diff --git a/test/transform/resource/after-ecj/ToStringPlain.java b/test/transform/resource/after-ecj/ToStringPlain.java index 2361b32a..7c9b47f5 100644 --- a/test/transform/resource/after-ecj/ToStringPlain.java +++ b/test/transform/resource/after-ecj/ToStringPlain.java @@ -2,20 +2,20 @@ import lombok.ToString; @lombok.ToString class ToString1 { int x; String name; - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("ToString1(x=" + this.x) + ", name=") + this.name) + ")"); - } ToString1() { super(); } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("ToString1(x=" + this.x) + ", name=") + this.name) + ")"); + } } @ToString class ToString2 { int x; String name; - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("ToString2(x=" + this.x) + ", name=") + this.name) + ")"); - } ToString2() { super(); } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("ToString2(x=" + this.x) + ", name=") + this.name) + ")"); + } } diff --git a/test/transform/resource/after-ecj/TrickyTypeResolution.java b/test/transform/resource/after-ecj/TrickyTypeResolution.java index fb807709..4553aaba 100644 --- a/test/transform/resource/after-ecj/TrickyTypeResolution.java +++ b/test/transform/resource/after-ecj/TrickyTypeResolution.java @@ -17,12 +17,12 @@ class TrickyDoNothing2 { } class TrickySuccess { @Getter int x; - public @java.lang.SuppressWarnings("all") int getX() { - return this.x; - } TrickySuccess() { super(); } + public @java.lang.SuppressWarnings("all") int getX() { + return this.x; + } } class TrickyDoNothing3 { TrickyDoNothing3() { @@ -84,4 +84,4 @@ class DoubleTrickyDoSomething { final @val java.lang.Object y = null; } } -}
\ No newline at end of file +} diff --git a/test/transform/resource/before/ConflictingStaticConstructorNames.java b/test/transform/resource/before/ConflictingStaticConstructorNames.java new file mode 100644 index 00000000..494e3cd6 --- /dev/null +++ b/test/transform/resource/before/ConflictingStaticConstructorNames.java @@ -0,0 +1,4 @@ +@lombok.Data(staticConstructor="of") +@lombok.NoArgsConstructor +class ConflictingStaticConstructorNames { +}
\ No newline at end of file diff --git a/test/transform/resource/before/Constructors.java b/test/transform/resource/before/Constructors.java index 272fa850..d3ed3504 100644 --- a/test/transform/resource/before/Constructors.java +++ b/test/transform/resource/before/Constructors.java @@ -22,3 +22,7 @@ final T x; String name; } +@lombok.RequiredArgsConstructor(staticName="of") class RequiredArgsConstructorStaticNameGenerics2<T extends Number> { + final Class<T> x; + String name; +} diff --git a/test/transform/resource/before/ExtensionMethodPlain.java b/test/transform/resource/before/ExtensionMethodPlain.java new file mode 100644 index 00000000..8c2f369d --- /dev/null +++ b/test/transform/resource/before/ExtensionMethodPlain.java @@ -0,0 +1,23 @@ +import lombok.experimental.ExtensionMethod; + +@ExtensionMethod({java.util.Arrays.class, ExtensionMethodPlain.Extensions.class}) +class ExtensionMethodPlain { + public String test() { + int[] intArray = {5, 3, 8, 2}; + intArray.sort(); + + String iAmNull = null; + return iAmNull.or("hELlO, WORlD!".toTitleCase()); + } + + static class Extensions { + public static <T> T or(T obj, T ifNull) { + return obj != null ? obj : ifNull; + } + + public static String toTitleCase(String in) { + if (in.isEmpty()) return in; + return "" + Character.toTitleCase(in.charAt(0)) + in.substring(1).toLowerCase(); + } + } +} diff --git a/test/transform/resource/before/SynchronizedName.java b/test/transform/resource/before/SynchronizedName.java index 5d074113..7553a8ce 100644 --- a/test/transform/resource/before/SynchronizedName.java +++ b/test/transform/resource/before/SynchronizedName.java @@ -5,12 +5,6 @@ class SynchronizedName { @lombok.Synchronized("read") void test1() { System.out.println("one"); } - @lombok.Synchronized("write") void test2() { - System.out.println("two"); - } - @lombok.Synchronized("read") static void test3() { - System.out.println("three"); - } @lombok.Synchronized("READ") void test4() { System.out.println("four"); } diff --git a/test/transform/resource/before/SynchronizedNameNoSuchField.java b/test/transform/resource/before/SynchronizedNameNoSuchField.java new file mode 100644 index 00000000..343ba6ae --- /dev/null +++ b/test/transform/resource/before/SynchronizedNameNoSuchField.java @@ -0,0 +1,8 @@ +class SynchronizedNameNoSuchField { + private Object read = new Object(); + private static Object READ = new Object(); + + @lombok.Synchronized("write") void test2() { + System.out.println("two"); + } +} diff --git a/test/transform/resource/before/SynchronizedNameStaticToInstanceRef.java b/test/transform/resource/before/SynchronizedNameStaticToInstanceRef.java new file mode 100644 index 00000000..08f9dbf1 --- /dev/null +++ b/test/transform/resource/before/SynchronizedNameStaticToInstanceRef.java @@ -0,0 +1,8 @@ +class SynchronizedNameStaticToInstanceRef { + private Object read = new Object(); + private static Object READ = new Object(); + + @lombok.Synchronized("read") static void test3() { + System.out.println("three"); + } +} diff --git a/test/transform/resource/messages-delombok/ConflictingStaticConstructorNames.java.messages b/test/transform/resource/messages-delombok/ConflictingStaticConstructorNames.java.messages new file mode 100644 index 00000000..40366cd7 --- /dev/null +++ b/test/transform/resource/messages-delombok/ConflictingStaticConstructorNames.java.messages @@ -0,0 +1 @@ +1:1 WARNING Ignoring static constructor name: explicit @XxxArgsConstructor annotation present; its `staticName` parameter will be used. diff --git a/test/transform/resource/messages-delombok/SynchronizedName.java.messages b/test/transform/resource/messages-delombok/SynchronizedName.java.messages deleted file mode 100644 index 2af3ca1d..00000000 --- a/test/transform/resource/messages-delombok/SynchronizedName.java.messages +++ /dev/null @@ -1 +0,0 @@ -8:9 ERROR The field write does not exist.
\ No newline at end of file diff --git a/test/transform/resource/messages-delombok/SynchronizedNameNoSuchField.java.messages b/test/transform/resource/messages-delombok/SynchronizedNameNoSuchField.java.messages new file mode 100644 index 00000000..bffd29e6 --- /dev/null +++ b/test/transform/resource/messages-delombok/SynchronizedNameNoSuchField.java.messages @@ -0,0 +1 @@ +5:9 ERROR The field write does not exist. diff --git a/test/transform/resource/messages-delombok/SynchronizedNameStaticToInstanceRef.java.messages b/test/transform/resource/messages-delombok/SynchronizedNameStaticToInstanceRef.java.messages new file mode 100644 index 00000000..84336ebb --- /dev/null +++ b/test/transform/resource/messages-delombok/SynchronizedNameStaticToInstanceRef.java.messages @@ -0,0 +1 @@ +5:9 ERROR non-static variable read cannot be referenced from a static context
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/ConflictingStaticConstructorNames.java.messages b/test/transform/resource/messages-ecj/ConflictingStaticConstructorNames.java.messages new file mode 100644 index 00000000..ecbf4a61 --- /dev/null +++ b/test/transform/resource/messages-ecj/ConflictingStaticConstructorNames.java.messages @@ -0,0 +1 @@ +1 warning Ignoring static constructor name: explicit @XxxArgsConstructor annotation present; its `staticName` parameter will be used. diff --git a/test/transform/resource/messages-ecj/SynchronizedName.java.messages b/test/transform/resource/messages-ecj/SynchronizedName.java.messages index d200ac0e..4c428aac 100644 --- a/test/transform/resource/messages-ecj/SynchronizedName.java.messages +++ b/test/transform/resource/messages-ecj/SynchronizedName.java.messages @@ -1,2 +1 @@ -8 error The field write does not exist. -11 error Cannot make a static reference to the non-static field SynchronizedName.read
\ No newline at end of file +8 warning The static field SynchronizedName.READ should be accessed in a static way diff --git a/test/transform/resource/messages-ecj/SynchronizedNameNoSuchField.java.messages b/test/transform/resource/messages-ecj/SynchronizedNameNoSuchField.java.messages new file mode 100644 index 00000000..f16d071a --- /dev/null +++ b/test/transform/resource/messages-ecj/SynchronizedNameNoSuchField.java.messages @@ -0,0 +1 @@ +5 error The field write does not exist. diff --git a/test/transform/resource/messages-ecj/SynchronizedNameStaticToInstanceRef.java.messages b/test/transform/resource/messages-ecj/SynchronizedNameStaticToInstanceRef.java.messages new file mode 100644 index 00000000..c207cd70 --- /dev/null +++ b/test/transform/resource/messages-ecj/SynchronizedNameStaticToInstanceRef.java.messages @@ -0,0 +1 @@ +5 error Cannot make a static reference to the non-static field SynchronizedNameStaticToInstanceRef.read diff --git a/test/transform/resource/messages-idempotent/SynchronizedNameStaticToInstanceRef.java.messages b/test/transform/resource/messages-idempotent/SynchronizedNameStaticToInstanceRef.java.messages new file mode 100644 index 00000000..c34e29f6 --- /dev/null +++ b/test/transform/resource/messages-idempotent/SynchronizedNameStaticToInstanceRef.java.messages @@ -0,0 +1 @@ +5:66 ERROR non-static variable read cannot be referenced from a static context diff --git a/test/transform/resource/messages-idempotent/ValErrors.java.messages b/test/transform/resource/messages-idempotent/ValErrors.java.messages new file mode 100644 index 00000000..6f666511 --- /dev/null +++ b/test/transform/resource/messages-idempotent/ValErrors.java.messages @@ -0,0 +1,7 @@ +3:44 ERROR cannot find symbol +symbol : variable d +location: class ValErrors +6:17 ERROR cannot find symbol +symbol : class val +location: class ValErrors +6:25 ERROR illegal initializer for <none> |