Package org.immutables.processor
Class ProxyProcessor
- java.lang.Object
-
- org.immutables.processor.ProxyProcessor
-
- All Implemented Interfaces:
javax.annotation.processing.Processor
@Service public final class ProxyProcessor extends java.lang.Object implements javax.annotation.processing.Processor
Proxy processor to overcome eclipse class loading problems which renders our workarounds for Eclipse bugs and quirks useless. When the condition is not detected we try to use direct delegation toorg.immutables.value.processor.Processor.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classProxyProcessor.ProxyClassLoader
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.ClassLoadercachedProxyClassLoaderprivate javax.annotation.processing.Processordelegateprivate static java.lang.StringDELEGATE_CLASSprivate static java.lang.StringECLIPSE_PACKAGE_PREFIXprivate static java.lang.StringOSGI_SYSTEM_PROPERTY
-
Constructor Summary
Constructors Constructor Description ProxyProcessor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static javax.annotation.processing.ProcessorcreateClassLoaderDelegate()We find the delegating classloader by traversing the call stack and looking for the first class that has a classloader from the Eclipse namespace.private static javax.annotation.processing.ProcessorcreateDefaultDelegate()java.lang.Iterable<? extends javax.annotation.processing.Completion>getCompletions(javax.lang.model.element.Element element, javax.lang.model.element.AnnotationMirror annotation, javax.lang.model.element.ExecutableElement member, java.lang.String userText)java.util.Set<java.lang.String>getSupportedAnnotationTypes()java.util.Set<java.lang.String>getSupportedOptions()javax.lang.model.SourceVersiongetSupportedSourceVersion()voidinit(javax.annotation.processing.ProcessingEnvironment processing)booleanprocess(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations, javax.annotation.processing.RoundEnvironment round)private static booleanrequiresClassLoaderDelegate()
-
-
-
Field Detail
-
DELEGATE_CLASS
private static final java.lang.String DELEGATE_CLASS
- See Also:
- Constant Field Values
-
ECLIPSE_PACKAGE_PREFIX
private static final java.lang.String ECLIPSE_PACKAGE_PREFIX
- See Also:
- Constant Field Values
-
OSGI_SYSTEM_PROPERTY
private static final java.lang.String OSGI_SYSTEM_PROPERTY
- See Also:
- Constant Field Values
-
cachedProxyClassLoader
private static volatile java.lang.ClassLoader cachedProxyClassLoader
-
delegate
private final javax.annotation.processing.Processor delegate
-
-
Method Detail
-
getSupportedOptions
public java.util.Set<java.lang.String> getSupportedOptions()
- Specified by:
getSupportedOptionsin interfacejavax.annotation.processing.Processor
-
getSupportedAnnotationTypes
public java.util.Set<java.lang.String> getSupportedAnnotationTypes()
- Specified by:
getSupportedAnnotationTypesin interfacejavax.annotation.processing.Processor
-
getSupportedSourceVersion
public javax.lang.model.SourceVersion getSupportedSourceVersion()
- Specified by:
getSupportedSourceVersionin interfacejavax.annotation.processing.Processor
-
init
public void init(javax.annotation.processing.ProcessingEnvironment processing)
- Specified by:
initin interfacejavax.annotation.processing.Processor
-
process
public boolean process(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations, javax.annotation.processing.RoundEnvironment round)- Specified by:
processin interfacejavax.annotation.processing.Processor
-
getCompletions
public java.lang.Iterable<? extends javax.annotation.processing.Completion> getCompletions(javax.lang.model.element.Element element, javax.lang.model.element.AnnotationMirror annotation, javax.lang.model.element.ExecutableElement member, java.lang.String userText)- Specified by:
getCompletionsin interfacejavax.annotation.processing.Processor
-
createDefaultDelegate
private static javax.annotation.processing.Processor createDefaultDelegate()
-
createClassLoaderDelegate
private static javax.annotation.processing.Processor createClassLoaderDelegate()
We find the delegating classloader by traversing the call stack and looking for the first class that has a classloader from the Eclipse namespace. This is bound to be the bundle classloader of a JDT bundle which can load the required Eclipse compiler types. NOTE: We cannot simply use the thread context class loader. This works in the Eclipse IDE (where it is set to ContextFinder), but not in the JDT Language Server.
-
requiresClassLoaderDelegate
private static boolean requiresClassLoaderDelegate()
-
-