diff options
Diffstat (limited to 'src/core/lombok/javac')
-rw-r--r-- | src/core/lombok/javac/apt/Processor.java | 83 |
1 files changed, 40 insertions, 43 deletions
diff --git a/src/core/lombok/javac/apt/Processor.java b/src/core/lombok/javac/apt/Processor.java index 5f28aa88..3d234541 100644 --- a/src/core/lombok/javac/apt/Processor.java +++ b/src/core/lombok/javac/apt/Processor.java @@ -161,48 +161,45 @@ public class Processor extends AbstractProcessor { } } - private static class WrappingClassLoader extends ClassLoader { - private final ClassLoader parent; - - public WrappingClassLoader(ClassLoader parent) { - this.parent = parent; - } - - public Class<?> loadClass(String name) throws ClassNotFoundException { - return parent.loadClass(name); - } - - public String toString() { - return parent.toString(); - } - - public URL getResource(String name) { - return parent.getResource(name); - } - - public Enumeration<URL> getResources(String name) throws IOException { - return parent.getResources(name); - } - - public InputStream getResourceAsStream(String name) { - return parent.getResourceAsStream(name); - } - - public void setDefaultAssertionStatus(boolean enabled) { - parent.setDefaultAssertionStatus(enabled); - } - - public void setPackageAssertionStatus(String packageName, boolean enabled) { - parent.setPackageAssertionStatus(packageName, enabled); - } - - public void setClassAssertionStatus(String className, boolean enabled) { - parent.setClassAssertionStatus(className, enabled); - } - - public void clearAssertionStatus() { - parent.clearAssertionStatus(); - } + private static ClassLoader wrapClassLoader(final ClassLoader parent) { + return new ClassLoader() { + + public Class<?> loadClass(String name) throws ClassNotFoundException { + return parent.loadClass(name); + } + + public String toString() { + return parent.toString(); + } + + public URL getResource(String name) { + return parent.getResource(name); + } + + public Enumeration<URL> getResources(String name) throws IOException { + return parent.getResources(name); + } + + public InputStream getResourceAsStream(String name) { + return parent.getResourceAsStream(name); + } + + public void setDefaultAssertionStatus(boolean enabled) { + parent.setDefaultAssertionStatus(enabled); + } + + public void setPackageAssertionStatus(String packageName, boolean enabled) { + parent.setPackageAssertionStatus(packageName, enabled); + } + + public void setClassAssertionStatus(String className, boolean enabled) { + parent.setClassAssertionStatus(className, enabled); + } + + public void clearAssertionStatus() { + parent.clearAssertionStatus(); + } + }; } private void stopJavacProcessingEnvironmentFromClosingOurClassloader() { @@ -211,7 +208,7 @@ public class Processor extends AbstractProcessor { f.setAccessible(true); ClassLoader unwrapped = (ClassLoader) f.get(processingEnv); if (unwrapped == null) return; - ClassLoader wrapped = new WrappingClassLoader(unwrapped); + ClassLoader wrapped = wrapClassLoader(unwrapped); f.set(processingEnv, wrapped); } catch (NoSuchFieldException e) { // Some versions of javac have this (and call close on it), some don't. I guess this one doesn't have it. |