aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2021-04-18 05:50:49 +0200
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2021-04-18 05:50:49 +0200
commitc4357b03bf00d7ac03e69f0dcfd4e6913a83ebb0 (patch)
treedf2caf0eb475cace8d674c0bb7bd6617e4b23fee /src
parentba9ffce89841e6fdbec7c2d234c3a70a2db7f80d (diff)
downloadlombok-c4357b03bf00d7ac03e69f0dcfd4e6913a83ebb0.tar.gz
lombok-c4357b03bf00d7ac03e69f0dcfd4e6913a83ebb0.tar.bz2
lombok-c4357b03bf00d7ac03e69f0dcfd4e6913a83ebb0.zip
[review] Use javac's internals to update type mirrors
This should help with making any annotation processors that run after lombok to 'see' the changes lombok caused properly.
Diffstat (limited to 'src')
-rw-r--r--src/core/lombok/javac/handlers/HandleStandardException.java12
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java6
-rw-r--r--src/utils/lombok/permit/Permit.java2
3 files changed, 6 insertions, 14 deletions
diff --git a/src/core/lombok/javac/handlers/HandleStandardException.java b/src/core/lombok/javac/handlers/HandleStandardException.java
index ea1a0c5c..334f85ca 100644
--- a/src/core/lombok/javac/handlers/HandleStandardException.java
+++ b/src/core/lombok/javac/handlers/HandleStandardException.java
@@ -22,7 +22,6 @@
package lombok.javac.handlers;
import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.*;
import com.sun.tools.javac.util.List;
@@ -34,7 +33,6 @@ 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;
@@ -55,7 +53,7 @@ public class HandleStandardException extends JavacAnnotationHandler<StandardExce
JavacNode typeNode = annotationNode.up();
if (!isClass(typeNode)) {
- annotationNode.addError("@StandardException is only supported on a class.");
+ annotationNode.addError("@StandardException is only supported on a class");
return;
}
@@ -85,7 +83,7 @@ public class HandleStandardException extends JavacAnnotationHandler<StandardExce
List<JCExpression> args = List.<JCExpression>of(maker.Literal(CTC_BOT, null), maker.Literal(CTC_BOT, null));
JCStatement thisCall = maker.Exec(maker.Apply(List.<JCExpression>nil(), maker.Ident(typeNode.toName("this")), args));
JCMethodDecl constr = createConstructor(level, typeNode, false, false, source, List.of(thisCall));
- injectMethod(typeNode, constr, List.<Type>nil(), Javac.createVoidType(typeNode.getSymbolTable(), CTC_VOID));
+ injectMethod(typeNode, constr);
}
private void generateMsgOnlyConstructor(JavacNode typeNode, AccessLevel level, JavacNode source) {
@@ -95,7 +93,7 @@ public class HandleStandardException extends JavacAnnotationHandler<StandardExce
List<JCExpression> args = List.<JCExpression>of(maker.Ident(typeNode.toName("message")), maker.Literal(CTC_BOT, null));
JCStatement thisCall = maker.Exec(maker.Apply(List.<JCExpression>nil(), maker.Ident(typeNode.toName("this")), args));
JCMethodDecl constr = createConstructor(level, typeNode, true, false, source, List.of(thisCall));
- injectMethod(typeNode, constr, List.<Type>of(typeNode.getSymbolTable().stringType), Javac.createVoidType(typeNode.getSymbolTable(), CTC_VOID));
+ injectMethod(typeNode, constr);
}
private void generateCauseOnlyConstructor(JavacNode typeNode, AccessLevel level, JavacNode source) {
@@ -109,7 +107,7 @@ public class HandleStandardException extends JavacAnnotationHandler<StandardExce
List<JCExpression> args = List.<JCExpression>of(msgExpression, maker.Ident(causeName));
JCStatement thisCall = maker.Exec(maker.Apply(List.<JCExpression>nil(), maker.Ident(typeNode.toName("this")), args));
JCMethodDecl constr = createConstructor(level, typeNode, false, true, source, List.of(thisCall));
- injectMethod(typeNode, constr, List.<Type>of(typeNode.getSymbolTable().throwableType), Javac.createVoidType(typeNode.getSymbolTable(), CTC_VOID));
+ injectMethod(typeNode, constr);
}
private void generateFullConstructor(JavacNode typeNode, AccessLevel level, JavacNode source) {
@@ -125,7 +123,7 @@ public class HandleStandardException extends JavacAnnotationHandler<StandardExce
JCStatement initCauseCall = maker.Exec(maker.Apply(List.<JCExpression>nil(), maker.Select(maker.Ident(superName), typeNode.toName("initCause")), List.<JCExpression>of(maker.Ident(causeName))));
JCStatement initCause = maker.If(causeNotNull, initCauseCall, null);
JCMethodDecl constr = createConstructor(level, typeNode, true, true, source, List.of(superCall, initCause));
- injectMethod(typeNode, constr, List.<Type>of(typeNode.getSymbolTable().stringType, typeNode.getSymbolTable().throwableType), Javac.createVoidType(typeNode.getSymbolTable(), CTC_VOID));
+ injectMethod(typeNode, constr);
}
private static MemberExistsResult hasConstructor(JavacNode node, Class<?>... paramTypes) {
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index fba13133..78c20d39 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -1211,12 +1211,6 @@ public class JavacHandlerUtil {
}
}
-
- @Deprecated
- public static void injectMethod(JavacNode typeNode, JCMethodDecl method, List<Type> paramTypes, Type returnType) {
- injectMethod(typeNode, method);
- }
-
/**
* Adds the given new method declaration to the provided type AST Node.
* Can also inject constructors.
diff --git a/src/utils/lombok/permit/Permit.java b/src/utils/lombok/permit/Permit.java
index 2854706e..af97a807 100644
--- a/src/utils/lombok/permit/Permit.java
+++ b/src/utils/lombok/permit/Permit.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 The Project Lombok Authors.
+ * Copyright (C) 2018-2021 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal