[JSR308] Raw Types and AnnotatedTypeFactory

Niko Matsakis niko at alum.mit.edu
Sat Mar 14 03:01:30 EDT 2009


Currently, when the JSR308 framework encounters raw types, it attempts  
to create a corresponding generic type so as to hide the "raw-ness"  
from the rest of the system.  It does by introducing the type bounds  
as arguments.  For example, a reference to "Class" would become  
"Class<Object>".  Clearly, though, such a type does not behave the  
same as "Class" in every case-- indeed, I believe that there is no  
generic type that could do so.  To that end, I think it would make  
sense to leave raw types as raw (i.e., with no type arguments), and  
adjust code in the various checkers to handle raw types.

First, do others agree that this makes sense?

Second, would this require far-reaching changes in the framework?  As  
I am trying to use my checker on some raw-typed code, I intend to give  
it a try and see what breaks, but I'd appreciate any obvious  
warnings.  If I do get it to a stable state, I can send along the  
patch if it is of interest.  Of course, I might find it easier to  
generify the code in question...

Finally, even if the current behavior were preserved, I don't believe  
the code as written would work correctly in the face of fully "F- 
polymorphic" bounds (i.e., a class definition like "class C<X, Y  
extends X>").  If I understand correctly, such a type would become  
something like "C<Object, X>", where X is not necessarily in-scope at  
the point being type-checked.

Niko Matsakis

More information about the JSR308 mailing list