Project: AspectJ
Bug 161502 UnsupportedOperationException thrown: unable to parameterize unresolved type: Pjava/util/List<+Ljava/lang/Object; >;
Reported: 2006-10-18 22:23:58 | Status: resolved fixed

Generic parameters (like List<? extends T>) in pointcuts throw UnsupportedOperationException. java.lang.UnsupportedOperationException at org.aspectj.weaver.UnresolvedType.parameterize(UnresolvedType.java: 220) at org.aspectj.weaver.patterns.ExactTypePattern.parameterizeWith (ExactTypePattern.java:244) at org.aspectj.weaver.patterns.SignaturePattern.parameterizeWith (SignaturePattern.java:265) at org.aspectj.weaver.patterns.KindedPointcut.parameterizeWith (KindedPointcut.java:381) at org.aspectj.weaver.bcel.BcelAdvice.parameterizeWith (BcelAdvice.java:93) at org.aspectj.weaver.ResolvedType.getDeclaredAdvice (ResolvedType.java:710) at org.aspectj.weaver.ResolvedType.getDeclaredShadowMungers (ResolvedType.java:739) at org.aspectj.weaver.ResolvedType.collectShadowMungers (ResolvedType.java:575) at org.aspectj.weaver.ResolvedType.collectCrosscuttingMembers (ResolvedType.java:504) at org.aspectj.weaver.CrosscuttingMembersSet.addOrReplaceAspect (CrosscuttingMembersSet.java:68) at org.aspectj.weaver.CrosscuttingMembersSet.addOrReplaceAspect (CrosscuttingMembersSet.java:57) at org.aspectj.weaver.bcel.BcelWeaver.prepareForWeave(BcelWeaver.java: 450) at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.weave (AjCompilerAdapter.java:299) at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterCompiling (AjCompilerAdapter.java:192) 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:887) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild (AjBuildManager.java:244) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild (AjBuildManager.java:163) at org.aspectj.ajde.internal.CompilerAdapter.compile (CompilerAdapter.java:122) at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run (AspectJBuildManager.java:191) UnsupportedOperationException thrown: unable to parameterize unresolved type: Pjava/util/List<+Ljava/lang/Object;>; To reproduce this exception compile the following code snippet. import java.util.ArrayList; import java.util.List; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; public class Main { public List<? extends Element> getElements() { return new ArrayList<Element>(); } class Element {}; @Aspect static abstract class Base<T> { @Around("call(List<? extends T> *.*(..))") public List<? extends T> elementList(ProceedingJoinPoint thisJoinPoint) { try { return (List<? extends T>)thisJoinPoint.proceed(); } catch (Throwable e) { throw new RuntimeException(e); } } } @Aspect static class Concrete extends Base<Element> {} public static void main(String[] args) { new Main().getElements(); } }

Files changed in fix:
tests/bugs153/pr161502/Main.java tests/bugs153/pr161502/Main2.java tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java weaver/src/org/aspectj/weaver/BoundedReferenceType.java weaver/src/org/aspectj/weaver/Checker.java weaver/src/org/aspectj/weaver/ReferenceType.java weaver/src/org/aspectj/weaver/ResolvedPointcutDefinition.java weaver/src/org/aspectj/weaver/ResolvedType.java weaver/src/org/aspectj/weaver/TypeVariable.java weaver/src/org/aspectj/weaver/TypeVariableReferenceType.java weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java weaver/src/org/aspectj/weaver/internal/tools/PointcutDesignatorHandlerBasedPointcut.java weaver/src/org/aspectj/weaver/patterns/AndAnnotationTypePattern.java weaver/src/org/aspectj/weaver/patterns/AndPointcut.java weaver/src/org/aspectj/weaver/patterns/AndTypePattern.java weaver/src/org/aspectj/weaver/patterns/AnnotationPatternList.java weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java weaver/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java weaver/src/org/aspectj/weaver/patterns/BindingTypePattern.java weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java weaver/src/org/aspectj/weaver/patterns/Declare.java weaver/src/org/aspectj/weaver/patterns/DeclareAnnotation.java weaver/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java weaver/src/org/aspectj/weaver/patterns/DeclareParents.java weaver/src/org/aspectj/weaver/patterns/DeclarePrecedence.java weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java weaver/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java weaver/src/org/aspectj/weaver/patterns/HandlerPointcut.java weaver/src/org/aspectj/weaver/patterns/HasMemberTypePattern.java weaver/src/org/aspectj/weaver/patterns/IfPointcut.java weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java weaver/src/org/aspectj/weaver/patterns/NotAnnotationTypePattern.java weaver/src/org/aspectj/weaver/patterns/NotPointcut.java weaver/src/org/aspectj/weaver/patterns/NotTypePattern.java weaver/src/org/aspectj/weaver/patterns/OrAnnotationTypePattern.java weaver/src/org/aspectj/weaver/patterns/OrPointcut.java weaver/src/org/aspectj/weaver/patterns/OrTypePattern.java weaver/src/org/aspectj/weaver/patterns/PerCflow.java weaver/src/org/aspectj/weaver/patterns/PerFromSuper.java weaver/src/org/aspectj/weaver/patterns/PerObject.java weaver/src/org/aspectj/weaver/patterns/PerSingleton.java weaver/src/org/aspectj/weaver/patterns/PerTypeWithin.java weaver/src/org/aspectj/weaver/patterns/Pointcut.java weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java weaver/src/org/aspectj/weaver/patterns/ThrowsPattern.java weaver/src/org/aspectj/weaver/patterns/TypePattern.java weaver/src/org/aspectj/weaver/patterns/TypePatternList.java weaver/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java weaver/src/org/aspectj/weaver/patterns/WithinPointcut.java weaver/src/org/aspectj/weaver/patterns/WithincodePointcut.java