Project: AspectJ
Bug 124803 [generics] mixing and matching numbers of type variables/parameters in a hierarchy
Reported: 2006-01-22 09:50:51 | Status: resolved fixed

Hi guys! I didn't talk to you for a while, but I've found several new issues related to generics. Here is the first and the most annoying one: 1) Just compile the testcase with iajc and you will get "java.lang.IllegalStateException: Wrong number of type parameters supplied" Java Code: ========= public interface Generic1<T extends Number> { public void foo(T p); } public interface Generic2<T extends Number, Y extends Number> extends Generic1<T> { public void foo2(Y p); } public class Test<Y extends Number> implements Generic2<Y,Y>{ public void foo2(Y p) { } public void foo(Y p) { } } Aspect: ======= public privileged aspect TestAspect { pointcut TestInheritance(Test test) : target(test) && execution (* com.mprv.secsph.Generic1.*(..)); after (Test test) : TestInheritance(test) { System.out.println("GO Aspects!"); } } Exception: ========== iajc abort trouble in: public class com.mprv.secsph.Test extends java.lang.Object implements com.mprv.secsph.Generic2: public void <init>(): ALOAD_0 // com.mprv.secsph.Test this (line 10) INVOKESPECIAL java.lang.Object.<init> ()V constructor-execution(void com.mprv.secsph.Test.<init>()) | RETURN constructor-execution(void com.mprv.secsph.Test.<init>()) end public void <init>() public void foo2(Number) org.aspectj.weaver.MethodDeclarationLineNumber: 11:259 : RETURN (line 12) end public void foo2(Number) public void foo(Number) org.aspectj.weaver.MethodDeclarationLineNumber: 13:287 : RETURN (line 14) end public void foo(Number) end public class com.mprv.secsph.Test -- (IllegalStateException) Wrong number of type parameters supplied Wrong number of type parameters supplied java.lang.IllegalStateException: Wrong number of type parameters supplied at org.aspectj.weaver.ResolvedMemberImpl.parameterizedWith(ResolvedMemberImpl.java:609) at org.aspectj.weaver.ResolvedMemberImpl.parameterizedWith(ResolvedMemberImpl.java:590) at org.aspectj.weaver.ReferenceType.getDeclaredMethods(ReferenceType.java:472) at org.aspectj.weaver.ResolvedType.addAndRecurse(ResolvedType.java:262) at org.aspectj.weaver.ResolvedType.addAndRecurse(ResolvedType.java:301) at org.aspectj.weaver.ResolvedType.getMethodsWithoutIterator(ResolvedType.java:257) at org.aspectj.weaver.ResolvedType.lookupResolvedMember(ResolvedType.java:375) at org.aspectj.weaver.JoinPointSignatureIterator.findSignaturesFromSupertypes(JoinPointSignatureIterator.java:177) at org.aspectj.weaver.JoinPointSignatureIterator.hasNext(JoinPointSignatureIterator.java:68) at org.aspectj.weaver.patterns.SignaturePattern.matches(SignaturePattern.java:286) at org.aspectj.weaver.patterns.KindedPointcut.matchInternal(KindedPointcut.java:106) at org.aspectj.weaver.patterns.Pointcut.match(Pointcut.java:145) at org.aspectj.weaver.patterns.AndPointcut.matchInternal(AndPointcut.java:55) at org.aspectj.weaver.patterns.Pointcut.match(Pointcut.java:145) at org.aspectj.weaver.patterns.AndPointcut.matchInternal(AndPointcut.java:55) at org.aspectj.weaver.patterns.Pointcut.match(Pointcut.java:145) at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:64) at org.aspectj.weaver.Advice.match(Advice.java:109) at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:104) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2149) at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:1716) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:458) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:105) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1543) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1494) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1275) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1097) at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.weave(AjCompilerAdapter.java:300) at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterCompiling(AjCompilerAdapter.java:178) at org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$afterReturning$org_aspectj_ajdt_internal_compiler_CompilerAdapter$2$f9cc9ca0(CompilerAdapter.aj:70) at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:367) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:819) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:234) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:157) at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) at org.aspectj.tools.ajc.Main.run(Main.java:326) at org.aspectj.tools.ajc.Main.runMain(Main.java:240) at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1254) at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1048) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40) at org.apache.tools.ant.Project.executeTargets(Project.java:1068) at org.apache.tools.ant.Main.runBuild(Main.java:668) at org.apache.tools.ant.Main.startAnt(Main.java:187) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:16) warning at after (Test test) : TestInheritance(test) { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /root/IdeaProjects/aspectsTest/src/com/mprv/secsph/TestAspect.aj:44:0::0 advice defined in com.mprv.secsph.TestAspect has not been applied [Xlint:adviceDidNotMatch]

Files changed in fix:
tests/bugs151/pr124803/Test.java tests/bugs151/pr124803/Test2.java tests/bugs151/pr124803/TestAspect.java tests/bugs151/pr124803/TestAspect2.java tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java weaver/src/org/aspectj/weaver/ReferenceType.java