[Checkers] [JSR308] Stub files?

Michael Ernst mernst at csail.mit.edu
Fri Oct 3 15:18:19 EDT 2008


Niko-

I'm following up to Mahmood's response, which I believe covered most of the
bases.

> Poking about in the source, I don't see any entry for "stubs" in  
> OptionName.java or RecognizedOptions.java.  Are stubs implemented in  
> javac, or not yet?

As a minor point, since they are used by the Checker Framework but aren't
part of the Java standard, this option would never be implemented in javac.

> If and when they are implemented, is there a plan to allow a  
> "stubpath" (similar to sourcepath) that would point at a directory  
> full of stub files?  Having to add each .stubs entry individually to  
> the command line would seem to be a somewhat limiting interface.

Yes, this is a good idea.

Another nice option might be for checkers to know a canonical place to find
stub files, and to use those without requiring users to supply an
additional flag (unless the users want to use additional stub files).  This
would require either:  specifying the standard ones when specifying others,
or a way to disable use of the standard ones when none are desired.

> Another interesting feature would be the ability to union together  
> multiple stub entries for different, independent checkers.

Can you let us know why you want to do this?  We are slightly concerned
that the stub files might become unreadable with too many annotations in
that case -- it seems that it might be preferable to keep them separate, so
each can be considered separately.

> I realize that the existing checkers use the "-sourcepath" technique  
> for annotating the standard library, but the manual made it sound as  
> though that was undesirable.

Skeleton classes are inferior to stub classes for two reasons.  First,
skeleton files must be on the classpath during compilation but must not be
on the classpath during execution; this is inconvenient and error-prone.
Second, the skeleton files contain incorrect values for certain static
final fields.  These incorrect values can lead to run-time problems unless
the Java code is re-compiled without the skeleton classes after
type-checking is complete.

                    -Mike



More information about the checkers mailing list