public class InternalUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.util.List<? extends javax.lang.model.element.AnnotationMirror> |
annotationsFromArrayCreation(com.sun.source.tree.NewArrayTree node,
int level) |
static java.util.List<? extends javax.lang.model.element.AnnotationMirror> |
annotationsFromTree(com.sun.source.tree.AnnotatedTypeTree node) |
static java.util.List<? extends javax.lang.model.element.AnnotationMirror> |
annotationsFromTree(com.sun.source.tree.TypeParameterTree node) |
static java.util.List<javax.lang.model.element.AnnotationMirror> |
annotationsFromTypeAnnotationTrees(java.util.List<? extends com.sun.source.tree.AnnotationTree> annos) |
static javax.lang.model.element.ExecutableElement |
constructor(com.sun.source.tree.NewClassTree tree)
Determines the symbol for a constructor given an invocation via
new . |
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.
|
static javax.lang.model.type.TypeMirror |
greatestLowerBound(javax.annotation.processing.ProcessingEnvironment processingEnv,
javax.lang.model.type.TypeMirror tm1,
javax.lang.model.type.TypeMirror tm2)
Returns the greatest lower bound of two
TypeMirror s. |
static boolean |
isAnonymousConstructor(com.sun.source.tree.MethodTree method)
Determines whether or not the node referred to by the given
TreePath is an anonymous constructor (the constructor for an
anonymous class. |
static boolean |
isCaptured(javax.lang.model.type.TypeVariable typeVar)
Returns whether a TypeVariable represents a captured type.
|
static boolean |
isClassType(javax.lang.model.type.TypeMirror type)
Returns whether a TypeMirror represents a class type.
|
static javax.lang.model.type.TypeMirror |
leastUpperBound(javax.annotation.processing.ProcessingEnvironment processingEnv,
javax.lang.model.type.TypeMirror tm1,
javax.lang.model.type.TypeMirror tm2)
Returns the least upper bound of two
TypeMirror s. |
static javax.lang.model.type.TypeMirror |
substituteMethodReturnType(javax.lang.model.type.TypeMirror methodType,
javax.lang.model.type.TypeMirror substitutedReceiverType)
Returns the return type of a method, where the "raw" return type of that
method is given (i.e., the return type might still contain unsubstituted
type variables), given the receiver of the method call.
|
static @Nullable javax.lang.model.element.Element |
symbol(com.sun.source.tree.Tree tree)
Gets the
Element ("symbol") for the given Tree API node. |
static javax.lang.model.type.TypeMirror |
typeOf(com.sun.source.tree.Tree tree) |
public static @Nullable javax.lang.model.element.Element symbol(com.sun.source.tree.Tree tree)
Element
("symbol") for the given Tree API node.tree
- the Tree
node to get the symbol for{@link Symbol}
for the given tree, or null if one
could not be foundjava.lang.IllegalArgumentException
- if tree
is null or is not a valid javac-internal tree
(JCTree)public static boolean isAnonymousConstructor(com.sun.source.tree.MethodTree method)
TreePath
is an anonymous constructor (the constructor for an
anonymous class.method
- the TreePath
for a node that may be an anonymous
constructorpublic static javax.lang.model.element.ExecutableElement constructor(com.sun.source.tree.NewClassTree tree)
new
.
If the tree is a declaration of an anonymous class, then method returns
constructor that gets invoked in the extended class, rather than the
anonymous constructor implicitly added by the constructor (JLS 15.9.5.1)tree
- the constructor invocationExecutableElement
corresponding to the constructor
call in tree
public static final java.util.List<javax.lang.model.element.AnnotationMirror> annotationsFromTypeAnnotationTrees(java.util.List<? extends com.sun.source.tree.AnnotationTree> annos)
public static final java.util.List<? extends javax.lang.model.element.AnnotationMirror> annotationsFromTree(com.sun.source.tree.AnnotatedTypeTree node)
public static final java.util.List<? extends javax.lang.model.element.AnnotationMirror> annotationsFromTree(com.sun.source.tree.TypeParameterTree node)
public static final java.util.List<? extends javax.lang.model.element.AnnotationMirror> annotationsFromArrayCreation(com.sun.source.tree.NewArrayTree node, int level)
public static javax.lang.model.type.TypeMirror typeOf(com.sun.source.tree.Tree tree)
public static boolean isCaptured(javax.lang.model.type.TypeVariable typeVar)
public static boolean isClassType(javax.lang.model.type.TypeMirror type)
public static javax.lang.model.type.TypeMirror leastUpperBound(javax.annotation.processing.ProcessingEnvironment processingEnv, javax.lang.model.type.TypeMirror tm1, javax.lang.model.type.TypeMirror tm2)
TypeMirror
s.processingEnv
- The ProcessingEnvironment
to use.tm1
- A TypeMirror
.tm2
- A TypeMirror
.tm1
and tm2
.public static javax.lang.model.type.TypeMirror greatestLowerBound(javax.annotation.processing.ProcessingEnvironment processingEnv, javax.lang.model.type.TypeMirror tm1, javax.lang.model.type.TypeMirror tm2)
TypeMirror
s.processingEnv
- The ProcessingEnvironment
to use.tm1
- A TypeMirror
.tm2
- A TypeMirror
.tm1
and tm2
.public static javax.lang.model.type.TypeMirror substituteMethodReturnType(javax.lang.model.type.TypeMirror methodType, javax.lang.model.type.TypeMirror substitutedReceiverType)
public static com.sun.tools.javac.util.Context getJavacContext(javax.annotation.processing.ProcessingEnvironment env)
env
- the processing environment