As a planned part of Java SE 7, JSR 269, which standardized an API for annotation processing, is now undergoing maintenance review.
In the JCP, a maintenance review is a process to take comments on small changes so that those small changes can be formally incorporated into an existing specification without running a whole new JSR.
The changes being proposed in the JSR 269 maintenance review are the changes already implemented in the JSR 269 APIs in JDK 7.
In summary, those proposed changes are:
Clarified interaction between the Filer
and rounds.
Constructors explicitly added to the kinds of elements that can
be returned by RoundEnvironment.getElementsAnnotatedWith
.
New enum constantjavax.lang.model.SourceVersion.RELEASE_7
.
In the package description ofjavax.lang.model.element
, requirements on when a model
must be provided are loosened to remove the requirement in case of an
"irrecoverable error that could not be removed by the generation of
new types," a condition which includes but is not limited to syntax
errors.
New exception typejavax.lang.model.UnknownEntityException
added as a common
superclass for existing exception typesUnknownAnnotationValueException
,UnknownElementException
, andUnknownTypeException
.
New enum constantjavax.lang.model.element.ElementKind.RESOURCE_VARIABLE
.
New mixin interfaces Parameterizable
andQualifiedNameable
added to packagejavax.lang.model.element
.ExecutableElement
and TypeElement
are
retrofitted to extend Parameterizable
;PackageElement
and TypeElement
are
retrofitted to extend QualifiedNameable
.
Behavior of getEnclosingElement
method defined to
return the generic element of a type parameter instead ofnull
.
New interfacejavax.lang.model.type.DisjunctiveType
to model
disjunctive types.
New enum constantjavax.lang.model.type.TypeKind.DISJUNCTIVE
to mark
disjunctive types.
New method visitDisjunctive
added to visitor
interface javax.lang.model.type.TypeVisitor
.
Utility visitor implementations updated accordingly.
In the package javax.lang.model.type
,MirroredTypesException
retrofitted to be the
superclass of MirroredTypeException
.
New utility visitors for release 7 in packagejavax.lang.model.util
:
AbstractAnnotationValueVisitor7
AbstractElementVisitor7
AbstractTypeVisitor7
ElementKindVisitor7
ElementScanner7
SimpleAnnotationValueVisitor7
SimpleElementVisitor7
SimpleTypeVisitor7
TypeKindVisitor7
The visitors ElementKindVisitor6
,ElementScanner6
, and SimpleElementVisitor6
,
are updated to account for new element kindRESOURCE_VARIABLE
.
The visitor AbstractTypeVisitor6
is updated to
account for the possibility of visiting aDisjunctiveType
.
Definition of documentation comment added to javadoc ofjavax.lang.model.util.Elements.getDocComment
.
Joe, it's not clear to me why the xxxScanner6/xxxVisitor6 classes need to be updated for RESOURCE_VARIABLE. Why would a resource variable be visible to a JDK 6 language model?
@Paul,
For a given JDK release, there is a single language model API that models language versions from JDK 5/6 forward. For JDK 7, the API in javax.lang.model.\* fully models the Java SE 7 features, including resource variables. If a JDK 6 era processor, compiled against the JDK 6 API, is run against JDK 7 and asked to process source code using new features, something sensible still needs to happen. That is why the xxxScanner6/xxxVisitor6 classes are updated to explicitly test for the JDK 7 features. (For resource variables in particular, a compiler-specific API needs to be used for a processor to see such structures, but it is still correct for the visitors to be updated.)