[Checkers] Interned checker throws ClassCastException

Mahmood Ali mahmood at MIT.EDU
Sat Mar 1 13:22:47 EST 2008


Hi guys,

I just woke up. I apologize again for breaking the code a lot  
yesterday, I am hoping to redeem myself in the future :(.

Upon actually run the IGJ checker against Daikon and Pastry,  
followings Mike's suggestion, I unearthed some bugs in framework and  
IGJ checker.

Here is a summary of the errors that I was getting and the fixes I made:

1. StackOverflow error whenever we have a recursive class declaration,  
e.g. Comparable<I extends Comparable> kinda thing.
Reason:
- AnnotatedTypeFactory tries to get the type of Comparable the class,  
and then tries to get the type variable I and bounds to Comparable the  
use, which requires getting the annotated type of Comparable class, etc.

Fix
- memoize the instances of AnnotatedDeclaredType produced by  
TypeAnnotator and return a *copy* of the desired type if one was  
already produced earlier.

2. NullPointerException whenever we have an assignment to array access  
in a multidimential array.
Reason:
- For some reason, InternalUtils.symbol() returns null for array[i][j]
Fix:
- Haven't been resolved yet. I added a check to see if it's null. In  
the future, It should return the element of arraytype

3. ClassCastExeption in AnnotatedTypeFactory.getReceiver, when the  
receiver is TypeVariable
Reason:
- Assumption is that the receiver of a method invocation or a member  
select is of DeclaredType. The cast to AnnotatedDeclaredType fails if  
it's actually AnnotatedTypeVariable
Fix:
- Remove the cast and change the return type of  
getReceiver(ExpressionTree) to AnnotatedTypeMirror

4. NullPointerException and StackOverflow when visiting anonymous  
constructors for inner classes.
I haven't investigated the issue thoroughly and it might actually a  
combination of the previous ones.
For now, I disabled the checks for the assignments made within  
anonymous constructors.

- Mahmood




More information about the checkers mailing list