From b56bdb1b0937fd83c8a2f7a4b7820c9493e56a21 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Tue, 9 Dec 2014 19:58:36 +0100 Subject: 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. --- build.xml | 2 +- src/launch/lombok/launch/AnnotationProcessor.java | 77 ---------------------- .../_ShadowLaunchingAnnotationProcessor.java | 75 +++++++++++++++++++++ 3 files changed, 76 insertions(+), 78 deletions(-) delete mode 100644 src/launch/lombok/launch/AnnotationProcessor.java create mode 100644 src/launch/lombok/launch/_ShadowLaunchingAnnotationProcessor.java diff --git a/build.xml b/build.xml index 6339ec92..b066539e 100644 --- a/build.xml +++ b/build.xml @@ -195,7 +195,7 @@ the common tasks and can be called on to run the main aspects of all the sub-scr - lombok.launch.AnnotationProcessorHider.AnnotationProcessor + lombok.launch._ShadowLaunchingAnnotationProcessor diff --git a/src/launch/lombok/launch/AnnotationProcessor.java b/src/launch/lombok/launch/AnnotationProcessor.java deleted file mode 100644 index 35c26b7c..00000000 --- a/src/launch/lombok/launch/AnnotationProcessor.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2014 The Project Lombok Authors. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package lombok.launch; - -import java.util.Set; - -import javax.annotation.processing.AbstractProcessor; -import javax.annotation.processing.Completion; -import javax.annotation.processing.ProcessingEnvironment; -import javax.annotation.processing.RoundEnvironment; -import javax.lang.model.SourceVersion; -import javax.lang.model.element.AnnotationMirror; -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 getSupportedOptions() { - return instance.getSupportedOptions(); - } - - @Override public Set 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 annotations, RoundEnvironment roundEnv) { - return instance.process(annotations, roundEnv); - } - - @Override public Iterable 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); - } - } - } -} diff --git a/src/launch/lombok/launch/_ShadowLaunchingAnnotationProcessor.java b/src/launch/lombok/launch/_ShadowLaunchingAnnotationProcessor.java new file mode 100644 index 00000000..36787ec9 --- /dev/null +++ b/src/launch/lombok/launch/_ShadowLaunchingAnnotationProcessor.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2014 The Project Lombok Authors. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package lombok.launch; + +import java.util.Set; + +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.Completion; +import javax.annotation.processing.ProcessingEnvironment; +import javax.annotation.processing.RoundEnvironment; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.Element; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.TypeElement; + +public class _ShadowLaunchingAnnotationProcessor extends AbstractProcessor { + private final AbstractProcessor instance = createWrappedInstance(); + + @Override public Set getSupportedOptions() { + return instance.getSupportedOptions(); + } + + @Override public Set 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 annotations, RoundEnvironment roundEnv) { + return instance.process(annotations, roundEnv); + } + + @Override public Iterable 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); + } + } +} -- cgit