aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-10-16 11:14:56 +0200
committerReinier Zwitserloot <reinier@tipit.to>2009-10-16 11:52:21 +0200
commitfdcdcc89d8ac081cb214aab6bb70f9d75101e865 (patch)
treee3841cf59f1f88465c2bf3751d81090eba8f38ff
parent2d3b98e847b9dc1878b657de97fce2f54104776d (diff)
downloadlombok-fdcdcc89d8ac081cb214aab6bb70f9d75101e865.tar.gz
lombok-fdcdcc89d8ac081cb214aab6bb70f9d75101e865.tar.bz2
lombok-fdcdcc89d8ac081cb214aab6bb70f9d75101e865.zip
Fixes issue #56 - annotations with shorthand parameters on methods in method-local classes failed to parse correctly due to a (rare) boneheaded design in the javac tree.
Also had a bunch of code in doing raw introspection of the Annotation ASTNode. It wasn't doing anything other than causing bugs and cluttering the code. Removed it.
-rw-r--r--src/lombok/core/AnnotationValues.java6
-rw-r--r--src/lombok/javac/handlers/HandleSneakyThrows.java13
2 files changed, 4 insertions, 15 deletions
diff --git a/src/lombok/core/AnnotationValues.java b/src/lombok/core/AnnotationValues.java
index fe16a395..8912ccd8 100644
--- a/src/lombok/core/AnnotationValues.java
+++ b/src/lombok/core/AnnotationValues.java
@@ -33,6 +33,8 @@ import java.util.Map;
/**
* Represents a single annotation in a source file and can be used to query the parameters present on it.
+ *
+ * @param A The annotation that this class represents, such as {@code lombok.Getter}
*/
public class AnnotationValues<A extends Annotation> {
private final Class<A> type;
@@ -295,9 +297,9 @@ public class AnnotationValues<A extends Annotation> {
}
/**
- * Returns the raw expressions used for the provided annotationMethodName.
+ * Returns the raw expressions used for the provided {@code annotationMethodName}.
*
- * You should use this method for annotation methods that return Class objects. Remember that
+ * You should use this method for annotation methods that return {@code Class} objects. Remember that
* class literals end in ".class" which you probably want to strip off.
*/
public List<String> getRawExpressions(String annotationMethodName) {
diff --git a/src/lombok/javac/handlers/HandleSneakyThrows.java b/src/lombok/javac/handlers/HandleSneakyThrows.java
index a9cfc7a2..167737f9 100644
--- a/src/lombok/javac/handlers/HandleSneakyThrows.java
+++ b/src/lombok/javac/handlers/HandleSneakyThrows.java
@@ -36,11 +36,9 @@ 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;
import com.sun.tools.javac.tree.JCTree.JCExpression;
import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
-import com.sun.tools.javac.tree.JCTree.JCNewArray;
import com.sun.tools.javac.tree.JCTree.JCStatement;
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.util.List;
@@ -56,17 +54,6 @@ public class HandleSneakyThrows implements JavacAnnotationHandler<SneakyThrows>
List<JCExpression> memberValuePairs = ast.getArguments();
if (memberValuePairs == null || memberValuePairs.size() == 0) return false;
- JCExpression arrayOrSingle = ((JCAssign)memberValuePairs.get(0)).rhs;
- final List<JCExpression> exceptionNameNodes;
- if (arrayOrSingle instanceof JCNewArray) {
- exceptionNameNodes = ((JCNewArray)arrayOrSingle).elems;
- } else exceptionNameNodes = List.of(arrayOrSingle);
-
- if (exceptionNames.size() != exceptionNameNodes.size()) {
- annotationNode.addError(
- "LOMBOK BUG: The number of exception classes in the annotation isn't the same pre- and post- guessing.");
- }
-
java.util.List<String> exceptions = new ArrayList<String>();
for (String exception : exceptionNames) {
if (exception.endsWith(".class")) exception = exception.substring(0, exception.length() - 6);