aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lombok')
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java13
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java8
2 files changed, 21 insertions, 0 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index 5e322c90..467ae0c3 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -1388,6 +1388,19 @@ public class EclipseHandlerUtil {
private static final char[] ALL = "all".toCharArray();
public static Annotation[] createSuppressWarningsAll(ASTNode source, Annotation[] originalAnnotationArray) {
+ if (originalAnnotationArray != null) for (Annotation ann : originalAnnotationArray) {
+ char[] lastToken = null;
+
+ if (ann.type instanceof QualifiedTypeReference) {
+ char[][] t = ((QualifiedTypeReference) ann.type).tokens;
+ lastToken = t[t.length - 1];
+ } else if (ann.type instanceof SingleTypeReference) {
+ lastToken = ((SingleTypeReference) ann.type).token;
+ }
+
+ if (lastToken != null && new String(lastToken).equals("SuppressWarnings")) return originalAnnotationArray;
+ }
+
int pS = source.sourceStart, pE = source.sourceEnd;
long p = (long)pS << 32 | pE;
long[] poss = new long[3];
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index 03c2dcff..d6d47b6c 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -918,6 +918,14 @@ public class JavacHandlerUtil {
private static void addSuppressWarningsAll(JCModifiers mods, JavacNode node, int pos, JCTree source, Context context) {
if (!LombokOptionsFactory.getDelombokOptions(context).getFormatPreferences().generateSuppressWarnings()) return;
+ for (JCAnnotation ann : mods.annotations) {
+ JCTree annType = ann.getAnnotationType();
+ Name lastPart = null;
+ if (annType instanceof JCIdent) lastPart = ((JCIdent) annType).name;
+ else if (annType instanceof JCFieldAccess) lastPart = ((JCFieldAccess) annType).name;
+
+ if (lastPart != null && lastPart.contentEquals("SuppressWarnings")) return;
+ }
JavacTreeMaker maker = node.getTreeMaker();
JCExpression suppressWarningsType = genJavaLangTypeRef(node, "SuppressWarnings");
JCLiteral allLiteral = maker.Literal("all");