Summary of changes to JSR 269 packages
The initial inputs can include module-info files. Such files are
ModuleElement objects. However, new module-element
source and class files cannot be created through the Filer API. In the
Filer API, the syntax of the "
name" parameters of the create methods
is expanded to allow a leading "
If an explicit module is not specified, the Filer API attempts to
infer a module. If a module cannot be inferred, an exception is thrown.
The syntax of
Processor.getSupportedAnnotationTypes is also expanded
to allow an optional leading module name and slash.
For processors written to run both pre- and post-modules, the
recommendation is that the supported annotation type name include the
module prefix and rely on the code in
AbstractProcessor.getSupportedAnnotationTypes to strip
out the module name when a source level earlier than 9 is being used.
New overloaded methods
multiple annotations to be searched for in a single call.
The annotation type
Generated is added to
javax.annotation.processing. This annotation type is
intended to be a replacement for
The direct support for modeling modules proceeded mostly as
expected for modeling a new language construct in the API: a new
ModuleElement type was added, a corresponding new
visitModule method was added to the
interface, and a new
MODULE ElementKind was added
ModuleElement interface extends
QualifiedNameable, and also
The API support for modules throughout the API is similar to the
support for packages.
A new visitor interface is added to assist processing module
The methods added to interfaces in this release generally use the
new-in-Java-8 feature of default methods to provide some nominal
implementation and provide better source compatibility for
implementers of the interfaces. This included the new
ElementVisitor.visitModule method method. The existing one-argument
"visit" methods in the AnnotationValueVisitor, ElementVisitor, and
TypeVisitor interfaces were also upgraded to be default methods.
Besides a new constant for
SourceVersion gained additional
isName methods parameterized by a
The behavior of
getEnclosingElement for a
PackageElement is dependent on the source version being
used for the annotation processing run. When modules are present, a
module encloses a package. When modules are not present,
null is returned for the enclosing element of a package
as done previously.
Elements utility interface has additions for
name-based look-ups of types, packages, and modules. A method is also
added to return the origin of a construct, that is, if the construct
is explicitly declared in the source, implicitly declared in the
source, synthesized by the compiler, etc.
The constructors of 6-era visitor classes have been deprecated since
that source level is also deprecated.
The overall specification had a cleanup pass, obsolete statements
removed, more @jls tags, etc.