[JSR308] An implementation of Subtyping for Annotations

Dr. James J. Hunt jjh at aicas.de
Wed Aug 5 18:51:37 EDT 2009

Dear Colleagues,

Please find an implementation of Annotation subtyping attached.  The
work was done by Christian Haack, who recently joint the aicas team.
There is a ZIP archive with a javac.jar, the patch, and a directory with
some small tests.

This is a very small extension to the current version of the
specification that enables one to have single inheritance of annotations
and cyclical annotations as I have previously proposed.

The code checks for parsing cycles.  In my-tests/BadCycle.java, there is
a comment that explains why cyclic default definitions are problematic.
In my-tests/Avoiding-Non-Wellfoundednes.java, there is a comment
explaining what the cycle check does.

Adopting these changes would provide for subtying of annotation and the
expressive power needed to encode JML preconditions, postconditions, and
invariants in annotations.  There has been some discussion on the list
of how JML might be written.  That is not in the scope of this JSR, but
these changes would help JML to become better integrated into Java in
the future.  The other addition needed is block or statement level
annotations, but even just this would be a big boost to having a common
language for both source code level and byte code level tools.

Lex Spoon had brought up some points about readability of an annotation
encoding of JML.  There are some thoughts about how to address that too,
that will probably take too much time for Java 7.   Those ideas depend
on having inheritance and cycles in annotations too.

We still would need to look into the impact on the annotation checker


Dr. James J. Hunt      * CEO aicas GmbH        * Tel: +49 721 663968 22

aicas --- allerton interworks computer automated systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe     * Deutschland (Germany)
http://www.aicas.com   * Tel: +49 721 663968 0 * FAX: +49 721 663968 99

USt-Id: DE216375633, Handelsregister HRB 109481, AG Mannheim
Geschäftsführer: Dr. James J. Hunt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: annotation-inheritance.zip
Type: application/zip
Size: 1124635 bytes
Desc: not available
Url : https://lists.csail.mit.edu/pipermail/jsr308/attachments/20090806/b72ec7f7/attachment-0001.zip 

More information about the JSR308 mailing list