mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 20:15:09 +00:00
[StandardExceptions] fix for javac
This commit is contained in:
2 files changed
+6
-2
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user