diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | 10 | ||||
-rw-r--r-- | src/core/lombok/javac/handlers/JavacHandlerUtil.java | 10 |
2 files changed, 2 insertions, 18 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index cda31e2c..072b6df2 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -2774,15 +2774,7 @@ public class EclipseHandlerUtil { * Returns {@code true} if the provided node supports static methods and types (top level or static class) */ public static boolean isStaticAllowed(EclipseNode typeNode) { - boolean staticAllowed = true; - - while (typeNode.getKind() != Kind.COMPILATION_UNIT) { - if (!staticAllowed) return false; - - staticAllowed = typeNode.isStatic(); - typeNode = typeNode.up(); - } - return true; + return typeNode.isStatic() || typeNode.up() == null || typeNode.up().getKind() == Kind.COMPILATION_UNIT || isRecord(typeNode); } public static AbstractVariableDeclaration[] getRecordComponents(TypeDeclaration typeDeclaration) { diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index 53a518b4..b17e34d8 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -2096,15 +2096,7 @@ public class JavacHandlerUtil { * Returns {@code true} if the provided node supports static methods and types (top level or static class) */ public static boolean isStaticAllowed(JavacNode typeNode) { - boolean staticAllowed = true; - - while (typeNode.getKind() != Kind.COMPILATION_UNIT) { - if (!staticAllowed) return false; - - staticAllowed = typeNode.isStatic(); - typeNode = typeNode.up(); - } - return true; + return typeNode.isStatic() || typeNode.up() == null || typeNode.up().getKind() == Kind.COMPILATION_UNIT || isRecord(typeNode); } public static JavacNode upToTypeNode(JavacNode node) { |