[Checkers] Package @DefaultQualifier annotations

Michael Ernst mernst at cs.washington.edu
Wed Jun 10 00:37:59 EDT 2009


Are @DefaultQualifier annotations respected when they appear on a package?
They don't seem to be.  Using the attached zip file, when I run these
commands in the parent directory of testPackage:

javac typequals/*.java
javac -processor checkers.basic.BasicChecker -Aquals=typequals.Prototype,typequals.NonPrototype,typequals.PrototypeOrNot -implicit:class -Xlint:-processing -cp .:$CLASSPATH ./testPackage/package-info.java ./testPackage/innerPackage/MyFile.java ./testPackage/innerPackage/package-info.java

I get this output:

./testPackage/innerPackage/MyFile.java:9: incompatible types.
    return f;
  found   : @PrototypeOrNot Float
  required: @NonPrototype Float
1 error

I think that the checker should succeed without issuing any errors, because
the default should be @NonPrototype, but for some reason the default is
being treated as @PrototypeOrNot.

Additionally, if the
file is removed, I think type-checking should still succeed, because I
would assume that the default for testPackage applies to all subpackages as

Request:  In addition to fixing the above problem and adding tests, can you
please update the @DefaultQualifier Javadoc?  I would like it 
to say  what is the meaning of an annotation on a package (does it apply to
sub-packages?), and I would like it to say what the default is if no
@DefaultQualifier annotation is present.

When all this is done, I will proceed with the Daikon nullness case study.



More information about the checkers mailing list