diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-08-13 15:04:43 +0200 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-08-22 22:42:48 +0200 |
commit | 15df143df6d35dd64459d717a451a039eb26d761 (patch) | |
tree | 70fc0be372fd02491f9c5e9d7d68ffe7901da6d8 /src/core/lombok/javac/handlers/JavacHandlerUtil.java | |
parent | ff1c01d9e9e66d898c30939b497490b04fe6163c (diff) | |
download | lombok-15df143df6d35dd64459d717a451a039eb26d761.tar.gz lombok-15df143df6d35dd64459d717a451a039eb26d761.tar.bz2 lombok-15df143df6d35dd64459d717a451a039eb26d761.zip |
[checkerframework]
A bit of a shadow feature because the checker framework folks need to do some work on their side.
this update makes lombok generate a few checker framework annotations (if configured to do so)
which let the checker framework add warnings and errors for example if you misuse builders, or ignore
the return values of withers, etc.
Diffstat (limited to 'src/core/lombok/javac/handlers/JavacHandlerUtil.java')
-rw-r--r-- | src/core/lombok/javac/handlers/JavacHandlerUtil.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index 5f0f39b0..f23a894a 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -93,6 +93,7 @@ import lombok.core.AnnotationValues.AnnotationValue; import lombok.core.CleanupTask; import lombok.core.LombokImmutableList; import lombok.core.TypeResolver; +import lombok.core.configuration.CheckerFrameworkVersion; import lombok.core.configuration.NullCheckExceptionType; import lombok.core.configuration.TypeName; import lombok.core.handlers.HandlerUtil; @@ -330,6 +331,11 @@ public class JavacHandlerUtil { return false; } + public static CheckerFrameworkVersion getCheckerFrameworkVersion(JavacNode node) { + CheckerFrameworkVersion cfv = node.getAst().readConfiguration(ConfigurationKeys.CHECKER_FRAMEWORK); + return cfv == null ? CheckerFrameworkVersion.NONE : cfv; + } + /** * Returns if a node is marked deprecated (as picked up on by the parser). * @param node the node to check (type, method, or field decl). @@ -1266,7 +1272,7 @@ public class JavacHandlerUtil { } } - private static void addAnnotation(JCModifiers mods, JavacNode node, int pos, JCTree source, Context context, String annotationTypeFqn, JCExpression arg) { + public static void addAnnotation(JCModifiers mods, JavacNode node, int pos, JCTree source, Context context, String annotationTypeFqn, JCExpression arg) { boolean isJavaLangBased; String simpleName; { int idx = annotationTypeFqn.lastIndexOf('.'); |