diff options
author | Roel Spilker <r.spilker@gmail.com> | 2021-03-19 02:48:05 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2021-03-19 02:48:16 +0100 |
commit | 2ed5077cae63cb193b4c7d1f8aa1ad3e9e6c2652 (patch) | |
tree | 3a5609b92c8c70b0626d2b47d217b7dc79624ee0 /src/core | |
parent | 420d09f99de34fc1303656aafc498bb1188b52ed (diff) | |
download | lombok-2ed5077cae63cb193b4c7d1f8aa1ad3e9e6c2652.tar.gz lombok-2ed5077cae63cb193b4c7d1f8aa1ad3e9e6c2652.tar.bz2 lombok-2ed5077cae63cb193b4c7d1f8aa1ad3e9e6c2652.zip |
[jdk16] TypeSymbol.isLocal has been renamed
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lombok/javac/JavacResolution.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/core/lombok/javac/JavacResolution.java b/src/core/lombok/javac/JavacResolution.java index 63ca69dd..e96079e0 100644 --- a/src/core/lombok/javac/JavacResolution.java +++ b/src/core/lombok/javac/JavacResolution.java @@ -71,6 +71,16 @@ public class JavacResolution { private final Attr attr; private final CompilerMessageSuppressor messageSuppressor; + private static final Method isLocal; + + static { + Method local = Permit.permissiveGetMethod(TypeSymbol.class, "isLocal"); + if (local == null) { + local = Permit.permissiveGetMethod(TypeSymbol.class, "isDirectlyOrIndirectlyLocal"); + } + isLocal = local; + } + public JavacResolution(Context context) { attr = Attr.instance(context); messageSuppressor = new CompilerMessageSuppressor(context); @@ -352,6 +362,15 @@ public class JavacResolution { return a.compareTo(b); } + private static boolean isLocalType(TypeSymbol symbol) { + try { + return (Boolean) Permit.invoke(isLocal, symbol); + } + catch (Exception e) { + return false; + } + } + private static JCExpression typeToJCTree0(Type type, JavacAST ast, boolean allowCompound, boolean allowVoid, boolean allowCapture) throws TypeNotConvertibleException { // NB: There's such a thing as maker.Type(type), but this doesn't work very well; it screws up anonymous classes, captures, and adds an extra prefix dot for some reason too. // -- so we write our own take on that here. @@ -450,7 +469,7 @@ public class JavacResolution { } String qName; - if (symbol.isLocal()) { + if (isLocalType(symbol)) { qName = symbol.getSimpleName().toString(); } else if (symbol.type != null && symbol.type.getEnclosingType() != null && typeTag(symbol.type.getEnclosingType()).equals(typeTag("CLASS"))) { replacement = typeToJCTree0(type.getEnclosingType(), ast, false, false, false); |