[Checkers] IGJ Unexpected errors
Mahmood Ali
mahmood at MIT.EDU
Sat Jul 12 01:22:34 EDT 2008
Greetings,
This is a response to the TODO item regarding IGJ errors:
> Running the IGJ checker over unannotated Daikon results in some
> errors,
> whereas we expect IGJ to be backward-compatible and thus to issue no
> errors
> for unannotated code. Mahmood explains this as follows:
>
> You get some errors as a result of type-checking the code twice.
> They are of the form:
> [...]
> ./daikon/inv/OutputFormat.java:30: call to super not allowed in enum
> constructor
> OutputFormat(String name) { this.name = name; }
> ^
> The compiler modified those trees (by adding some invalid code) after
> the first round of attribution; hence the errors are caught in the
> second round of attribution.
The quoted analysis is true as far as I know. Currently, checker
processors are run before the attribution phase just like any other
processors. Thus, each checker invokes attribution (review
SourceChecker.attribute(). The witnessed problem is not unique to
IGJ, but actually for all checkers if they do not emit any errors. If
the checker emits any error, the compiler stops further phases
(including the second round of attribution/type checking).
For demonstration, check the following case:
> mahmood-mac:jsr308 mahmood$ cat MyEnum.java
> public enum MyEnum {
> PRIVATE();
>
> MyEnum() { }
> }
> mahmood-mac:jsr308 mahmood$ jsr308-javac MyEnum.java
> mahmood-mac:jsr308 mahmood$ jsr308-javac -cp ~/checkers.jar -
> processor checkers.nullness.NullnessChecker MyEnum.java
> MyEnum.java:4: call to super not allowed in enum constructor
> MyEnum() { }
> ^
> 1 error
> mahmood-mac:jsr308 mahmood$ jsr308-javac -cp ~/checkers.jar -
> processor checkers.interning.InterningChecker MyEnum.java
> MyEnum.java:4: call to super not allowed in enum constructor
> MyEnum() { }
> ^
> 1 error
> mahmood-mac:jsr308 mahmood$ jsr308-javac -cp ~/checkers.jar -
> processor checkers.igj.IGJChecker MyEnum.java
> MyEnum.java:4: call to super not allowed in enum constructor
> MyEnum() { }
> ^
> 1 error
> mahmood-mac:jsr308 mahmood$ jsr308-javac -cp . -processor
> EmptyProcessor MyEnum.java
> mahmood-mac:jsr308 mahmood$
Regards,
Mahmood
More information about the checkers
mailing list