From a3ee66152903e1de3dce8cc30b2741dfdafb2614 Mon Sep 17 00:00:00 2001 From: acolyer Date: Tue, 30 Aug 2005 11:39:52 +0000 Subject: [PATCH] fix for pr108425, type parameter used in method of anonymous inner type. --- weaver/src/org/aspectj/weaver/bcel/BcelMethod.java | 3 +-- .../src/org/aspectj/weaver/bcel/BcelObjectType.java | 12 +++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java index e38b6fae8..89f6d67ea 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java @@ -272,8 +272,7 @@ final class BcelMethod extends ResolvedMemberImpl { // generic method declaration canBeParameterized = true; } - Signature.ClassSignature genericTypeSig = bcelObjectType.getGenericClassTypeSignature(); - Signature.FormalTypeParameter[] parentFormals = (genericTypeSig != null ? genericTypeSig.formalTypeParameters : new Signature.FormalTypeParameter[0]); + Signature.FormalTypeParameter[] parentFormals = bcelObjectType.getAllFormals(); Signature.FormalTypeParameter[] formals = new Signature.FormalTypeParameter[parentFormals.length + mSig.formalTypeParameters.length]; // put method formal in front of type formals for overriding in lookup diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java index e8db048c6..3a791072b 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java @@ -501,13 +501,14 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { } private boolean genericSignatureUnpacked = false; + private Signature.FormalTypeParameter[] formalsForResolution = null; private void unpackGenericSignature() { if (genericSignatureUnpacked) return; genericSignatureUnpacked = true; Signature.ClassSignature cSig = getGenericClassTypeSignature(); if (cSig != null) { - Signature.FormalTypeParameter[] formalsForResolution = cSig.formalTypeParameters; + formalsForResolution = cSig.formalTypeParameters; if (isNestedClass()) { // we have to find any type variables from the outer type before proceeding with resolution. Signature.FormalTypeParameter[] extraFormals = getFormalTypeParametersFromOuterClass(); @@ -545,6 +546,15 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { } } + public Signature.FormalTypeParameter[] getAllFormals() { + unpackGenericSignature(); + if (formalsForResolution == null) { + return new Signature.FormalTypeParameter[0]; + } else { + return formalsForResolution; + } + } + private boolean isNestedClass() { return javaClass.getClassName().indexOf('$') != -1; } -- 2.39.5