Class 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 to org.immutables.value.processor.Processor.
    • 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.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.
      private static javax.annotation.processing.Processor createDefaultDelegate()  
      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.SourceVersion getSupportedSourceVersion()  
      void init​(javax.annotation.processing.ProcessingEnvironment processing)  
      boolean process​(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations, javax.annotation.processing.RoundEnvironment round)  
      private static boolean requiresClassLoaderDelegate()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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
    • Constructor Detail

      • ProxyProcessor

        public ProxyProcessor()
    • Method Detail

      • getSupportedOptions

        public java.util.Set<java.lang.String> getSupportedOptions()
        Specified by:
        getSupportedOptions in interface javax.annotation.processing.Processor
      • getSupportedAnnotationTypes

        public java.util.Set<java.lang.String> getSupportedAnnotationTypes()
        Specified by:
        getSupportedAnnotationTypes in interface javax.annotation.processing.Processor
      • getSupportedSourceVersion

        public javax.lang.model.SourceVersion getSupportedSourceVersion()
        Specified by:
        getSupportedSourceVersion in interface javax.annotation.processing.Processor
      • init

        public void init​(javax.annotation.processing.ProcessingEnvironment processing)
        Specified by:
        init in interface javax.annotation.processing.Processor
      • process

        public boolean process​(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations,
                               javax.annotation.processing.RoundEnvironment round)
        Specified by:
        process in interface javax.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:
        getCompletions in interface javax.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()