From 1b0d0ff5ad539f34fc27a8a27621b3f8d6d982b7 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 18 Oct 2009 15:12:41 +0200 Subject: Configured warnings and solved some. --- src/lombok/core/AST.java | 3 +-- src/lombok/core/AnnotationValues.java | 21 +++++++++++---------- src/lombok/core/LombokNode.java | 8 ++++---- src/lombok/core/SpiLoadUtil.java | 2 +- src/lombok/eclipse/EclipseASTVisitor.java | 2 +- src/lombok/eclipse/handlers/PKG.java | 4 ++++ src/lombok/installer/Installer.java | 16 +++++++--------- src/lombok/javac/JavacAST.java | 19 +++++++++---------- src/lombok/javac/JavacNode.java | 10 +++++----- src/lombok/javac/apt/Processor.java | 14 +++++++------- 10 files changed, 50 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/lombok/core/AST.java b/src/lombok/core/AST.java index 31b8f0fd..b1b5f3be 100644 --- a/src/lombok/core/AST.java +++ b/src/lombok/core/AST.java @@ -210,9 +210,8 @@ public abstract class AST, L extends LombokNode, if (type instanceof ParameterizedType) { Type component = ((ParameterizedType)type).getActualTypeArguments()[0]; return component instanceof Class ? (Class)component : Object.class; - } else { - return Object.class; } + return Object.class; } /** diff --git a/src/lombok/core/AnnotationValues.java b/src/lombok/core/AnnotationValues.java index 8912ccd8..0408de85 100644 --- a/src/lombok/core/AnnotationValues.java +++ b/src/lombok/core/AnnotationValues.java @@ -202,18 +202,19 @@ public class AnnotationValues { Object defaultValue = method.getDefaultValue(); if (defaultValue == null) throw makeNoDefaultFail(v, method); return defaultValue; - } else return result; - } else { - if (result == null) { - if (v.valueGuesses.size() == 1) { - Object defaultValue = method.getDefaultValue(); - if (defaultValue == null) throw makeNoDefaultFail(v, method); - return defaultValue; - } else throw new AnnotationValueDecodeFail(v, - "I can't make sense of this annotation value. Try using a fully qualified literal.", idx); } - Array.set(array, idx++, result); + return result; + } + if (result == null) { + if (v.valueGuesses.size() == 1) { + Object defaultValue = method.getDefaultValue(); + if (defaultValue == null) throw makeNoDefaultFail(v, method); + return defaultValue; + } + throw new AnnotationValueDecodeFail(v, + "I can't make sense of this annotation value. Try using a fully qualified literal.", idx); } + Array.set(array, idx++, result); } return array; diff --git a/src/lombok/core/LombokNode.java b/src/lombok/core/LombokNode.java index e4712313..c8ee4c00 100644 --- a/src/lombok/core/LombokNode.java +++ b/src/lombok/core/LombokNode.java @@ -125,8 +125,8 @@ public abstract class LombokNode, L extends LombokNode, L extends LombokNode { } /** For javac, both JCExpression and JCStatement are considered as valid children types. */ + @Override protected Collection> getStatementTypes() { Collection> collection = new ArrayList>(2); collection.add(JCStatement.class); @@ -305,11 +306,9 @@ public class JavacAST extends AST { 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> reducedChain = new ArrayList>(chain); - Collection newCurrent = reducedChain.remove(reducedChain.size() -1); - return setElementInConsList(reducedChain, newCurrent, oldL, newL); - } + List> reducedChain = new ArrayList>(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 { } if (repl) return com.sun.tools.javac.util.List.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