From 7af752602af4cab91bb6929c9a9b4d93babd629c Mon Sep 17 00:00:00 2001 From: Rawi01 Date: Sun, 30 Jan 2022 00:22:36 +0100 Subject: [fixes #3097] Update inner class type when creating a static class --- src/core/lombok/javac/handlers/HandleUtilityClass.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/core/lombok/javac/handlers/HandleUtilityClass.java b/src/core/lombok/javac/handlers/HandleUtilityClass.java index 6fa630e2..716d6d63 100644 --- a/src/core/lombok/javac/handlers/HandleUtilityClass.java +++ b/src/core/lombok/javac/handlers/HandleUtilityClass.java @@ -25,6 +25,9 @@ import static lombok.core.handlers.HandlerUtil.handleExperimentalFlagUsage; import static lombok.javac.handlers.JavacHandlerUtil.*; import com.sun.tools.javac.code.Flags; +import com.sun.tools.javac.code.Symbol.ClassSymbol; +import com.sun.tools.javac.code.Type; +import com.sun.tools.javac.code.Type.ClassType; import com.sun.tools.javac.tree.JCTree.JCAnnotation; import com.sun.tools.javac.tree.JCTree.JCBlock; import com.sun.tools.javac.tree.JCTree.JCClassDecl; @@ -124,6 +127,10 @@ public class HandleUtilityClass extends JavacAnnotationHandler { } else if (element.getKind() == Kind.TYPE) { JCClassDecl innerClassDecl = (JCClassDecl) element.get(); innerClassDecl.mods.flags |= Flags.STATIC; + ClassSymbol innerClassSymbol = innerClassDecl.sym; + if (innerClassSymbol != null && innerClassSymbol.type instanceof ClassType) { + ((ClassType) innerClassSymbol.type).setEnclosingType(Type.noType); + } } } -- cgit