mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 20:15:09 +00:00
Our quirky 'hider' trick, with a public class inside a package private class, doesn't work after all. Removed it and renamed the launching processor to _ShadowLaunchingAnnotationProcessor.
This commit is contained in:
1 parent
3765835181
commit
b56bdb1b09
2 files changed
+38
-40
No files matched your search
@@ -195,7 +195,7 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
|
||||
</ivy:compile>
|
||||
<mkdir dir="build/lombok/META-INF" />
|
||||
<mkdir dir="build/lombok/META-INF/services" />
|
||||
<echo file="build/lombok/META-INF/services/javax.annotation.processing.Processor">lombok.launch.AnnotationProcessorHider.AnnotationProcessor</echo>
|
||||
<echo file="build/lombok/META-INF/services/javax.annotation.processing.Processor">lombok.launch._ShadowLaunchingAnnotationProcessor</echo>
|
||||
</target>
|
||||
|
||||
<target name="dist" description="Builds THE lombok.jar file which contains everything." depends="version, compile">
|
||||
|
||||
+37
-39
@@ -33,45 +33,43 @@ import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
class AnnotationProcessorHider {
|
||||
public static class AnnotationProcessor extends AbstractProcessor {
|
||||
private final AbstractProcessor instance = createWrappedInstance();
|
||||
|
||||
@Override public Set<String> getSupportedOptions() {
|
||||
return instance.getSupportedOptions();
|
||||
}
|
||||
|
||||
@Override public Set<String> getSupportedAnnotationTypes() {
|
||||
return instance.getSupportedAnnotationTypes();
|
||||
}
|
||||
|
||||
@Override public SourceVersion getSupportedSourceVersion() {
|
||||
return instance.getSupportedSourceVersion();
|
||||
}
|
||||
|
||||
@Override public void init(ProcessingEnvironment processingEnv) {
|
||||
instance.init(processingEnv);
|
||||
super.init(processingEnv);
|
||||
}
|
||||
|
||||
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
||||
return instance.process(annotations, roundEnv);
|
||||
}
|
||||
|
||||
@Override public Iterable<? extends Completion> getCompletions(Element element, AnnotationMirror annotation, ExecutableElement member, String userText) {
|
||||
return instance.getCompletions(element, annotation, member, userText);
|
||||
}
|
||||
|
||||
private static AbstractProcessor createWrappedInstance() {
|
||||
ClassLoader cl = Main.createShadowClassLoader();
|
||||
try {
|
||||
Class<?> mc = cl.loadClass("lombok.core.AnnotationProcessor");
|
||||
return (AbstractProcessor) mc.newInstance();
|
||||
} catch (Throwable t) {
|
||||
if (t instanceof Error) throw (Error) t;
|
||||
if (t instanceof RuntimeException) throw (RuntimeException) t;
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
public class _ShadowLaunchingAnnotationProcessor extends AbstractProcessor {
|
||||
private final AbstractProcessor instance = createWrappedInstance();
|
||||
|
||||
@Override public Set<String> getSupportedOptions() {
|
||||
return instance.getSupportedOptions();
|
||||
}
|
||||
|
||||
@Override public Set<String> getSupportedAnnotationTypes() {
|
||||
return instance.getSupportedAnnotationTypes();
|
||||
}
|
||||
|
||||
@Override public SourceVersion getSupportedSourceVersion() {
|
||||
return instance.getSupportedSourceVersion();
|
||||
}
|
||||
|
||||
@Override public void init(ProcessingEnvironment processingEnv) {
|
||||
instance.init(processingEnv);
|
||||
super.init(processingEnv);
|
||||
}
|
||||
|
||||
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
||||
return instance.process(annotations, roundEnv);
|
||||
}
|
||||
|
||||
@Override public Iterable<? extends Completion> getCompletions(Element element, AnnotationMirror annotation, ExecutableElement member, String userText) {
|
||||
return instance.getCompletions(element, annotation, member, userText);
|
||||
}
|
||||
|
||||
private static AbstractProcessor createWrappedInstance() {
|
||||
ClassLoader cl = Main.createShadowClassLoader();
|
||||
try {
|
||||
Class<?> mc = cl.loadClass("lombok.core.AnnotationProcessor");
|
||||
return (AbstractProcessor) mc.newInstance();
|
||||
} catch (Throwable t) {
|
||||
if (t instanceof Error) throw (Error) t;
|
||||
if (t instanceof RuntimeException) throw (RuntimeException) t;
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user