diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-04-23 22:18:57 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-04-23 22:18:57 +0200 |
commit | 472d602693bdccde135ff084c44bfebd285a2101 (patch) | |
tree | 224206f6b9bd3012710882694523945aeaa29ae1 /src/core | |
parent | 44abd07764d2bd94e89a22d4569f6f97e343553d (diff) | |
download | lombok-472d602693bdccde135ff084c44bfebd285a2101.tar.gz lombok-472d602693bdccde135ff084c44bfebd285a2101.tar.bz2 lombok-472d602693bdccde135ff084c44bfebd285a2101.zip |
[bugfix] onMethod_ in javac was broken; javac would throw an IllegalArgumentException.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lombok/javac/handlers/JavacHandlerUtil.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index 1976548c..4b5c48dd 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -354,7 +354,7 @@ public class JavacHandlerUtil { } if (rhs instanceof JCNewArray) { - List<JCExpression> elems = ((JCNewArray)rhs).elems; + List<JCExpression> elems = ((JCNewArray) rhs).elems; for (JCExpression inner : elems) { raws.add(inner.toString()); expressions.add(inner); @@ -365,7 +365,7 @@ public class JavacHandlerUtil { guesses.add(createAnnotation(innerClass, (JCAnnotation) inner, node)); } catch (ClassNotFoundException ex) { - throw new IllegalStateException(ex); + guesses.add(calculateGuess(inner)); } } else { guesses.add(calculateGuess(inner)); @@ -375,7 +375,18 @@ public class JavacHandlerUtil { } else { raws.add(rhs.toString()); expressions.add(rhs); - guesses.add(calculateGuess(rhs)); + if (rhs instanceof JCAnnotation) { + try { + @SuppressWarnings("unchecked") + Class<A> innerClass = (Class<A>) Class.forName(rhs.type.toString()); + + guesses.add(createAnnotation(innerClass, (JCAnnotation) rhs, node)); + } catch (ClassNotFoundException ex) { + guesses.add(calculateGuess(rhs)); + } + } else { + guesses.add(calculateGuess(rhs)); + } positions.add(rhs.pos()); } |