Class InternalUtils


  • public class InternalUtils
    extends java.lang.Object
    Miscellaneous static utility methods.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int compareDiagnosticPosition​(com.sun.source.tree.Tree tree1, com.sun.source.tree.Tree tree2)
      Compares tree1 to tree2 by the position at which a diagnostic (e.g., an error message) for the tree should be printed.
      static @Nullable java.lang.ClassLoader getClassLoaderForClass​(java.lang.Class<? extends java.lang.Object> clazz)
      Obtain the class loader for clazz.
      static com.sun.tools.javac.util.Context getJavacContext​(javax.annotation.processing.ProcessingEnvironment env)
      Helper function to extract the javac Context from the javac processing environment.
      • Methods inherited from class java.lang.Object

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

      • getJavacContext

        public static com.sun.tools.javac.util.Context getJavacContext​(javax.annotation.processing.ProcessingEnvironment env)
        Helper function to extract the javac Context from the javac processing environment.
        Parameters:
        env - the processing environment
        Returns:
        the javac Context
      • getClassLoaderForClass

        public static @Nullable java.lang.ClassLoader getClassLoaderForClass​(java.lang.Class<? extends java.lang.Object> clazz)
        Obtain the class loader for clazz. If that is not available, return the system class loader.
        Parameters:
        clazz - the class whose class loader to find
        Returns:
        the class loader used to clazz, or the system class loader, or null if both are unavailable
      • compareDiagnosticPosition

        public static int compareDiagnosticPosition​(com.sun.source.tree.Tree tree1,
                                                    com.sun.source.tree.Tree tree2)
        Compares tree1 to tree2 by the position at which a diagnostic (e.g., an error message) for the tree should be printed.