APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.tools.javac.comp

public Class Annotate

extends Object
Class Inheritance
Imports
com.sun.tools.javac.code.*, .Attribute.Compound, .Attribute.TypeCompound, .Kinds.KindSelector, .Scope.WriteableScope, .Source.Feature, com.sun.tools.javac.code.Symbol.*, .TypeMetadata.Annotations, com.sun.tools.javac.comp.Check.CheckContext, com.sun.tools.javac.resources.CompilerProperties.Errors, .CompilerProperties.Fragments, com.sun.tools.javac.tree.JCTree, com.sun.tools.javac.tree.JCTree.*, .TreeInfo, .TreeMaker, .TreeScanner, com.sun.tools.javac.util.*, .JCDiagnostic.DiagnosticPosition, .List, .JCDiagnostic.DiagnosticFlag, javax.tools.JavaFileObject, java.util.*

Enter annotations onto symbols and types (and trees). This is also a pseudo stage in the compiler taking care of scheduling when annotations are entered.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
Annotate.AnnotationContext<T extends Attribute.Compound>

This context contains all the information needed to synthesize new annotations trees for repeating annotations.

public static interface
public static class
Annotate.AnnotationTypeMetadata

Represents the semantics of an Annotation Type.

public class
Annotate.AnnotationTypeVisitor

Visitor to determine a prototype annotation type for a class declaring an annotation type.

pack-priv class
pack-priv static class
private class
Annotate.TypeAnnotate

We need to use a TreeScanner, because it is not enough to visit the top-level annotations.

Field Summary

Modifier and TypeField and Description
pack-priv ListBuffer<Runnable>
protected static final Context.Key<Annotate>
private final Attr
private int
blockCount

Semaphore to delay annotation processing

private final ConstFold
private final Check
private final Enter
private int
private final Log
private final TreeMaker
private final Names
private ListBuffer<Runnable>
q

private final Resolve
private final String
private final Symtab
private Annotate.AnnotationTypeCompleter
private final Attribute
private final TypeEnvs
private final Types
pack-priv ListBuffer<Runnable>
private ListBuffer<Runnable>

Constructor Summary

AccessConstructor and Description
protected
Annotate(Context context)

Method Summary

Modifier and TypeMethod and Description
public void
public void
annotateDefaultValueLater(JCTree.JCExpression defaultValue, Env<AttrContext> localEnv, Symbol.MethodSymbol m)

Queue processing of an attribute default value.

public void
annotateLater(List<JCTree.JCAnnotation>
the list of JCAnnotations to attribute and enter
annotations
,
Env<AttrContext>
the enclosing env
localEnv
,
Symbol
the Symbol on which to enter the annotations
s
)

Queue annotations for later attribution and entering.

private <T extends Attribute.Compound> void
annotateNow(Symbol toAnnotate, List<JCTree.JCAnnotation> withAnnotations, Env<AttrContext> env, boolean typeAnnotations, boolean isTypeParam)

Gather up annotations into a map from type symbols to lists of Compound attributes, then continue on with repeating annotations processing.

public void
annotateTypeParameterSecondStage(JCTree tree, List<JCTree.JCAnnotation> annotations)

Apply the annotations to the particular type.

public void
annotateTypeSecondStage(JCTree tree, List<JCTree.JCAnnotation> annotations, Type storeAt)

Apply the annotations to the particular type.

public boolean
annotationsBlocked()

are we blocking annotation processing?

public Annotate.AnnotationTypeCompleter
private Attr.ResultInfo
public Attribute.Compound
attributeAnnotation(JCTree.JCAnnotation
the tree representing an annotation
tree
,
Type
the expected (super)type of the annotation
expectedAnnotationType
,
Env<AttrContext>
the current env in where the annotation instance is found
env
)

Attribute and store a semantic representation of the annotation tree tree into the tree.attribute field.

private Pair<Symbol.MethodSymbol, Attribute>
attributeAnnotationNameValuePair(JCTree.JCExpression nameValuePair, Type thisAnnotationType, boolean badAnnotation, Env<AttrContext> env, boolean elidedValue)

private void
private Attribute
attributeAnnotationValue(Type expectedElementType, JCTree.JCExpression tree, Env<AttrContext> env)

Attribute an annotation element value

private List<Pair<Symbol.MethodSymbol, Attribute>>
attributeAnnotationValues(JCTree.JCAnnotation a, Type expected, Env<AttrContext> env)

Attribute annotation elements creating a list of pairs of the Symbol representing that element and the value of that element as an Attribute.

public Attribute.TypeCompound
attributeTypeAnnotation(JCTree.JCAnnotation
the tree representing an annotation
a
,
Type
the expected (super)type of the annotation
expectedAnnotationType
,
Env<AttrContext>
the current env in where the annotation instance is found
env
)

Attribute and store a semantic representation of the type annotation tree tree into the tree.attribute field.

public void
blockAnnotations()

Called when annotations processing needs to be postponed.

private void
private void
enterDefaultValue(JCTree.JCExpression defaultValue, Env<AttrContext> localEnv, Symbol.MethodSymbol m)

Enter a default value for an annotation element.

public void
public void
enterTypeAnnotations(List<JCTree.JCAnnotation> annotations, Env<AttrContext> env, Symbol s, boolean isTypeParam)

Attribute the list of annotations and enter them onto s.

private Type
extractContainingType(Attribute.Compound ca, JCDiagnostic.DiagnosticPosition pos, Symbol.TypeSymbol annoDecl)

Extract the actual Type to be used for a containing annotation.

private Type
public void
flush()

Flush all annotation queues

public List<Attribute.TypeCompound>
private Attribute
private Attribute
private Attribute
getAnnotationEnumValue(Type expectedElementType, JCTree.JCExpression tree, Env<AttrContext> env)

private Attribute
private Type
getContainingType(Attribute.Compound currentAnno, JCDiagnostic.DiagnosticPosition pos, boolean reportError)

Fetches the actual Type that should be the containing annotation.

public static Annotate
instance(Context context)

private boolean
private boolean
private <T extends Attribute.Compound> T
makeContainerAnnotation(List<T> toBeReplaced, Annotate.AnnotationContext<T> ctx, Symbol sym, boolean isTypeParam)

public void
public void
normal(Runnable r)

Annotate (used for everything else)

private <T extends Attribute.Compound> T
processRepeatedAnnotations(List<T> annotations, Annotate.AnnotationContext<T> ctx, Symbol on, boolean isTypeParam)

public void
queueScanTreeAndTypeAnnotate(JCTree tree, Env<AttrContext> env, Symbol sym)

Enqueue tree for scanning of type annotations, attaching to the Symbol sym.

public Annotate.Queues
private void
public void
public void
unblockAnnotations()

Called when annotation processing can be resumed.

public void
unblockAnnotationsNoFlush()

Variant which allows for a delayed flush of annotations.

public Attribute
public void
validate(Runnable a)

Validate, triggers after 'normal'

private Symbol.MethodSymbol
validateContainer(Type targetContainerType, Type originalAnnoType, JCDiagnostic.DiagnosticPosition pos)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait