[JSR308] Wrapper types
Michael Ernst
mernst at csail.mit.edu
Sun Mar 2 13:18:11 EST 2008
> A big concern I have is that for annotations that don't put Object at
> the base of the hierarchy (like @ReadOnly) break the paradigm that
> everything is assignable to Object. Many methods that simply take an
> object will be unusable unless retrofitted which may not be possible.
>
> Even simple code like:
> @ReadOnly Date d = ...;
> System.out.println(d);
>
> Won't work since PrintStream doesn't define a method that takes a
> @ReadOnly value.
Your example is correct: annotating existing libraries is necessary.
However, I don't understand your assertion that retrofitting "may not be
possible". Can you please explain why?
In the specific case of @ReadOnly, an inference tool (named Javarifier)
exists. It works on source or byte codes, and it can insert the resulting
annotations in the source code, in .class files, or in a separate file that
can be read by a type-checker.
-Mike
More information about the JSR308
mailing list