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

public Class JavacRoundEnvironment

extends Object
implements RoundEnvironment
Class Inheritance
All Implemented Interfaces
javax.annotation.processing.RoundEnvironment
Imports
java.lang.annotation.Annotation, javax.annotation.processing.*, javax.lang.model.element.*, javax.lang.model.util.*, java.util.*, com.sun.tools.javac.code.Source.Feature, com.sun.tools.javac.util.DefinedBy, .DefinedBy.Api

Object providing state about a prior round of annotation processing.

The methods in this class do not take type annotations into account, as target types, not java elements.

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
private class

Field Summary

Modifier and TypeField and Description
private final boolean
private final Elements
private final boolean
private static final String
private final ProcessingEnvironment
private final boolean
private final Set<? extends Element>

Constructor Summary

AccessConstructor and Description
pack-priv
JavacRoundEnvironment(boolean processingOver, boolean errorRaised, Set<? extends Element> rootElements, JavacProcessingEnvironment processingEnv)

Method Summary

Modifier and TypeMethod and Description
private TypeElement
annotationToElement(Class<? extends Annotation> annotation)

public boolean

Returns:

true if an error was raised in the prior round of processing; returns false otherwise.
errorRaised
()

Implements javax.annotation.processing.RoundEnvironment.errorRaised.

Returns true if an error was raised in the prior round of processing; returns false otherwise.

public Set<? extends Element>

Returns:

the elements annotated with the given annotation type, or an empty set if there are none
getElementsAnnotatedWith
(TypeElement
annotation type being requested
a
)

Implements javax.annotation.processing.RoundEnvironment.getElementsAnnotatedWith.

Returns the elements annotated with the given annotation type.

public Set<? extends Element>
getElementsAnnotatedWith(Class<? extends Annotation> a)

Implements javax.annotation.processing.RoundEnvironment.getElementsAnnotatedWith.

Returns the elements annotated with the given annotation interface.

public Set<? extends Element>
getElementsAnnotatedWithAny(TypeElement... annotations)

Overrides default javax.annotation.processing.RoundEnvironment.getElementsAnnotatedWithAny.

Returns the elements annotated with one or more of the given annotation interfaces.

public Set<? extends Element>
getElementsAnnotatedWithAny(Set<Class<? extends Annotation>> annotations)

Overrides default javax.annotation.processing.RoundEnvironment.getElementsAnnotatedWithAny.

Returns the elements annotated with one or more of the given annotation interfaces.

public Set<? extends Element>

Returns:

the types elements specified by the prior round, or an empty set if there were none
getRootElements
()

Implements javax.annotation.processing.RoundEnvironment.getRootElements.

Returns the type elements specified by the prior round.

private Element
public boolean
processingOver()

Implements javax.annotation.processing.RoundEnvironment.processingOver.

Returns true if types generated by this round will not be subject to a subsequent round of annotation processing; returns false otherwise.

private void
private void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

allowModulesback to summary
private final boolean allowModules
eltUtilsback to summary
private final Elements eltUtils
errorRaisedback to summary
private final boolean errorRaised
NOT_AN_ANNOTATION_TYPEback to summary
private static final String NOT_AN_ANNOTATION_TYPE
processingEnvback to summary
private final ProcessingEnvironment processingEnv
processingOverback to summary
private final boolean processingOver
rootElementsback to summary
private final Set<? extends Element> rootElements

Constructor Detail

JavacRoundEnvironmentback to summary
pack-priv JavacRoundEnvironment(boolean processingOver, boolean errorRaised, Set<? extends Element> rootElements, JavacProcessingEnvironment processingEnv)

Method Detail

annotationToElementback to summary
private TypeElement annotationToElement(Class<? extends Annotation> annotation)
errorRaisedback to summary
public boolean errorRaised()

Implements javax.annotation.processing.RoundEnvironment.errorRaised.

Returns true if an error was raised in the prior round of processing; returns false otherwise.

Returns:boolean

