Thanks for your question.
I'd like to differentiate the syntax that is permitted by JSR 308 (Java's
type annotations syntax) and the subset of that syntax that is used by the
Checker Framework. I'm not positive which of these you are referring to.
> public static <T extends /*@Nullable*/ Object> T identity(T object)
> { return object; } // works
> public static </*@Nullable*/ T> T identity(T object) { return
> object; } // works
>
> Is the latter officially supported (the manual only mentions the
> former).
These are both permitted by JSR 308.
Only the latter is officially supported by the Checker Framework (I guess
that's the manual you are referring to).
Someone could build a tool that uses the latter, or could enhance the
Checker Framework to use the latter.
> Also, for classes, only the former construct works, could somebody
> comment on this?
>
> class Test<T extends /*@Nullable*/ Object> {} // works
> class Test</*@Nullable*/ T> {} // doesn't work
Our rationale was that having two distinct syntaxes for the same concept
could be confusing to users, and the former more closely corresponds to the
type-checker's rules. (Or, do you want the two syntaxes to mean different
things?)
-Mike
PS: If the discussion is about the Checker Framework, then let's move
followups to checker-fram...@googlegroups.com .