A facility for getting the current method's name
Michael Ernst
mernst at cs.washington.edu
Sat Oct 8 08:48:35 PDT 2011
Sebastian-
> >> Isn't there a JSR for some annotations and standard processing of them?
> > Yes, it's JSR 269, which lets you make javac run an annotation processor as
> > a plugin, via a command-line argument or via auto-discovery.
> i mean JSR 308.
For those not familiar with it, JSR 308 augments Java's annotation syntax
by permitting annotations to be written on uses of types. Its webpage is
http://types.cs.washington.edu/jsr308/
JSR 308 is about type annotations in particular, not about annotation
processing in general. So, I assume you are asking about type annotation
processors.
> Is there a common processing defined
Here's a section from the JSR 308 FAQ
(http://types.cs.washington.edu/jsr308/jsr308-faq.html#checkers-in-java):
Is pluggable type-checking (such as supported by the Checker Framework)
included in JSR 308 or the Java language?
The Java language defines an annotation processing capability (JSR
269). Using this capability, it is possible to write annotation processors
that read and process all sorts of annotations, including type
annotations. Pluggable type-checking is one sort of annotation processing.
Pluggable type-checking would be impractical without the Type Annotations
(JSR 308) language syntax. Given the new syntax, pluggable type-checking
can be implemented entirely by libraries, and there is no need for it to be
an official part of the Java language. The Checker Framework is an example
of a library that enables you to create and use pluggable type-checkers.
The Checker Framework is an independent tool and not a part of the Type
Annotations proposal. The Checker Framework distribution includes the Type
Annotations compiler for convenience, so that users only have to download
and install one file.
> (will there be a
> implementation of an annotation processor in the jdk)?
This is not currently planned. However, users will be able to use
third-party ones (it is planned to make some available as Jigsaw modules
for easy downloading and use). And, users can always define and use their
own, either from scratch or using an existing framework such as the
above-mentioned Checker Framework.
It is possible, though not yet certain, that some annotations such as
@NonNull and @Nullable will appear in the JDK and that the JDK will be
annotated with them.
> And will it be plugged in javac by default or have i to call javac with the
> parameters -proc -processor and -processorpath ?
javac already has a processor discovery mechanism that permits running
annotation processors without the need to supply all the command-line
arguments. I think this can be re-used without change.
-Mike
More information about the jdk8-dev
mailing list