| Summary: | ajc failure when classpath is missing generic type parameter | ||
|---|---|---|---|
| Product: | [Tools] AspectJ | Reporter: | Trask Stalnaker <trask.stalnaker> |
| Component: | Compiler | Assignee: | aspectj inbox <aspectj-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | aclement |
| Version: | 1.6.10 | ||
| Target Milestone: | 1.6.11 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
thanks for the testcase! No problem, thanks for targeting to 1.6.11.
I ran into one more that is a slightly different pattern (though same exception in ajcore file).
This repro, however, fails on both 1.6.10 and 1.6.8. Not sure where I went wrong when I reduced this repro (in my full environment it only fails on 1.6.10), but I'm happy to test a patch or dev build when available to validate in my full environment.
public class M {}
public class A<T> {
public void a(Class<? extends M> list) {}
public void x() {
a(null);
}
}
@Aspect
public class MyAspect {
@Before("call(* *.*(..)) && target(x)")
public void myAdvice(CharSequence x) {
System.out.println();
}
}
javac M.java A.java
jar cf M.jar M.class
jar cf A.jar A.class
javac -g -classpath %ASPECTJ_HOME%\lib\aspectjrt.jar MyAspect.java
jar cf aspects.jar MyAspect.class
%ASPECTJ_HOME%\bin\ajc -1.5 -inpath A.jar -aspectpath aspects.jar -outjar out.jar -classpath %ASPECTJ_HOME%\lib\aspectjrt.jar
both of these fixed in HEAD now (with regression tests). Likely to be a couple more similar scenarios as we don't have all the checks in place to make sure the type is found before treating it as a ReferenceType. Thanks for looking at it so quickly. I tested it out. Is there a way to make these test cases just generate a missing type warning and not terminate the weaving, similar to how some other missing types are handled and controllable via Xlint "cantFindType" (or something like that)? done, now xlints - of course you may get unpredictable results later in the process as the types are missing and bounds default to Object. I tested it against my full environment, looks good, thanks again. |
Build Identifier: 1.6.10 I tried to upgrade from 1.6.8 to 1.6.10 and ran into this issue. It fails in 1.6.9, 1.6.10 and 1.6.11.m1. It works in 1.6.8. An ajcore file is generated pointing to -- (ClassCastException) org.aspectj.weaver.MissingResolvedTypeWithKnownSignature cannot be cast to org.aspectj.weaver.ReferenceType org.aspectj.weaver.MissingResolvedTypeWithKnownSignature cannot be cast to org.aspectj.weaver.ReferenceType java.lang.ClassCastException: org.aspectj.weaver.MissingResolvedTypeWithKnownSignature cannot be cast to org.aspectj.weaver.ReferenceType at org.aspectj.weaver.TypeVariableReferenceType.getDelegate(TypeVariableReferenceType.java:44) at org.aspectj.weaver.ReferenceType.getTypeVariables(ReferenceType.java:810) at org.aspectj.weaver.bcel.BcelGenericSignatureToTypeXConverter.fixUpCircularDependencies(BcelGenericSignatureToTypeXConverter.java:231) at org.aspectj.weaver.bcel.BcelGenericSignatureToTypeXConverter.typeSignature2TypeX(BcelGenericSignatureToTypeXConverter.java:180) at org.aspectj.weaver.bcel.BcelMethod.unpackGenericSignature(BcelMethod.java:564) at org.aspectj.weaver.bcel.BcelMethod.getGenericReturnType(BcelMethod.java:497) at org.aspectj.weaver.ResolvedMemberImpl.parameterizedWith(ResolvedMemberImpl.java:756) at org.aspectj.weaver.ResolvedMemberImpl.parameterizedWith(ResolvedMemberImpl.java:709) at org.aspectj.weaver.ReferenceType.getDeclaredMethods(ReferenceType.java:766) at org.aspectj.weaver.ResolvedType.lookupMethod(ResolvedType.java:534) at org.aspectj.weaver.World.resolve(World.java:626) ... Reproducible: Always Steps to Reproduce: I have been able to reduce this to following minimal repro (these steps generate an ajcore file in 1.6.9, 1.6.10 and 1.6.11.m1, while the same steps succeed in 1.6.8): public class M {} public class A<T extends M> { public void a(T t) { } } public class B<T extends M> extends A<T> { public void b() { a(null); } } @Aspect public class MyAspect { @Before("call(* *.*(..))") public void myAdvice() { System.out.println(); } } javac M.java A.java B.java jar cf M.jar M.class jar cf AB.jar A.class B.class javac -classpath %ASPECTJ_HOME%\lib\aspectjrt.jar MyAspect.java jar cf aspects.jar MyAspect.class %ASPECTJ_HOME%\bin\ajc -1.5 -inpath AB.jar -aspectpath aspects.jar -outjar out.jar -classpath %ASPECTJ_HOME%\lib\aspectjrt.jar