Bug 322664 - fixing a broken generic type can give an IllegalStateException
Summary: fixing a broken generic type can give an IllegalStateException
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 1.6.10   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-13 11:15 EDT by Andrew Clement CLA
Modified: 2010-08-13 11:45 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2010-08-13 11:15:26 EDT
Revealed by this program:

public abstract aspect AbstractAspect<S, T> {
 declare parents : Class extends S;
 declare parents : Class extends T;
}

aspect Aspect extends AbstractAspect<X, Y> {
/* void something(X x) {
  something(new Class());
 }
 void something2(Y y) {
  something2(new Class());
 }*/
}

interface X { }
interface Y { }

class Class {


}

1. save it like that
2. change AbstractAspect to remove ',T' from the declaration - results in error on save
3. fix the error (add ', T' back again) and save, IllegalStateException
Comment 1 Andrew Clement CLA 2010-08-13 11:16:48 EDT
The problem here is the ReferenceType is caching the TypeVariable information from the underlying delegate and not reseting it when the delegate is changed.  On the 3rd build (that fixes the problem) the delegate is correct for aspect but the ReferenceType.typeVariables field still points to the old broken single variable version.  By clearing the cached state when the delegate is reset (in ReferenceType.ensureConsistent) - the problem is fixed.
Comment 2 Andrew Clement CLA 2010-08-13 11:45:07 EDT
test and fix committed