true if an error was raised in the prior round of processing; returns false otherwise.

Annotations
@DefinedBy:ANNOTATION_PROCESSING
getElementsAnnotatedWithback to summary
public Set<? extends Element> getElementsAnnotatedWith(TypeElement a)

Implements javax.annotation.processing.RoundEnvironment.getElementsAnnotatedWith.

Returns the elements annotated with the given annotation type. Only type elements included in this round of annotation processing, or declarations of members, parameters, type parameters, or record components declared within those, are returned. Included type elements are specified types and any types nested within them.

Parameters
a:TypeElement

annotation type being requested

Returns:Set<? extends Element>

the elements annotated with the given annotation type, or an empty set if there are none

Annotations
@DefinedBy:ANNOTATION_PROCESSING
getElementsAnnotatedWithback to summary
public Set<? extends Element> getElementsAnnotatedWith(Class<? extends Annotation> a)

Implements javax.annotation.processing.RoundEnvironment.getElementsAnnotatedWith.

Doc from javax.annotation.processing.RoundEnvironment.getElementsAnnotatedWith.

Returns the elements annotated with the given annotation interface. The annotation may appear directly or be inherited. Only package elements, module elements, and type elements included in this round of annotation processing, or declarations of members, constructors, parameters, type parameters, or record components declared within those, are returned. Included type elements are root types and any member types nested within them. Elements in a package are not considered included simply because a package-info file for that package was created. Likewise, elements of a module are not considered included simply because a module-info file for that module was created.

Note

An implementation of this method typically performs an internal conversion from the runtime reflective representation of an annotation interface as a Class object to a different representation used for annotation processing. The set of annotation interfaces present in the runtime context may differ from the set of annotation interfaces present in the context of annotation processing in a particular environmental configuration. If a runtime annotation interface is not present in the annotation processing context, the situation is not treated as an error and no elements are found for that annotation interface.

Annotations
@DefinedBy:ANNOTATION_PROCESSING
getElementsAnnotatedWithAnyback to summary
public Set<? extends Element> getElementsAnnotatedWithAny(TypeElement... annotations)

Overrides default javax.annotation.processing.RoundEnvironment.getElementsAnnotatedWithAny.

Doc from javax.annotation.processing.RoundEnvironment.getElementsAnnotatedWithAny.

Returns the elements annotated with one or more of the given annotation interfaces.

Annotations
@DefinedBy:ANNOTATION_PROCESSING
getElementsAnnotatedWithAnyback to summary
public Set<? extends Element> getElementsAnnotatedWithAny(Set<Class<? extends Annotation>> annotations)

Overrides default javax.annotation.processing.RoundEnvironment.getElementsAnnotatedWithAny.

Doc from javax.annotation.processing.RoundEnvironment.getElementsAnnotatedWithAny.

Returns the elements annotated with one or more of the given annotation interfaces.

Note

An implementation of this method typically performs an internal conversion from the runtime reflective representation of an annotation interface as a Class object to a different representation used for annotation processing. The set of annotation interfaces present in the runtime context may differ from the set of annotation interfaces present in the context of annotation processing in a particular environmental configuration. If a runtime annotation interface is not present in the annotation processing context, the situation is not treated as an error and no elements are found for that annotation interface.

Annotations
@DefinedBy:ANNOTATION_PROCESSING
getRootElementsback to summary
public Set<? extends Element> getRootElements()

Implements javax.annotation.processing.RoundEnvironment.getRootElements.

Returns the type elements specified by the prior round.

Returns:Set<? extends Element>

the types elements specified by the prior round, or an empty set if there were none

Annotations
@DefinedBy:ANNOTATION_PROCESSING
mirrorAsElementback to summary
private Element mirrorAsElement(AnnotationMirror annotationMirror)
processingOverback to summary
public boolean processingOver()

Implements javax.annotation.processing.RoundEnvironment.processingOver.

Doc from javax.annotation.processing.RoundEnvironment.processingOver.

