Bug 148737 - IllegalStateException for non-generic type
Summary: IllegalStateException for non-generic type
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.2RC1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 1.5.3   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-26 20:09 EDT by Brian Keyser CLA
Modified: 2006-07-05 05:48 EDT (History)
1 user (show)

See Also:


Attachments
Simple class with non-utilized generic (575 bytes, text/plain)
2006-06-30 12:11 EDT, Brian Keyser CLA
no flags Details
Class that extends B (131 bytes, text/plain)
2006-06-30 12:12 EDT, Brian Keyser CLA
no flags Details
Class that obtains an aspect. (199 bytes, text/plain)
2006-06-30 12:13 EDT, Brian Keyser CLA
no flags Details
"Controlling method" used in the aspect (186 bytes, text/java)
2006-06-30 12:14 EDT, Brian Keyser CLA
no flags Details
aspect that causes the parameterization error (678 bytes, application/octet-stream)
2006-06-30 12:15 EDT, Brian Keyser CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Keyser CLA 2006-06-26 20:09:45 EDT
I believe this is similar to 112880.  The message and stack trace I am getting are

 -- (IllegalStateException) Can't ask to parameterize a member of non-generic type: com...object  kind(raw)
Can't ask to parameterize a member of non-generic type: com...object  kind(raw)
java.lang.IllegalStateException: Can't ask to parameterize a member of non-generic type: com....object  kind(raw)
	at org.aspectj.weaver.ResolvedMemberImpl.parameterizedWith(ResolvedMemberImpl.java:612)
	at org.aspectj.weaver.ResolvedMemberImpl.parameterizedWith(ResolvedMemberImpl.java:597)
	at org.aspectj.weaver.ReferenceType.getDeclaredMethods(ReferenceType.java:508)
	at org.aspectj.weaver.ResolvedType$4.get(ResolvedType.java:225)
	at org.aspectj.weaver.Iterators$3$1.hasNext(Iterators.java:118)
	at org.aspectj.weaver.Iterators$5.hasNext(Iterators.java:171)
	at org.aspectj.weaver.Iterators$3.hasNext(Iterators.java:128)
	at org.aspectj.weaver.ResolvedType.lookupMember(ResolvedType.java:345)
	at org.aspectj.weaver.ResolvedType.lookupMethod(ResolvedType.java:326)
.
.
.

The same code was able to be weaved under 1.5.0.  The reason why this is a major issue is 1.5.0 suffers from a StackOverflowException.
Comment 1 Brian Keyser CLA 2006-06-26 22:40:25 EDT
The stackoverflow bug was 125101.
Comment 2 Andrew Clement CLA 2006-06-27 03:10:40 EDT
Does comment #1 about 125101 apply to this bug?  since the exception included in the initial text is an IllegalStateException?

I've seen this IllegalState occur for a few reasons.  Can I ask if you are doing a regular command line compile or are you in AJDT or are you doing loadtime weaving?

Did the code compile/weave ok under AspectJ 1.5.1a or did it also fail there?  

I'm very confused by the text of the message as it says the declaring type is 'com...object' ??!  Do you have a package called that?  Is there any way you can summarize your type hierarchy (the part that includes generic signatures) so that I can investigate further?
Comment 3 Andrew Clement CLA 2006-06-30 03:59:34 EDT
have you managed to try this on 1.5.1a yet?
Comment 4 Brian Keyser CLA 2006-06-30 12:11:36 EDT
Created attachment 45597 [details]
Simple class with non-utilized generic
Comment 5 Brian Keyser CLA 2006-06-30 12:12:30 EDT
Created attachment 45598 [details]
Class that extends B
Comment 6 Brian Keyser CLA 2006-06-30 12:13:33 EDT
Created attachment 45599 [details]
Class that obtains an aspect.
Comment 7 Brian Keyser CLA 2006-06-30 12:14:10 EDT
Created attachment 45601 [details]
"Controlling method" used in the aspect
Comment 8 Brian Keyser CLA 2006-06-30 12:15:17 EDT
Created attachment 45602 [details]
aspect that causes the parameterization error
Comment 9 Brian Keyser CLA 2006-06-30 12:21:02 EDT
Hi Andy,

I was able to create a small test reproducible test case.  You will have to forgive the obfuscation, but it was the best I could do.  I have attached the following files:  A.java, B.java, C.java, D.java, and TestAspect.aj.  The command I used to compile the files is

% ajc -source 5 -target 5 -inpath C:\Software\hibernate.org\hibernate-3.1\hibernate3.jar A.java B.java C.java D.java TestAspect.aj

Obviously, you will need the hibernate3.jar for the compilation.

The bug 148738 is related to this bug as you will see from the output.

The same problem happens with 1.5.1a.

If you have any questions, please let me know.
Comment 10 Andrew Clement CLA 2006-07-03 09:44:20 EDT
I've made a shorter test program that demonstrates the failure (didn't need hibernate):

=========8<============
public abstract class A<E> {	
    public A() { }
    public void setUniqueID(Object o) {}
}

class B extends A {
    public B() {}    
}

class D {
    public void method() {
        B b = new B();
        b.setUniqueID(null);
    }
}

aspect TestAspect {
	before(): call(public void *.*()) { }    
}

=========8<============

ajc -source 5 -target 5 A.java

It turns out the actual problem is that you are supplying "-source 5" rather than "-source 1.5".  Although the compiler sees these as equivalent, the weaver only understands "1.5".  Typically we invoke the compiler with this shorthand:

ajc -1.5 A.java

So - I've made the weaver understand "5".

Just to confirm this is what you are seeing, can you try supplying the option as "1.5".  My fix should be in a dev build shortly (this is probably the fix for the other bug too...)
Comment 11 Andrew Clement CLA 2006-07-04 09:00:15 EDT
fix to also support "5" is in the latest AJ dev build.
Comment 12 Andrew Clement CLA 2006-07-05 05:48:27 EDT
fix is available - please reopen if you continue to have problems.