aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/eclipse/handlers/HandleGetter.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-03-15 03:04:03 +0100
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-03-15 03:04:03 +0100
commit3edac649118dff4a48d7218dc31a727f13537fea (patch)
treec76a8f72aa997625f3f1c409a68bb540b56578d2 /src/core/lombok/eclipse/handlers/HandleGetter.java
parent6356482555e07e1cfeb7cb5a5b31f78dfc91c34b (diff)
downloadlombok-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.java6
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]),