mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 12:16:49 +00:00
Possible fix for issue 1440: Error-prone in IntelliJ
This commit is contained in:
1 parent
4fde7715e9
commit
e92e285d95
1 file changed
+13
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user