diff options
author | Rawi01 <Rawi01@users.noreply.github.com> | 2020-06-30 17:22:38 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2020-07-02 23:15:14 +0200 |
commit | 84556ebb00af1817d521bc011333a0ed02162cc4 (patch) | |
tree | 85ffc41181c0fb576e04d1808c49e3e358883105 /src/core/lombok/eclipse | |
parent | 9425e99b49d1a203c692fd2001ff3fd3d1612303 (diff) | |
download | lombok-84556ebb00af1817d521bc011333a0ed02162cc4.tar.gz lombok-84556ebb00af1817d521bc011333a0ed02162cc4.tar.bz2 lombok-84556ebb00af1817d521bc011333a0ed02162cc4.zip |
[fixes #2433] Add config key to turn off @SuppressWarnings("all")
Diffstat (limited to 'src/core/lombok/eclipse')
-rw-r--r-- | src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | 6 | ||||
-rw-r--r-- | src/core/lombok/eclipse/handlers/HandleGetter.java | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index e674409c..de76e32d 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -1962,7 +1962,11 @@ public class EclipseHandlerUtil { private static final char[][] EDU_UMD_CS_FINDBUGS_ANNOTATIONS_SUPPRESSFBWARNINGS = Eclipse.fromQualifiedName("edu.umd.cs.findbugs.annotations.SuppressFBWarnings"); public static Annotation[] addSuppressWarningsAll(EclipseNode node, ASTNode source, Annotation[] originalAnnotationArray) { - Annotation[] anns = addAnnotation(source, originalAnnotationArray, TypeConstants.JAVA_LANG_SUPPRESSWARNINGS, new StringLiteral(ALL, 0, 0, 0)); + Annotation[] anns = originalAnnotationArray; + + if (!Boolean.FALSE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_SUPPRESSWARNINGS_ANNOTATIONS))) { + anns = addAnnotation(source, anns, TypeConstants.JAVA_LANG_SUPPRESSWARNINGS, new StringLiteral(ALL, 0, 0, 0)); + } if (Boolean.TRUE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_FINDBUGS_SUPPRESSWARNINGS_ANNOTATIONS))) { MemberValuePair mvp = new MemberValuePair(JUSTIFICATION, 0, 0, new StringLiteral(GENERATED_CODE, 0, 0, 0)); diff --git a/src/core/lombok/eclipse/handlers/HandleGetter.java b/src/core/lombok/eclipse/handlers/HandleGetter.java index 30b4a699..9cd1e2a1 100644 --- a/src/core/lombok/eclipse/handlers/HandleGetter.java +++ b/src/core/lombok/eclipse/handlers/HandleGetter.java @@ -285,10 +285,13 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> { } if (addSuppressWarningsUnchecked) { + List<Expression> suppressions = new ArrayList<Expression>(2); + if (!Boolean.FALSE.equals(fieldNode.getAst().readConfiguration(ConfigurationKeys.ADD_SUPPRESSWARNINGS_ANNOTATIONS))) { + suppressions.add(new StringLiteral(ALL, 0, 0, 0)); + } + suppressions.add(new StringLiteral(UNCHECKED, 0, 0, 0)); ArrayInitializer arr = new ArrayInitializer(); - arr.expressions = new Expression[2]; - arr.expressions[0] = new StringLiteral(ALL, 0, 0, 0); - arr.expressions[1] = new StringLiteral(UNCHECKED, 0, 0, 0); + arr.expressions = suppressions.toArray(new Expression[0]); method.annotations = addAnnotation(source, method.annotations, TypeConstants.JAVA_LANG_SUPPRESSWARNINGS, arr); } |