diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-03-15 03:04:03 +0100 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-03-15 03:04:03 +0100 |
commit | 3edac649118dff4a48d7218dc31a727f13537fea (patch) | |
tree | c76a8f72aa997625f3f1c409a68bb540b56578d2 /src/core/lombok/eclipse/handlers/HandleGetter.java | |
parent | 6356482555e07e1cfeb7cb5a5b31f78dfc91c34b (diff) | |
download | lombok-3edac649118dff4a48d7218dc31a727f13537fea.tar.gz lombok-3edac649118dff4a48d7218dc31a727f13537fea.tar.bz2 lombok-3edac649118dff4a48d7218dc31a727f13537fea.zip |
[fixes #2386] [checkerframework]
Now generating checkerframework `@Pure` instead of `@SideEffectFree` where appropriate.
Diffstat (limited to 'src/core/lombok/eclipse/handlers/HandleGetter.java')
-rw-r--r-- | src/core/lombok/eclipse/handlers/HandleGetter.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleGetter.java b/src/core/lombok/eclipse/handlers/HandleGetter.java index 58401ac1..30b4a699 100644 --- a/src/core/lombok/eclipse/handlers/HandleGetter.java +++ b/src/core/lombok/eclipse/handlers/HandleGetter.java @@ -270,7 +270,11 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> { /* Generate annotations that must be put on the generated method, and attach them. */ { Annotation[] deprecated = null, checkerFramework = null; if (isFieldDeprecated(fieldNode)) deprecated = new Annotation[] { generateDeprecatedAnnotation(source) }; - if (getCheckerFrameworkVersion(fieldNode).generateSideEffectFree()) checkerFramework = new Annotation[] { generateNamedAnnotation(source, CheckerFrameworkVersion.NAME__SIDE_EFFECT_FREE) }; + if (fieldNode.isFinal()) { + if (getCheckerFrameworkVersion(fieldNode).generatePure()) checkerFramework = new Annotation[] { generateNamedAnnotation(source, CheckerFrameworkVersion.NAME__PURE) }; + } else { + if (getCheckerFrameworkVersion(fieldNode).generateSideEffectFree()) checkerFramework = new Annotation[] { generateNamedAnnotation(source, CheckerFrameworkVersion.NAME__SIDE_EFFECT_FREE) }; + } method.annotations = copyAnnotations(source, onMethod.toArray(new Annotation[0]), |