aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2017-10-25 22:26:55 +0200
committerRoel Spilker <r.spilker@gmail.com>2017-10-25 22:26:55 +0200
commitf7066e43d8434f374d75e87cba4fba9c40ae2215 (patch)
treeb9104f2e6d1fd51b441876321c386e6272be4bad /src
parent4298d97be8c2a3e1034619601719a493fcf17d48 (diff)
downloadlombok-f7066e43d8434f374d75e87cba4fba9c40ae2215.tar.gz
lombok-f7066e43d8434f374d75e87cba4fba9c40ae2215.tar.bz2
lombok-f7066e43d8434f374d75e87cba4fba9c40ae2215.zip
Turns out we don't need the encoding after all since all methods are overridden
Diffstat (limited to 'src')
-rw-r--r--src/core/lombok/javac/apt/LombokFileObjects.java49
1 files changed, 17 insertions, 32 deletions
diff --git a/src/core/lombok/javac/apt/LombokFileObjects.java b/src/core/lombok/javac/apt/LombokFileObjects.java
index 917bfe9e..71d1a95c 100644
--- a/src/core/lombok/javac/apt/LombokFileObjects.java
+++ b/src/core/lombok/javac/apt/LombokFileObjects.java
@@ -26,7 +26,6 @@ import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URI;
-import java.nio.charset.Charset;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Iterator;
@@ -37,7 +36,6 @@ import javax.tools.FileObject;
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
import javax.tools.JavaFileObject.Kind;
-import javax.tools.StandardLocation;
import lombok.core.DiagnosticsReceiver;
@@ -127,8 +125,7 @@ final class LombokFileObjects {
if (superType.isInstance(wrappedManager)) {
return new Java9Compiler(wrappedManager);
} else {
- String encoding = getEncodingOf(wrappedManager);
- return new Java9Compiler(new BaseFileManagerWrapper(wrappedManager, encoding != null ? Charset.forName(encoding) : null));
+ return new Java9Compiler(new BaseFileManagerWrapper(wrappedManager));
}
}
catch (Exception e) {}
@@ -151,24 +148,12 @@ final class LombokFileObjects {
}
throw new IllegalArgumentException(sb.toString());
}
-
- private static String getEncodingOf(JavaFileManager manager) {
- try {
- // FileObject may be instance of org.jetbrains.jps.javac.OutputFileObject
- FileObject fo = manager.getFileForOutput(StandardLocation.CLASS_OUTPUT, "", "dummy", null);
- Field encodingField = fo.getClass().getDeclaredField("myEncodingName");
- encodingField.setAccessible(true);
- return (String)encodingField.get(fo);
- } catch (Exception e) {
- return null;
- }
- }
-
+
static class BaseFileManagerWrapper extends BaseFileManager {
JavaFileManager manager;
-
- public BaseFileManagerWrapper(JavaFileManager manager, Charset charset) {
- super(charset);
+
+ public BaseFileManagerWrapper(JavaFileManager manager) {
+ super(null);
this.manager = manager;
}
@@ -176,62 +161,62 @@ final class LombokFileObjects {
public int isSupportedOption(String option) {
return manager.isSupportedOption(option);
}
-
+
@Override
public ClassLoader getClassLoader(Location location) {
return manager.getClassLoader(location);
}
-
+
@Override
public Iterable<JavaFileObject> list(Location location, String packageName, Set<Kind> kinds, boolean recurse) throws IOException {
return manager.list(location, packageName, kinds, recurse);
}
-
+
@Override
public String inferBinaryName(Location location, JavaFileObject file) {
return manager.inferBinaryName(location, file);
}
-
+
@Override
public boolean isSameFile(FileObject a, FileObject b) {
return manager.isSameFile(a, b);
}
-
+
@Override
public boolean handleOption(String current, Iterator<String> remaining) {
return manager.handleOption(current, remaining);
}
-
+
@Override
public boolean hasLocation(Location location) {
return manager.hasLocation(location);
}
-
+
@Override
public JavaFileObject getJavaFileForInput(Location location, String className, Kind kind) throws IOException {
return manager.getJavaFileForInput(location, className, kind);
}
-
+
@Override
public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException {
return manager.getJavaFileForOutput(location, className, kind, sibling);
}
-
+
@Override
public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException {
return manager.getFileForInput(location, packageName, relativeName);
}
-
+
@Override
public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException {
return manager.getFileForOutput(location, packageName, relativeName, sibling);
}
-
+
@Override
public void flush() throws IOException {
manager.flush();
}
-
+
@Override
public void close() throws IOException {
manager.close();