diff options
author | Andy Clement <aclement@pivotal.io> | 2015-09-03 14:19:10 -0700 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2015-09-03 14:19:10 -0700 |
commit | 2233cf023bce0168435795ab5747dae59fbd9a0d (patch) | |
tree | cdaa8d6ef69ef6abd123ab0d70a212d21e993f3c /weaver | |
parent | a9ea7010ab7075d934aeb49d48dec33d48b722c4 (diff) | |
download | aspectj-2233cf023bce0168435795ab5747dae59fbd9a0d.tar.gz aspectj-2233cf023bce0168435795ab5747dae59fbd9a0d.zip |
307147: missing joinpoints for itds invoking private methods
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java | 7 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | 1 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelWorld.java | 26 |
3 files changed, 34 insertions, 0 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java index 88b1090c2..b4eaa3dd4 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java @@ -3209,6 +3209,13 @@ class BcelClassWeaver implements IClassWeaver { if (canMatch(Shadow.FieldGet) || canMatch(Shadow.FieldSet)) { match(BcelShadow.makeShadowForMethodCall(world, mg, ih, enclosingShadow, kind, declaredSig), shadowAccumulator); } + } else if (!declaredSig.getName().startsWith(NameMangler.PREFIX)) { + // 307147 - resolution above may have found the real method directly rather + // than needing to go through the effective signature attribute + if (canMatch(Shadow.MethodCall)) { + match(BcelShadow.makeShadowForMethodCall(world, mg, ih, enclosingShadow, Shadow.MethodCall, declaredSig), + shadowAccumulator); + } } else { AjAttribute.EffectiveSignatureAttribute effectiveSig = declaredSig.getEffectiveSignature(); if (effectiveSig == null) { diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java index 9e5b6a210..7a637bb2d 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java @@ -44,6 +44,7 @@ import org.aspectj.bridge.MessageUtil; import org.aspectj.bridge.WeaveMessage; import org.aspectj.bridge.context.CompilationAndWeavingContext; import org.aspectj.bridge.context.ContextToken; +import org.aspectj.weaver.AjAttribute; import org.aspectj.weaver.AjcMemberMaker; import org.aspectj.weaver.AnnotationAJ; import org.aspectj.weaver.AnnotationOnTypeMunger; diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java index 4f0dfe1bc..de9e29aba 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java @@ -630,6 +630,32 @@ public class BcelWorld extends World implements Repository { UnresolvedType declaringType = null; String signature = ii.getSignature(cpg); + + // 307147 + if (name.startsWith("ajc$privMethod$")) { + // The invoke is on a privileged accessor. These may be created for different + // kinds of target, not necessarily just private methods. In bug 307147 it is + // for a private method. This code is identifying the particular case in 307147 + try { + declaringType = UnresolvedType.forName(declaring); + String typeNameAsFoundInAccessorName = declaringType.getName().replace('.', '_'); + int indexInAccessorName = name.lastIndexOf(typeNameAsFoundInAccessorName); + if (indexInAccessorName != -1) { + String methodName = name.substring(indexInAccessorName+typeNameAsFoundInAccessorName.length()+1); + ResolvedType resolvedDeclaringType = declaringType.resolve(this); + ResolvedMember[] methods = resolvedDeclaringType.getDeclaredMethods(); + for (ResolvedMember method: methods) { + if (method.getName().equals(methodName) && method.getSignature().equals(signature) && Modifier.isPrivate(method.getModifiers())) { + return method; + } + } + } + } catch (Exception e) { + // Remove this once confident above code isn't having unexpected side effects + // Added 1.8.7 + e.printStackTrace(); + } + } int modifier = (ii instanceof INVOKEINTERFACE) ? Modifier.INTERFACE : (ii.opcode == Constants.INVOKESTATIC) ? Modifier.STATIC : (ii.opcode == Constants.INVOKESPECIAL && !name |