Annotation File Utilities version 3.0 has been released

2 views
Skip to first unread message

Michael Ernst

unread,
Dec 21, 2009, 4:48:40 PM12/21/09
to jsr308-...@googlegroups.com
We have released version 3.0 of the Annotation File Utilities.
The Annotation File Utilities homepage, which includes installation
instructions, is http://types.cs.washington.edu/annotation-file-utilities/ .

The Annotation File Utilities let you read annotations from, and write
annotations to, 3 types of files: .java files, .class files, and
annotation files (an external file format).

Changes in version 3.0 include: Handling meta-annotations; distinguish
type annotations from declaration annotations; reading annotations from
classfiles; and changes to the annotation file format. The changelog entry
appears below. The full changelog is available at
http://types.cs.washington.edu/annotation-file-utilities/changelog.html .

-Michael Ernst


Version 3.0 (released December 21, 2009):

* Handle meta-annotations. Previously, the Annotation File Utilities
didn't handle meta-annotations (annotations that are written on an
annotation type declaration); in fact, AFU simply fabricated
retention information. Now, meta-annotations are handled uniformly
with other annotations.

* Distinguish type annotations from declaration annotations.
Previously, AFU assumed that all annotations were type
annotations. Now, this information is looked up from the
meta-annotations and is distinguished in the file format (see below).

* Read annotations from classfiles. Previously, AFU created partial
information for annotations in an ad hoc way, and classfile reading
did not work. (The focus was on inserting annotations in class files,
not reading annotations from class files.) Now, classfile reading is
operational, and it is often not necessary to declare annotations in
an annotation file. However, if the annotation is declared in the
annotation file, it should be consistent with its declaration in the
class file.

* Changes to annotation file format.

o Indicating meta-annotations

annotation visible @Nullable:

becomes

annotation @Nullable: @Retention(value=RUNTIME)

and if it's a type annotation, it should be

annotation @Nullable: @Retention(value=RUNTIME) @java.lang.annotation.Target(value={TYPE_USE})

o Locations for type and declaration annotations. If p2.B is a
declaration annotation on a method, it is written as before:

method foo(Ljava/util/Set;)V: @p2.B

If p2.B is a type annotation on a method return type, it is
written in a new location:

method foo(Ljava/util/Set;)V:
return: @p2.B

Fields and method parameters are treated similarly, but with
`type` marker instead of `return`. So if p2.A is a declaration
annotation targeting the field, while p2.B is a type annotation
on the field, the field would be declared as:

field s: @p2.A
type: @p2.B

o Permit qualified names in several places that only identifiers
were permitted before. This enables use of names that contain
periods, such as inner classes, and also fully-qualified names.

o Permit two shorthands in annotation uses, as in Java. If there
is a single field named "value", then its name may be omitted:
@A(1) instead of @A(value=1). If an array has only one element,
the braces may be omitted: @B(value=1) instead of
@B(value={1}). Both shorthands may be combined: @B(1) instead of
@B(value={1}).

Reply all
Reply to author
Forward
0 new messages