diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2022-01-30 07:01:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-30 07:01:04 +0100 |
commit | 1ba5fe86aa21f0e3fbbabeb6e91152e89bfee2d5 (patch) | |
tree | 1b3d290890f251c27233bad0df12d7e4ee5fcc0b /src | |
parent | 87b03036e723dafe7f343fd735a447515b7e5627 (diff) | |
parent | 7af752602af4cab91bb6929c9a9b4d93babd629c (diff) | |
download | lombok-1ba5fe86aa21f0e3fbbabeb6e91152e89bfee2d5.tar.gz lombok-1ba5fe86aa21f0e3fbbabeb6e91152e89bfee2d5.tar.bz2 lombok-1ba5fe86aa21f0e3fbbabeb6e91152e89bfee2d5.zip |
Merge pull request #3101 from Rawi01/utilityclass-inner
Update inner class type when creating a static class
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleUtilityClass.java | 7 |
1 files changed, 7 insertions, 0 deletions
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<UtilityClass> { } 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); + } } } |