aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac/handlers/JavacHandlerUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lombok/javac/handlers/JavacHandlerUtil.java')
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index 79436327..3e734f8b 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -392,13 +392,26 @@ public class JavacHandlerUtil {
/**
* Adds the given new field declaration to the provided type AST Node.
+ * The field carries the @{@link SuppressWarnings}("all") annotation.
+ * Also takes care of updating the JavacAST.
+ */
+ public static void injectFieldSuppressWarnings(JavacNode typeNode, JCVariableDecl field) {
+ injectField(typeNode, field, true);
+ }
+
+ /**
+ * Adds the given new field declaration to the provided type AST Node.
*
* Also takes care of updating the JavacAST.
*/
public static void injectField(JavacNode typeNode, JCVariableDecl field) {
+ injectField(typeNode, field, false);
+ }
+
+ private static void injectField(JavacNode typeNode, JCVariableDecl field, boolean addSuppressWarnings) {
JCClassDecl type = (JCClassDecl) typeNode.get();
- addSuppressWarningsAll(field.mods, typeNode, field.pos);
+ if (addSuppressWarnings) addSuppressWarningsAll(field.mods, typeNode, field.pos);
type.defs = type.defs.append(field);
typeNode.add(field, Kind.FIELD).recursiveSetHandled();