diff options
author | Roel Spilker <r.spilker@gmail.com> | 2017-02-14 01:21:27 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2017-02-14 01:21:27 +0100 |
commit | e3a86782e590e11291e1f208417d5ca61aac4fac (patch) | |
tree | 00168415a48a82c7e21af798719a19fab11e119f /src/core/lombok/javac/handlers | |
parent | 05f93771e9aeb6ad0c884f22df4b9fa8c1f6cc2f (diff) | |
download | lombok-e3a86782e590e11291e1f208417d5ca61aac4fac.tar.gz lombok-e3a86782e590e11291e1f208417d5ca61aac4fac.tar.bz2 lombok-e3a86782e590e11291e1f208417d5ca61aac4fac.zip |
[jdk9] Fix members_field error
Diffstat (limited to 'src/core/lombok/javac/handlers')
-rw-r--r-- | src/core/lombok/javac/handlers/JavacHandlerUtil.java | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index af8289a3..918d23f1 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -894,16 +894,20 @@ public class JavacHandlerUtil { static class ClassSymbolMembersField { private static final Field membersField; private static final Method removeMethod; + private static final Method enterMethod; static { Field f = null; - Method m = null; + Method r = null; + Method e = null; try { f = ClassSymbol.class.getField("members_field"); - m = f.getType().getMethod("remove", Symbol.class); - } catch (Exception e) {} + r = f.getType().getMethod("remove", Symbol.class); + e = f.getType().getMethod("enter", Symbol.class); + } catch (Exception ex) {} membersField = f; - removeMethod = m; + removeMethod = r; + enterMethod = r; } static void remove(ClassSymbol from, Symbol toRemove) { @@ -914,6 +918,15 @@ public class JavacHandlerUtil { removeMethod.invoke(scope, toRemove); } catch (Exception e) {} } + + static void enter(ClassSymbol from, Symbol toEnter) { + if (from == null) return; + try { + Scope scope = (Scope) membersField.get(from); + if (scope == null) return; + enterMethod.invoke(scope, toEnter); + } catch (Exception e) {} + } } public static void injectMethod(JavacNode typeNode, JCMethodDecl method) { @@ -959,7 +972,7 @@ public class JavacHandlerUtil { if (typeMirror == null || paramTypes == null || returnType == null) return; ClassSymbol cs = (ClassSymbol) typeMirror; MethodSymbol methodSymbol = new MethodSymbol(access, methodName, new MethodType(paramTypes, returnType, List.<Type>nil(), Symtab.instance(context).methodClass), cs); - cs.members_field.enter(methodSymbol); + ClassSymbolMembersField.enter(cs, methodSymbol); } /** |