From 472d602693bdccde135ff084c44bfebd285a2101 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 23 Apr 2018 22:18:57 +0200 Subject: [bugfix] onMethod_ in javac was broken; javac would throw an IllegalArgumentException. --- src/core/lombok/javac/handlers/JavacHandlerUtil.java | 17 ++++++++++++++--- 1 file 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 elems = ((JCNewArray)rhs).elems; + List 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 innerClass = (Class) 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()); } -- cgit