< prev index next >

src/java.compiler/share/classes/javax/annotation/processing/Processor.java

Print this page

        

@@ -113,11 +113,21 @@
  * <p>An annotation type is considered present if there is at least
  * one annotation of that type present on an element enclosed within
  * the root elements of a round. For this purpose, a type parameter is
  * considered to be enclosed by its {@linkplain
  * TypeParameterElement#getGenericElement generic
- * element}. Annotations on {@linkplain
+ * element}.
+
+ * For this purpose, a top-level type is <em>not</em> considered to be
+ * enclosed by its enclosing package. A root element representing a
+ * package is created when a {@code package-info} file is processed.
+ * Likewise, for this purpose, a package is <em>not</em> considered to
+ * be enclosed by its enclosing named module (if any). A root element
+ * representing a module is created when a {@code module-info} file is
+ * processed.
+
+ * Annotations on {@linkplain
  * java.lang.annotation.ElementType#TYPE_USE type uses}, as opposed to
  * annotations on elements, are ignored when computing whether or not
  * an annotation type is present.
  *
  * <p>An annotation is present if it meets the definition of being

@@ -233,26 +243,38 @@
      * Returns the names of the annotation types supported by this
      * processor.  An element of the result may be the canonical
      * (fully qualified) name of a supported annotation type.
      * Alternately it may be of the form &quot;<tt><i>name</i>.*</tt>&quot;
      * representing the set of all annotation types with canonical
-     * names beginning with &quot;<tt><i>name.</i></tt>&quot;.  Finally, {@code
-     * "*"} by itself represents the set of all annotation types,
-     * including the empty set.  Note that a processor should not
-     * claim {@code "*"} unless it is actually processing all files;
-     * claiming unnecessary annotations may cause a performance
-     * slowdown in some environments.
+     * names beginning with &quot;<tt><i>name.</i></tt>&quot;.
+     *
+     * In either of those cases, the name of the annotation type can be
+     * optionally be preceded by a module name followed by a {@code
+     * "/"} character. For example, if a processor supports {@code
+     * "a.B"}, this can include multiple annotation types named {@code
+     * a.B} which reside in different modules. To only support {@code
+     * a.B} in the {@code Foo} module, instead use {@code "Foo/a.B"}.
+     *
+     * Finally, {@code "*"} by itself represents the set of all
+     * annotation types, including the empty set.  Note that a
+     * processor should not claim {@code "*"} unless it is actually
+     * processing all files; claiming unnecessary annotations may
+     * cause a performance slowdown in some environments.
      *
      * <p>Each string returned in the set must be accepted by the
      * following grammar:
      *
      * <blockquote>
      * <dl>
      * <dt><i>SupportedAnnotationTypeString:</i>
-     * <dd><i>TypeName</i> <i>DotStar</i><sub><i>opt</i></sub>
+     * <dd><i>ModulePrefix</i><sub><i>opt</i></sub> <i>TypeName</i> <i>DotStar</i><sub><i>opt</i></sub>
      * <dd><tt>*</tt>
      *
+     * <dt><i>ModulePrefix:</i>
+     * <dd><i>TypeName</i> <tt>/</tt>
+     * </dl>
+     *
      * <dt><i>DotStar:</i>
      * <dd><tt>.</tt> <tt>*</tt>
      * </dl>
      * </blockquote>
      *
< prev index next >