From: aclement Date: Wed, 11 Jun 2008 18:24:25 +0000 (+0000) Subject: 197719: test and fix: advising protected method calls from inner classes X-Git-Tag: V1_6_1rc1~67 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3b13e9b46e82001b285bbc61634ec1c446e84343;p=aspectj.git 197719: test and fix: advising protected method calls from inner classes --- diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java index 99cb6f387..dbf68b730 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java @@ -3448,15 +3448,23 @@ public class BcelShadow extends Shadow { } ResolvedMember resolvedMember = getSignature().resolve(world); - // pr230075 + // pr230075, pr197719 if (resolvedMember != null && Modifier.isProtected(resolvedMember.getModifiers()) && !samePackage(resolvedMember.getDeclaringType().getPackageName(), getEnclosingType().getPackageName()) && !resolvedMember.getName().equals("clone")) { - if (!targetType.resolve(world).isAssignableFrom(getThisType().resolve(world))) { - throw new BCException("bad bytecode"); + if (!hasThis()) { // pr197719 - static accessor has been created to handle the call + if (Modifier.isStatic(enclosingMethod.getAccessFlags()) && enclosingMethod.getName().startsWith("access$")) { + targetType = BcelWorld.fromBcel(enclosingMethod.getArgumentTypes()[0]); + } else { + throw new BCException("unexpectedly found static context at shadow "+toString()+": accessor method involved?"); + } + } else { + if (!targetType.resolve(world).isAssignableFrom(getThisType().resolve(world))) { + throw new BCException("bad bytecode"); + } + targetType = getThisType(); } - targetType = getThisType(); } parameterTypes = addType(BcelWorld.makeBcelType(targetType), parameterTypes); }