Returns true if types generated by this round will not be subject to a subsequent round of annotation processing; returns false otherwise.

Annotations
@DefinedBy:ANNOTATION_PROCESSING
throwIfNotAnnotationback to summary
private void throwIfNotAnnotation(Class<? extends Annotation> a)
throwIfNotAnnotationback to summary
private void throwIfNotAnnotation(TypeElement a)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

com.sun.tools.javac.processing back to summary

private Class JavacRoundEnvironment.AnnotationSetMultiScanner

extends ElementScanner14<Set<Element>, Set<TypeElement>>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Set<Element>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Set<Element>
scan(Element e, Set<TypeElement> annotations)

Overrides javax.lang.model.util.ElementScanner6.scan.

Processes an element by calling e.accept(this, p); this method may be overridden by subclasses.

public Set<Element>
public Set<Element>
Inherited from javax.lang.model.util.ElementScanner14:
visitExecutablevisitRecordComponentvisitType

Field Detail

annotatedElementsback to summary
private Set<Element> annotatedElements

Constructor Detail

AnnotationSetMultiScannerback to summary
pack-priv AnnotationSetMultiScanner(Set<Element> defaultSet)

Method Detail

scanback to summary
public Set<Element> scan(Element e, Set<TypeElement> annotations)

Overrides javax.lang.model.util.ElementScanner6.scan.

Doc from javax.lang.model.util.ElementScanner6.scan.

Processes an element by calling e.accept(this, p); this method may be overridden by subclasses.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
visitModuleback to summary
public Set<Element> visitModule(ModuleElement e, Set<TypeElement> annotations)

Overrides javax.lang.model.util.ElementScanner9.visitModule.

Overrides default javax.lang.model.element.ElementVisitor.visitModule.

Doc from javax.lang.model.util.ElementScanner9.visitModule.

Visits a module element.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
visitPackageback to summary
public Set<Element> visitPackage(PackageElement e, Set<TypeElement> annotations)

Overrides javax.lang.model.util.ElementScanner6.visitPackage.

Implements javax.lang.model.element.ElementVisitor.visitPackage.

Doc from javax.lang.model.util.ElementScanner6.visitPackage.

Visits a package element.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
com.sun.tools.javac.processing back to summary

private Class JavacRoundEnvironment.AnnotationSetScanner

extends ElementScanner14<Set<Element>, TypeElement>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Set<Element>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Set<Element>
scan(Element e, TypeElement annotation)

Overrides javax.lang.model.util.ElementScanner6.scan.

Processes an element by calling e.accept(this, p); this method may be overridden by subclasses.

public Set<Element>
public Set<Element>
Inherited from javax.lang.model.util.ElementScanner14:
visitExecutablevisitRecordComponentvisitType

Field Detail

annotatedElementsback to summary
private Set<Element> annotatedElements

Constructor Detail

AnnotationSetScannerback to summary
pack-priv AnnotationSetScanner(Set<Element> defaultSet)

Method Detail

scanback to summary
public Set<Element> scan(Element e, TypeElement annotation)

Overrides javax.lang.model.util.ElementScanner6.scan.

Doc from javax.lang.model.util.ElementScanner6.scan.

Processes an element by calling e.accept(this, p); this method may be overridden by subclasses.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
visitModuleback to summary
public Set<Element> visitModule(ModuleElement e, TypeElement annotation)

Overrides javax.lang.model.util.ElementScanner9.visitModule.

Overrides default javax.lang.model.element.ElementVisitor.visitModule.

Doc from javax.lang.model.util.ElementScanner9.visitModule.

Visits a module element.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL
visitPackageback to summary
public Set<Element> visitPackage(PackageElement e, TypeElement annotation)

Overrides javax.lang.model.util.ElementScanner6.visitPackage.

Implements javax.lang.model.element.ElementVisitor.visitPackage.

Doc from javax.lang.model.util.ElementScanner6.visitPackage.

Visits a package element.

Annotations
@Override
@DefinedBy:LANGUAGE_MODEL