diff options
-rw-r--r-- | src/core/lombok/javac/handlers/HandleStandardException.java | 5 | ||||
-rw-r--r-- | src/utils/lombok/javac/Javac.java | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/core/lombok/javac/handlers/HandleStandardException.java b/src/core/lombok/javac/handlers/HandleStandardException.java index 334f85ca..dd764233 100644 --- a/src/core/lombok/javac/handlers/HandleStandardException.java +++ b/src/core/lombok/javac/handlers/HandleStandardException.java @@ -33,6 +33,7 @@ import lombok.experimental.StandardException; import lombok.core.AST.Kind; import lombok.core.AnnotationValues; import lombok.delombok.LombokOptionsFactory; +import lombok.javac.Javac; import lombok.javac.JavacAnnotationHandler; import lombok.javac.JavacNode; import lombok.javac.JavacTreeMaker; @@ -57,8 +58,8 @@ public class HandleStandardException extends JavacAnnotationHandler<StandardExce return; } - JCClassDecl classDef = (JCClassDecl) typeNode.get(); - if (classDef.extending == null) { + JCTree extending = Javac.getExtendsClause((JCClassDecl) typeNode.get()); + if (extending == null) { annotationNode.addError("@StandardException requires that you extend a Throwable type"); return; } diff --git a/src/utils/lombok/javac/Javac.java b/src/utils/lombok/javac/Javac.java index c0bda93c..d9fcc4f2 100644 --- a/src/utils/lombok/javac/Javac.java +++ b/src/utils/lombok/javac/Javac.java @@ -260,6 +260,9 @@ public class Javac { } } + /** + * In some versions, the field's type is {@code JCTree}, in others it is {@code JCExpression}, which at the JVM level are not the same. + */ public static JCTree getExtendsClause(JCClassDecl decl) { try { return (JCTree) getExtendsClause.invoke(decl); |