From 2eddba64f711091cb2dcf861559e9532947dff9d Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Thu, 17 Mar 2022 22:07:46 +0100 Subject: [fixes #2990] Treat records and enums as places where `static` is allowed. --- src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/core/lombok/eclipse') diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index c313cf51..93b0028d 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -2770,15 +2770,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) { -- cgit