diff options
author | unknown <Roels@.tis.local> | 2009-10-18 15:12:41 +0200 |
---|---|---|
committer | unknown <Roels@.tis.local> | 2009-10-18 15:12:41 +0200 |
commit | 1b0d0ff5ad539f34fc27a8a27621b3f8d6d982b7 (patch) | |
tree | 41c3f687db56c92610f0687d3466ab573a02d573 /src/lombok/javac | |
parent | 4bf8ee3f67f7c076421b6c6a396c85e7bd794749 (diff) | |
download | lombok-1b0d0ff5ad539f34fc27a8a27621b3f8d6d982b7.tar.gz lombok-1b0d0ff5ad539f34fc27a8a27621b3f8d6d982b7.tar.bz2 lombok-1b0d0ff5ad539f34fc27a8a27621b3f8d6d982b7.zip |
Configured warnings and solved some.
Diffstat (limited to 'src/lombok/javac')
-rw-r--r-- | src/lombok/javac/JavacAST.java | 19 | ||||
-rw-r--r-- | src/lombok/javac/JavacNode.java | 10 | ||||
-rw-r--r-- | src/lombok/javac/apt/Processor.java | 14 |
3 files changed, 21 insertions, 22 deletions
diff --git a/src/lombok/javac/JavacAST.java b/src/lombok/javac/JavacAST.java index eea1bad9..77e365ee 100644 --- a/src/lombok/javac/JavacAST.java +++ b/src/lombok/javac/JavacAST.java @@ -251,6 +251,7 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> { } /** For javac, both JCExpression and JCStatement are considered as valid children types. */ + @Override protected Collection<Class<? extends JCTree>> getStatementTypes() { Collection<Class<? extends JCTree>> collection = new ArrayList<Class<? extends JCTree>>(2); collection.add(JCStatement.class); @@ -305,11 +306,9 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> { com.sun.tools.javac.util.List<?> oldL = (com.sun.tools.javac.util.List<?>) current; com.sun.tools.javac.util.List<?> newL = replaceInConsList(oldL, oldO, newO); if (chain.isEmpty()) return newL; - else { - List<Collection<?>> reducedChain = new ArrayList<Collection<?>>(chain); - Collection<?> newCurrent = reducedChain.remove(reducedChain.size() -1); - return setElementInConsList(reducedChain, newCurrent, oldL, newL); - } + List<Collection<?>> reducedChain = new ArrayList<Collection<?>>(chain); + Collection<?> newCurrent = reducedChain.remove(reducedChain.size() -1); + return setElementInConsList(reducedChain, newCurrent, oldL, newL); } private com.sun.tools.javac.util.List<?> replaceInConsList(com.sun.tools.javac.util.List<?> oldL, Object oldO, Object newO) { @@ -323,16 +322,16 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> { } if (repl) return com.sun.tools.javac.util.List.<Object>from(a); - else return oldL; + return oldL; } - private void increaseErrorCount(Messager messager) { + private void increaseErrorCount(Messager m) { try { - Field f = messager.getClass().getDeclaredField("errorCount"); + Field f = m.getClass().getDeclaredField("errorCount"); f.setAccessible(true); if (f.getType() == int.class) { - int val = ((Number)f.get(messager)).intValue(); - f.set(messager, val +1); + int val = ((Number)f.get(m)).intValue(); + f.set(m, val +1); } } catch (Throwable t) { //Very unfortunate, but in most cases it still works fine, so we'll silently swallow it. diff --git a/src/lombok/javac/JavacNode.java b/src/lombok/javac/JavacNode.java index 004aff19..46e06579 100644 --- a/src/lombok/javac/JavacNode.java +++ b/src/lombok/javac/JavacNode.java @@ -81,10 +81,10 @@ public class JavacNode extends lombok.core.LombokNode<JavacAST, JavacNode, JCTre visitor.endVisitInitializer(this, (JCBlock)get()); break; case ARGUMENT: - JCMethodDecl parent = (JCMethodDecl) up().get(); - visitor.visitMethodArgument(this, (JCVariableDecl)get(), parent); + JCMethodDecl parentMethod = (JCMethodDecl) up().get(); + visitor.visitMethodArgument(this, (JCVariableDecl)get(), parentMethod); ast.traverseChildren(visitor, this); - visitor.endVisitMethodArgument(this, (JCVariableDecl)get(), parent); + visitor.endVisitMethodArgument(this, (JCVariableDecl)get(), parentMethod); break; case LOCAL: visitor.visitLocal(this, (JCVariableDecl)get()); @@ -175,7 +175,7 @@ public class JavacNode extends lombok.core.LombokNode<JavacAST, JavacNode, JCTre /** * Generates an compiler error focused on the AST node represented by this node object. */ - public void addError(String message) { + @Override public void addError(String message) { ast.printMessage(Diagnostic.Kind.ERROR, message, this, null); } @@ -189,7 +189,7 @@ public class JavacNode extends lombok.core.LombokNode<JavacAST, JavacNode, JCTre /** * Generates a compiler warning focused on the AST node represented by this node object. */ - public void addWarning(String message) { + @Override public void addWarning(String message) { ast.printMessage(Diagnostic.Kind.WARNING, message, this, null); } diff --git a/src/lombok/javac/apt/Processor.java b/src/lombok/javac/apt/Processor.java index 0c187f4b..9f3951bb 100644 --- a/src/lombok/javac/apt/Processor.java +++ b/src/lombok/javac/apt/Processor.java @@ -69,15 +69,15 @@ public class Processor extends AbstractProcessor { private Trees trees; /** {@inheritDoc} */ - @Override public void init(ProcessingEnvironment processingEnv) { - super.init(processingEnv); - if (!(processingEnv instanceof JavacProcessingEnvironment)) { - processingEnv.getMessager().printMessage(Kind.WARNING, "You aren't using a compiler based around javac v1.6, so lombok will not work properly."); + @Override public void init(ProcessingEnvironment procEnv) { + super.init(procEnv); + if (!(procEnv instanceof JavacProcessingEnvironment)) { + procEnv.getMessager().printMessage(Kind.WARNING, "You aren't using a compiler based around javac v1.6, so lombok will not work properly."); this.processingEnv = null; } else { - this.processingEnv = (JavacProcessingEnvironment) processingEnv; - handlers = HandlerLibrary.load(processingEnv.getMessager()); - trees = Trees.instance(processingEnv); + this.processingEnv = (JavacProcessingEnvironment) procEnv; + handlers = HandlerLibrary.load(procEnv.getMessager()); + trees = Trees.instance(procEnv); } } |