diff options
38 files changed, 395 insertions, 158 deletions
@@ -19,6 +19,7 @@ Michiel Verheul <cheelio@gmail.com> Pascal Bihler <pascal@qfs.de> Peter Grant <petercgrant@users.noreply.github.com> Philipp Eichhorn <peichhor@web.de> +Philippe Charles <philippe.charles@nbb.be> Rabea Gransberger <rgra@users.noreply.github.com> Reinier Zwitserloot <reinier@zwitserloot.com> Robbert Jan Grootjans <grootjans@gmail.com> @@ -112,7 +112,7 @@ the common tasks and can be called on to run the main aspects of all the sub-scr </target> <target name="ensureBuildDeps" depends="config-ivy,ensureOpenJdk6Rt"> - <ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="build, javac7" /> + <ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="build, javac7, moduleBuild" /> <ivy:retrieve /> </target> @@ -163,15 +163,7 @@ the common tasks and can be called on to run the main aspects of all the sub-scr <target name="-ensureJdk9"> <condition property="java.version.insufficient"> - <or> - <equals arg1="${ant.java.version}" arg2="1.2" /> - <equals arg1="${ant.java.version}" arg2="1.3" /> - <equals arg1="${ant.java.version}" arg2="1.4" /> - <equals arg1="${ant.java.version}" arg2="1.5" /> - <equals arg1="${ant.java.version}" arg2="1.6" /> - <equals arg1="${ant.java.version}" arg2="1.7" /> - <equals arg1="${ant.java.version}" arg2="1.8" /> - </or> + <matches string="${java.version}" pattern="^1\.[2-8](\..*)?" /> </condition> <fail if="java.version.insufficient">To compile lombok, you need JDK9 or higher; lombok requires this version because it's rather difficult to produce lombok builds that are compatible on JDK9 without at least building with JDK9. Sorry about that.</fail> </target> @@ -254,15 +246,18 @@ the common tasks and can be called on to run the main aspects of all the sub-scr <classpath refid="build.path" /> </ivy:compile> - <ivy:compile destdir="build/lombok" source="1.9" target="1.9"> + <javac includeAntRuntime="false" source="1.9" target="1.9" destdir="build/lombok" modulepath="lib/moduleBuild"> <compilerarg value="-Xlint:none" /> <!-- The above is because javac9 warns about 'service interface provided but not exported or used', probably because lombok uses SPI internally, and uses the 'old' classpath discovery system for it. We're fine with this, hence, ignore this warning. --> <src path="src/core9" /> + </javac> + <mkdir dir="build/lombokMapstruct" /> + <javac includeAntRuntime="false" source="1.9" target="1.9" destdir="build/lombokMapstruct"> <src path="src/j9stubs" /> <!-- This includes org.mapstruct.ap.spi.AstModifyingAnnotationProcessor; putting this on the classpath doesn't work (needs to be internal or a module) so we just add it and then delete the class file for convenience. --> - </ivy:compile> + </javac> <mkdir dir="build/lombok/secondaryLoading.SCL.lombok/org/mapstruct/ap/spi" /> - <move file="build/lombok/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.class" tofile="build/lombok/secondaryLoading.SCL.lombok/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.SCL.lombok" /> + <move file="build/lombokMapstruct/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.class" tofile="build/lombok/secondaryLoading.SCL.lombok/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.SCL.lombok" /> <ivy:compile destdir="build/lombok/Class50" source="1.5" target="1.6" ecj="true" nowarn="true" includeSystemBootclasspath="true"> <bootclasspath location="build/stubs" /> diff --git a/buildScripts/ivy.xml b/buildScripts/ivy.xml index c1ddc6fd..4eed2fa6 100644 --- a/buildScripts/ivy.xml +++ b/buildScripts/ivy.xml @@ -5,6 +5,7 @@ <conf name="netbeansBuild" /> <conf name="buildBase" extends="netbeansBuild, javac6" /> <conf name="build" extends="buildBase, eclipseBuild" /> + <conf name="moduleBuild" /> <conf name="buildWithoutEclipse" extends="buildBase" /> <conf name="runtime" /> <conf name="test" extends="runtime" /> @@ -64,5 +65,7 @@ <dependency org="com.jcraft" name="jsch" rev="0.1.54" conf="supporters->default" /> <dependency org="com.rimerosolutions.ant" name="ant-git-tasks" rev="1.3.2" conf="supporters->default" /> <dependency org="org.slf4j" name="slf4j-simple" rev="1.6.1" conf="supporters->default" /> + + <dependency org="org.mapstruct" name="mapstruct-processor" rev="1.3.0.Beta1" conf="moduleBuild->default" /> </dependencies> </ivy-module> diff --git a/doc/changelog.markdown b/doc/changelog.markdown index 238b4a38..a294d6a1 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -2,7 +2,10 @@ Lombok Changelog ---------------- ### v1.18.3 "Edgy Guinea Pig" -* FEATURE: THe `@FieldNameConstants` feature has been completely redesigned. [Issue #1774](https://github.com/rzwitserloot/lombok/issues/1774) [FieldNameConstants documentation](https://projectlombok.org/features/experimental/FieldNameConstants) +* FEATURE: The `@FieldNameConstants` feature has been completely redesigned. [Issue #1774](https://github.com/rzwitserloot/lombok/issues/1774) [FieldNameConstants documentation](https://projectlombok.org/features/experimental/FieldNameConstants) +* BUGFIX: When using lombok to compile modularized (`module-info.java`-style) code, if the module name has dots in it, it wouldn't work. [Issue #1808](https://github.com/rzwitserloot/lombok/issues/1808) +* BUGFIX: Errors about lombok not reading a module providing `org.mapstruct.ap.spi` when trying to use lombok in jigsaw-mode on JDK 11. [Issue #1806](https://github.com/rzwitserloot/lombok/issues/1806) +* BUGFIX: Fix NetBeans compile on save. [Issue #1770](https://github.com/rzwitserloot/lombok/issues/1770) ### v1.18.2 (July 26th, 2018) * BUGFIX: mapstruct + lombok in eclipse should hopefully work again. [Issue #1359](https://github.com/rzwitserloot/lombok/issues/1359) and [mapstruct issue #1159](https://github.com/mapstruct/mapstruct/issues/1159) diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 00000000..334e7acc --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,4 @@ +jdk: +- openjdk9 +before_install: +- export JAVA_HOME=/usr/lib/jvm/java-9-oracle diff --git a/src/core/lombok/core/AST.java b/src/core/lombok/core/AST.java index 1142018f..fe7a4330 100644 --- a/src/core/lombok/core/AST.java +++ b/src/core/lombok/core/AST.java @@ -216,19 +216,19 @@ public abstract class AST<A extends AST<A, L, N>, L extends LombokNode<A, L, N>, } } - private static final ConcurrentMap<Class<?>, Collection<FieldAccess>> fieldsOfASTClasses = new ConcurrentHashMap<Class<?>, Collection<FieldAccess>>(); + private static final ConcurrentMap<Class<?>, FieldAccess[]> fieldsOfASTClasses = new ConcurrentHashMap<Class<?>, FieldAccess[]>(); /** Returns FieldAccess objects for the stated class. Each field that contains objects of the kind returned by * {@link #getStatementTypes()}, either directly or inside of an array or java.util.collection (or array-of-arrays, * or collection-of-collections, et cetera), is returned. */ - protected Collection<FieldAccess> fieldsOf(Class<?> c) { - Collection<FieldAccess> fields = fieldsOfASTClasses.get(c); + protected FieldAccess[] fieldsOf(Class<?> c) { + FieldAccess[] fields = fieldsOfASTClasses.get(c); if (fields != null) return fields; - fields = new ArrayList<FieldAccess>(); - getFields(c, fields); - fieldsOfASTClasses.putIfAbsent(c, fields); + List<FieldAccess> fieldList = new ArrayList<FieldAccess>(); + getFields(c, fieldList); + fieldsOfASTClasses.putIfAbsent(c, fieldList.toArray(new FieldAccess[fieldList.size()])); return fieldsOfASTClasses.get(c); } diff --git a/src/core/lombok/core/AnnotationProcessor.java b/src/core/lombok/core/AnnotationProcessor.java index 89dfa555..293bfef6 100644 --- a/src/core/lombok/core/AnnotationProcessor.java +++ b/src/core/lombok/core/AnnotationProcessor.java @@ -72,15 +72,7 @@ public class AnnotationProcessor extends AbstractProcessor { * the delegate ProcessingEnvironment of the gradle wrapper is returned. */ public static ProcessingEnvironment getJavacProcessingEnvironment(ProcessingEnvironment procEnv, List<String> delayedWarnings) { - ProcessingEnvironment javacProcEnv = tryRecursivelyObtainJavacProcessingEnvironment(procEnv); - - if (javacProcEnv == null) { - if (!procEnv.getClass().getName().startsWith("org.eclipse.jdt.")) { - delayedWarnings.add("Can't get the delegate of the gradle IncrementalProcessingEnvironment."); - } - } - - return javacProcEnv; + return tryRecursivelyObtainJavacProcessingEnvironment(procEnv); } private static ProcessingEnvironment tryRecursivelyObtainJavacProcessingEnvironment(ProcessingEnvironment procEnv) { @@ -111,6 +103,9 @@ public class AnnotationProcessor extends AbstractProcessor { } @Override boolean want(ProcessingEnvironment procEnv, List<String> delayedWarnings) { + // do not run on ECJ as it may print warnings + if (procEnv.getClass().getName().startsWith("org.eclipse.jdt.")) return false; + ProcessingEnvironment javacProcEnv = getJavacProcessingEnvironment(procEnv, delayedWarnings); if (javacProcEnv == null) return false; @@ -210,7 +205,7 @@ public class AnnotationProcessor extends AbstractProcessor { for (TypeElement elem : annotations) { zeroElems = false; Name n = elem.getQualifiedName(); - if (n.length() > 7 && n.subSequence(0, 7).toString().equals("lombok.")) continue; + if (n.toString().startsWith("lombok.")) continue; onlyLombok = false; } diff --git a/src/core/lombok/core/LombokInternalAliasing.java b/src/core/lombok/core/LombokInternalAliasing.java index 3dc1bfa2..c1089580 100644 --- a/src/core/lombok/core/LombokInternalAliasing.java +++ b/src/core/lombok/core/LombokInternalAliasing.java @@ -36,10 +36,8 @@ public class LombokInternalAliasing { */ public static String processAliases(String in) { if (in == null) return null; - for (Map.Entry<String, String> e : ALIASES.entrySet()) { - if (in.equals(e.getKey())) return e.getValue(); - } - return in; + String ret = ALIASES.get(in); + return ret == null ? in : ret; } static { diff --git a/src/core/lombok/core/LombokNode.java b/src/core/lombok/core/LombokNode.java index d6708956..5a0842bc 100644 --- a/src/core/lombok/core/LombokNode.java +++ b/src/core/lombok/core/LombokNode.java @@ -40,7 +40,6 @@ import lombok.core.AST.Kind; * For example, JCTree for javac, and ASTNode for Eclipse. */ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A, L, N>, N> implements DiagnosticsReceiver { - protected final A ast; protected final Kind kind; protected final N node; protected LombokImmutableList<L> children; @@ -59,8 +58,7 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A, * @param kind The kind of node represented by this object. */ @SuppressWarnings("unchecked") - protected LombokNode(A ast, N node, List<L> children, Kind kind) { - this.ast = ast; + protected LombokNode(N node, List<L> children, Kind kind) { this.kind = kind; this.node = node; this.children = children != null ? LombokImmutableList.copyOf(children) : LombokImmutableList.<L>of(); @@ -72,9 +70,7 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A, this.isStructurallySignificant = calculateIsStructurallySignificant(null); } - public A getAst() { - return ast; - } + public abstract A getAst(); /** {@inheritDoc} */ @Override public String toString() { @@ -88,7 +84,7 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A, * @see AST#getPackageDeclaration() */ public String getPackageDeclaration() { - return ast.getPackageDeclaration(); + return getAst().getPackageDeclaration(); } /** @@ -97,7 +93,7 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A, * @see AST#getImportList() */ public ImportList getImportList() { - return ast.getImportList(); + return getAst().getImportList(); } /** @@ -111,7 +107,7 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A, * @see AST#get(Object) */ public L getNodeFor(N obj) { - return ast.get(obj); + return getAst().get(obj); } /** @@ -187,7 +183,7 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A, * @see AST#getLatestJavaSpecSupported() */ public int getLatestJavaSpecSupported() { - return ast.getLatestJavaSpecSupported(); + return getAst().getLatestJavaSpecSupported(); } /** @@ -196,7 +192,7 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A, * @see AST#getSourceVersion() */ public int getSourceVersion() { - return ast.getSourceVersion(); + return getAst().getSourceVersion(); } /** @@ -205,7 +201,7 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A, * @see AST#top() */ public L top() { - return ast.top(); + return getAst().top(); } /** @@ -214,7 +210,7 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A, * @see AST#getFileName() */ public String getFileName() { - return ast.getFileName(); + return getAst().getFileName(); } /** @@ -224,8 +220,8 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A, */ @SuppressWarnings({"unchecked"}) public L add(N newChild, Kind newChildKind) { - ast.setChanged(); - L n = ast.buildTree(newChild, newChildKind); + getAst().setChanged(); + L n = getAst().buildTree(newChild, newChildKind); if (n == null) return null; n.parent = (L) this; children = children.append(n); @@ -242,20 +238,20 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A, Map<N, L> oldNodes = new IdentityHashMap<N, L>(); gatherAndRemoveChildren(oldNodes); - L newNode = ast.buildTree(get(), kind); + L newNode = getAst().buildTree(get(), kind); - ast.setChanged(); + getAst().setChanged(); - ast.replaceNewWithExistingOld(oldNodes, newNode); + getAst().replaceNewWithExistingOld(oldNodes, newNode); } @SuppressWarnings({"unchecked", "rawtypes"}) private void gatherAndRemoveChildren(Map<N, L> map) { for (LombokNode child : children) child.gatherAndRemoveChildren(map); - ast.identityDetector.remove(get()); + getAst().identityDetector.remove(get()); map.put(get(), (L) this); children = LombokImmutableList.of(); - ast.getNodeMap().remove(get()); + getAst().getNodeMap().remove(get()); } /** @@ -264,7 +260,7 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A, * Does not change the underlying (javac/Eclipse) AST, only the wrapped view. */ public void removeChild(L child) { - ast.setChanged(); + getAst().setChanged(); children = children.removeElement(child); } diff --git a/src/core/lombok/core/configuration/StringConfigurationSource.java b/src/core/lombok/core/configuration/StringConfigurationSource.java index dd2f0319..abf6eea0 100644 --- a/src/core/lombok/core/configuration/StringConfigurationSource.java +++ b/src/core/lombok/core/configuration/StringConfigurationSource.java @@ -67,7 +67,6 @@ public class StringConfigurationSource implements ConfigurationSource { list.add(new ListModification(value, add)); } }); - return new StringConfigurationSource(values); } diff --git a/src/core/lombok/eclipse/EclipseASTAdapter.java b/src/core/lombok/eclipse/EclipseASTAdapter.java index 2a78c270..61807fff 100644 --- a/src/core/lombok/eclipse/EclipseASTAdapter.java +++ b/src/core/lombok/eclipse/EclipseASTAdapter.java @@ -36,6 +36,9 @@ import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; * has been implemented with an empty body. Override whichever methods you need. */ public abstract class EclipseASTAdapter implements EclipseASTVisitor { + + private final boolean deferUntilPostDiet = getClass().isAnnotationPresent(DeferUntilPostDiet.class); + /** {@inheritDoc} */ public void visitCompilationUnit(EclipseNode top, CompilationUnitDeclaration unit) {} @@ -98,4 +101,8 @@ public abstract class EclipseASTAdapter implements EclipseASTVisitor { /** {@inheritDoc} */ public void endVisitStatement(EclipseNode statementNode, Statement statement) {} + + public boolean isDeferUntilPostDiet() { + return deferUntilPostDiet ; + } } diff --git a/src/core/lombok/eclipse/EclipseASTVisitor.java b/src/core/lombok/eclipse/EclipseASTVisitor.java index 63557f41..b2fd4b2f 100644 --- a/src/core/lombok/eclipse/EclipseASTVisitor.java +++ b/src/core/lombok/eclipse/EclipseASTVisitor.java @@ -416,5 +416,11 @@ public interface EclipseASTVisitor { int end = node.get().sourceEnd(); return String.format(" [%d, %d]", start, end); } + + public boolean isDeferUntilPostDiet() { + return false; + } } + + boolean isDeferUntilPostDiet(); } diff --git a/src/core/lombok/eclipse/EclipseNode.java b/src/core/lombok/eclipse/EclipseNode.java index 4db1d38d..1738c770 100644 --- a/src/core/lombok/eclipse/EclipseNode.java +++ b/src/core/lombok/eclipse/EclipseNode.java @@ -44,16 +44,22 @@ import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; * Eclipse specific version of the LombokNode class. */ public class EclipseNode extends lombok.core.LombokNode<EclipseAST, EclipseNode, ASTNode> { + private EclipseAST ast; /** {@inheritDoc} */ EclipseNode(EclipseAST ast, ASTNode node, List<EclipseNode> children, Kind kind) { - super(ast, node, children, kind); + super(node, children, kind); + this.ast = ast; } + @Override + public EclipseAST getAst() { + return ast; + } /** * Visits this node and all child nodes depth-first, calling the provided visitor's visit methods. */ public void traverse(EclipseASTVisitor visitor) { - if (!this.isCompleteParse() && visitor.getClass().isAnnotationPresent(DeferUntilPostDiet.class)) return; + if (visitor.isDeferUntilPostDiet() && !isCompleteParse()) return; switch (getKind()) { case COMPILATION_UNIT: diff --git a/src/core/lombok/eclipse/HandlerLibrary.java b/src/core/lombok/eclipse/HandlerLibrary.java index 07c6f97b..0e72fb38 100644 --- a/src/core/lombok/eclipse/HandlerLibrary.java +++ b/src/core/lombok/eclipse/HandlerLibrary.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2014 The Project Lombok Authors. + * Copyright (C) 2009-2018 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -212,21 +212,25 @@ public class HandlerLibrary { * @param ast The Compilation Unit that contains the Annotation AST Node. * @param annotationNode The Lombok AST Node representing the Annotation AST Node. * @param annotation 'node.get()' - convenience parameter. + * @param priority current prioritiy + * @return the priority we want to run - MAX_VALUE means never */ - public void handleAnnotation(CompilationUnitDeclaration ast, EclipseNode annotationNode, org.eclipse.jdt.internal.compiler.ast.Annotation annotation, long priority) { + public long handleAnnotation(CompilationUnitDeclaration ast, EclipseNode annotationNode, org.eclipse.jdt.internal.compiler.ast.Annotation annotation, long priority) { TypeResolver resolver = new TypeResolver(annotationNode.getImportList()); TypeReference rawType = annotation.type; - if (rawType == null) return; + if (rawType == null) return Long.MAX_VALUE; String fqn = resolver.typeRefToFullyQualifiedName(annotationNode, typeLibrary, toQualifiedName(annotation.type.getTypeName())); - if (fqn == null) return; + if (fqn == null) return Long.MAX_VALUE; AnnotationHandlerContainer<?> container = annotationHandlers.get(fqn); - if (container == null) return; - if (priority != container.getPriority()) return; + if (container == null) return Long.MAX_VALUE; + + if (priority < container.getPriority()) return container.getPriority(); // we want to run at this priority + if (priority > container.getPriority()) return Long.MAX_VALUE; // it's over- we do not want to run again if (!annotationNode.isCompleteParse() && container.deferUntilPostDiet()) { if (needsHandling(annotation)) container.preHandle(annotation, annotationNode); - return; + return Long.MAX_VALUE; } try { @@ -236,13 +240,16 @@ public class HandlerLibrary { } catch (Throwable t) { error(ast, String.format("Lombok annotation handler %s failed", container.handler.getClass()), t); } + return Long.MAX_VALUE; } /** * Will call all registered {@link EclipseASTVisitor} instances. */ - public void callASTVisitors(EclipseAST ast, long priority, boolean isCompleteParse) { + public long callASTVisitors(EclipseAST ast, long priority, boolean isCompleteParse) { + long nearestPriority = Long.MAX_VALUE; for (VisitorContainer container : visitorHandlers) { + if (priority < container.getPriority()) nearestPriority = Math.min(container.getPriority(), nearestPriority); if (!isCompleteParse && container.deferUntilPostDiet()) continue; if (priority != container.getPriority()) continue; try { @@ -252,5 +259,6 @@ public class HandlerLibrary { String.format("Lombok visitor handler %s failed", container.visitor.getClass()), t); } } + return nearestPriority; } } diff --git a/src/core/lombok/eclipse/TransformEclipseAST.java b/src/core/lombok/eclipse/TransformEclipseAST.java index 541924ad..323fc171 100644 --- a/src/core/lombok/eclipse/TransformEclipseAST.java +++ b/src/core/lombok/eclipse/TransformEclipseAST.java @@ -186,42 +186,54 @@ public class TransformEclipseAST { * then handles any PrintASTs. */ public void go() { + long nextPriority = Long.MIN_VALUE; for (Long d : handlers.getPriorities()) { - ast.traverse(new AnnotationVisitor(d)); - handlers.callASTVisitors(ast, d, ast.isCompleteParse()); + if (nextPriority > d) continue; + AnnotationVisitor visitor = new AnnotationVisitor(d); + ast.traverse(visitor); + // if no visitor interested for this AST, nextPriority would be MAX_VALUE and we bail out immediatetly + nextPriority = visitor.getNextPriority(); + nextPriority = Math.min(nextPriority, handlers.callASTVisitors(ast, d, ast.isCompleteParse())); } } private static class AnnotationVisitor extends EclipseASTAdapter { private final long priority; + // this is the next priority we continue to visit. + // Long.MAX_VALUE means never. Each visit method will potentially reduce the next priority + private long nextPriority = Long.MAX_VALUE; public AnnotationVisitor(long priority) { this.priority = priority; } + public long getNextPriority() { + return nextPriority; + } + @Override public void visitAnnotationOnField(FieldDeclaration field, EclipseNode annotationNode, Annotation annotation) { CompilationUnitDeclaration top = (CompilationUnitDeclaration) annotationNode.top().get(); - handlers.handleAnnotation(top, annotationNode, annotation, priority); + nextPriority = Math.min(nextPriority, handlers.handleAnnotation(top, annotationNode, annotation, priority)); } @Override public void visitAnnotationOnMethodArgument(Argument arg, AbstractMethodDeclaration method, EclipseNode annotationNode, Annotation annotation) { CompilationUnitDeclaration top = (CompilationUnitDeclaration) annotationNode.top().get(); - handlers.handleAnnotation(top, annotationNode, annotation, priority); + nextPriority = Math.min(nextPriority, handlers.handleAnnotation(top, annotationNode, annotation, priority)); } @Override public void visitAnnotationOnLocal(LocalDeclaration local, EclipseNode annotationNode, Annotation annotation) { CompilationUnitDeclaration top = (CompilationUnitDeclaration) annotationNode.top().get(); - handlers.handleAnnotation(top, annotationNode, annotation, priority); + nextPriority = Math.min(nextPriority, handlers.handleAnnotation(top, annotationNode, annotation, priority)); } @Override public void visitAnnotationOnMethod(AbstractMethodDeclaration method, EclipseNode annotationNode, Annotation annotation) { CompilationUnitDeclaration top = (CompilationUnitDeclaration) annotationNode.top().get(); - handlers.handleAnnotation(top, annotationNode, annotation, priority); + nextPriority = Math.min(nextPriority, handlers.handleAnnotation(top, annotationNode, annotation, priority)); } @Override public void visitAnnotationOnType(TypeDeclaration type, EclipseNode annotationNode, Annotation annotation) { CompilationUnitDeclaration top = (CompilationUnitDeclaration) annotationNode.top().get(); - handlers.handleAnnotation(top, annotationNode, annotation, priority); + nextPriority = Math.min(nextPriority, handlers.handleAnnotation(top, annotationNode, annotation, priority)); } } } diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index 2dce285c..87df6d1b 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -24,6 +24,7 @@ package lombok.eclipse.handlers; import static lombok.core.handlers.HandlerUtil.*; import static lombok.eclipse.Eclipse.*; import static lombok.eclipse.EclipseAugments.*; +import static lombok.eclipse.handlers.EclipseHandlerUtil.setGeneratedBy; import java. |
