[Checkers] Comments on Prototype hierarchy

Michael Ernst mernst at cs.washington.edu
Tue Jun 2 13:18:51 EDT 2009


Mahmood-

> I played with the Prototype checker for a bit today.

Thanks!

> Here is my comment:
> 1. The type hierarchy could benefit from a bottom type.  Actually,  
> almost all qualifier hierarchies benefits from a bottom qualifier to  
> handle null.  In IGJ the bottom qualifier is packaged scope, so users  
> cannot use it.

That sounds possibly reasonable.  Should it be built into every checker by
default, including the basic checker?  Should it have a standard name?

> I think it might be better for create a PrototypeChecker class that  
> only has TypeQualifier fields (analogous to NullnessChecker) which  
> utilizes a package scope qualifier for null.

When in particular does a programmer want to use the bottom qualifier?  
I believe you, but some concrete examples would be useful.

> 2. I think that you might reconsider your default option.  In your  
> previous email about defaults you wanted the default to be  
> NonPrototype, rather than the root qualifier PrototypeOrNot.  I think  
> that could cause a problem to flow, as we designed it to be type  
> refinement rather than type inference.  The following statement would  
> be invalid:
>    Invariant inv = new @Prototype Invariant(...);
> 
> Because inv in defaults would be of type '@NonPrototype Invariant'  
> which cannot be refined to '@Prototype Invariant'.

I see @Prototype as as aberration.  Any use must be explicitly noted, even
in a method body.  I am happy that
    Invariant inv = new @Prototype Invariant(...);
is invalid.  This should be written as
    @Prototype Invariant inv = new @Prototype Invariant(...);

                    -Mike



More information about the checkers mailing list