aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/eclipse/EclipseNode.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/EclipseNode.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/EclipseNode.java')
-rw-r--r--src/core/lombok/eclipse/EclipseNode.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/core/lombok/eclipse/EclipseNode.java b/src/core/lombok/eclipse/EclipseNode.java
index 4c7f4eac..9db491f5 100644
--- a/src/core/lombok/eclipse/EclipseNode.java
+++ b/src/core/lombok/eclipse/EclipseNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2019 The Project Lombok Authors.
+ * Copyright (C) 2009-2020 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -248,6 +248,22 @@ public class EclipseNode extends lombok.core.LombokNode<EclipseAST, EclipseNode,
return (ClassFileConstants.AccStatic & f) != 0;
}
+ @Override public boolean isFinal() {
+ if (node instanceof FieldDeclaration) {
+ EclipseNode directUp = directUp();
+ if (directUp != null && directUp.get() instanceof TypeDeclaration) {
+ TypeDeclaration p = (TypeDeclaration) directUp.get();
+ int f = p.modifiers;
+ if (((ClassFileConstants.AccInterface | ClassFileConstants.AccEnum) & f) != 0) return true;
+ }
+ }
+
+ Integer i = getModifiers();
+ if (i == null) return false;
+ int f = i.intValue();
+ return (ClassFileConstants.AccFinal & f) != 0;
+ }
+
@Override public boolean isTransient() {
if (getKind() != Kind.FIELD) return false;
Integer i = getModifiers();