diff options
author | Roel Spilker <r.spilker@gmail.com> | 2010-07-25 01:49:58 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2010-07-25 01:49:58 +0200 |
commit | acb0e52bc09a66e9a5b5446c374cbc90a732762a (patch) | |
tree | b57a208be83f1624d69e500f3e15c61d3cb8f631 /src/core/lombok/javac | |
parent | 9bc463231524e634091b314376ff5a38cc5cbb51 (diff) | |
download | lombok-acb0e52bc09a66e9a5b5446c374cbc90a732762a.tar.gz lombok-acb0e52bc09a66e9a5b5446c374cbc90a732762a.tar.bz2 lombok-acb0e52bc09a66e9a5b5446c374cbc90a732762a.zip |
Do not generate @ConstructorProperties for method-local classes
Diffstat (limited to 'src/core/lombok/javac')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleConstructor.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/core/lombok/javac/handlers/HandleConstructor.java b/src/core/lombok/javac/handlers/HandleConstructor.java index e24c19d1..36deb013 100644 --- a/src/core/lombok/javac/handlers/HandleConstructor.java +++ b/src/core/lombok/javac/handlers/HandleConstructor.java @@ -26,16 +26,18 @@ import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; import lombok.RequiredArgsConstructor; -import lombok.core.AST.Kind; import lombok.core.AnnotationValues; +import lombok.core.AST.Kind; import lombok.core.handlers.TransformationsUtil; import lombok.javac.Javac; import lombok.javac.JavacAnnotationHandler; import lombok.javac.JavacNode; +import lombok.javac.handlers.JavacHandlerUtil.MemberExistsResult; import org.mangosdk.spi.ProviderFor; import com.sun.tools.javac.code.Flags; +import com.sun.tools.javac.tree.TreeMaker; import com.sun.tools.javac.tree.JCTree.JCAnnotation; import com.sun.tools.javac.tree.JCTree.JCAssign; import com.sun.tools.javac.tree.JCTree.JCBlock; @@ -50,7 +52,6 @@ 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.tree.TreeMaker; import com.sun.tools.javac.util.List; public class HandleConstructor { @@ -197,7 +198,7 @@ public class HandleConstructor { } JCModifiers mods = maker.Modifiers(toJavacModifier(level)); - if (!suppressConstructorProperties && level != AccessLevel.PRIVATE) { + if (!suppressConstructorProperties && level != AccessLevel.PRIVATE && !isLocalType(typeNode)) { addConstructorProperties(mods, typeNode, fields); } @@ -205,6 +206,13 @@ public class HandleConstructor { null, type.typarams, params, List.<JCExpression>nil(), maker.Block(0L, nullChecks.appendList(assigns)), null); } + private boolean isLocalType(JavacNode type) { + Kind kind = type.up().getKind(); + if (kind == Kind.COMPILATION_UNIT) return false; + if (kind == Kind.TYPE) return isLocalType(type.up()); + return true; + } + private JCMethodDecl createStaticConstructor(String name, AccessLevel level, JavacNode typeNode, List<JavacNode> fields) { TreeMaker maker = typeNode.getTreeMaker(); JCClassDecl type = (JCClassDecl) typeNode.get(); |