diff options
author | Roel Spilker <r.spilker@gmail.com> | 2017-07-17 22:22:30 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2017-07-17 22:23:36 +0200 |
commit | e92e285d95e0fb08c32e7059f85806a30985084b (patch) | |
tree | 55c0fc9e54e13153fffe27c75b1deedb8e986d7e | |
parent | 4fde7715e9c5441e7e9c10a46bafad5d1bbd7152 (diff) | |
download | lombok-e92e285d95e0fb08c32e7059f85806a30985084b.tar.gz lombok-e92e285d95e0fb08c32e7059f85806a30985084b.tar.bz2 lombok-e92e285d95e0fb08c32e7059f85806a30985084b.zip |
Possible fix for issue 1440: Error-prone in IntelliJ
-rw-r--r-- | src/core/lombok/javac/apt/LombokFileObjects.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/lombok/javac/apt/LombokFileObjects.java b/src/core/lombok/javac/apt/LombokFileObjects.java index 4edf7f6e..cb2036e9 100644 --- a/src/core/lombok/javac/apt/LombokFileObjects.java +++ b/src/core/lombok/javac/apt/LombokFileObjects.java @@ -22,6 +22,7 @@ package lombok.javac.apt; +import java.lang.reflect.Field; import java.lang.reflect.Method; import java.net.URI; import java.nio.file.Path; @@ -111,6 +112,18 @@ final class LombokFileObjects { catch (Exception e) {} return Compiler.JAVAC7; } + if (jfmClassName.equals("com.sun.tools.javac.api.ClientCodeWrapper$WrappedStandardJavaFileManager")) { + try { + Field wrappedField = Class.forName("com.sun.tools.javac.api.ClientCodeWrapper$WrappedJavaFileManager").getDeclaredField("clientJavaFileManager"); + wrappedField.setAccessible(true); + JavaFileManager wrappedManager = (JavaFileManager)wrappedField.get(jfm); + Class<?> superType = Class.forName("com.sun.tools.javac.file.BaseFileManager"); + if (superType.isInstance(wrappedManager)) { + return new Java9Compiler(wrappedManager); + } + } + catch (Exception e) {} + } try { if (Class.forName("com.sun.tools.javac.file.BaseFileObject") == null) throw new NullPointerException(); return Compiler.JAVAC7; |