issue_id
int64
2.04k
425k
title
stringlengths
9
251
body
stringlengths
4
32.8k
status
stringclasses
6 values
after_fix_sha
stringlengths
7
7
project_name
stringclasses
6 values
repo_url
stringclasses
6 values
repo_name
stringclasses
6 values
language
stringclasses
1 value
issue_url
null
before_fix_sha
null
pull_url
null
commit_datetime
unknown
report_datetime
unknown
updated_file
stringlengths
23
187
chunk_content
stringlengths
1
22k
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
public void addInitializer(ConcreteTypeMunger cm) { NewFieldTypeMunger m = (NewFieldTypeMunger) cm.getMunger(); ResolvedType onType = m.getSignature().getDeclaringType().resolve(world); if (onType.isRawType()) { onType = onType.getGenericType(); } if (Modifier.isStatic(m.getSignature().getModifiers())) { addedClassInitializers.add(cm); } else { if (onType == ty.getResolvedTypeX()) { addedThisInitializers.add(cm); } else { IfaceInitList l = addedSuperInitializers.get(onType); l.list.add(cm); } } } private static class IfaceInitList implements PartialOrder.PartialComparable { final ResolvedType onType; List<ConcreteTypeMunger> list = new ArrayList<ConcreteTypeMunger>(); IfaceInitList(ResolvedType onType) { this.onType = onType; } public int compareTo(Object other) { IfaceInitList o = (IfaceInitList) other; if (onType.isAssignableFrom(o.onType)) { return +1; } else if (o.onType.isAssignableFrom(onType)) { return -1; } else {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
return 0; } } public int fallbackCompareTo(Object other) { return 0; } } public boolean addDispatchTarget(ResolvedMember m) { return addedDispatchTargets.add(m); } public void addLazyMethodGen(LazyMethodGen gen) { addedLazyMethodGens.add(gen); } public void addOrReplaceLazyMethodGen(LazyMethodGen mg) { if (alreadyDefined(clazz, mg)) { return; } for (Iterator<LazyMethodGen> i = addedLazyMethodGens.iterator(); i.hasNext();) { LazyMethodGen existing = i.next(); if (signaturesMatch(mg, existing)) { if (existing.definingType == null) { return; } else if (mg.definingType.isAssignableFrom(existing.definingType)) { return; } else if (existing.definingType.isAssignableFrom(mg.definingType)) { i.remove();
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
addedLazyMethodGens.add(mg); return; } else { throw new BCException("conflict between: " + mg + " and " + existing); } } } addedLazyMethodGens.add(mg); } private boolean alreadyDefined(LazyClassGen clazz, LazyMethodGen mg) { for (Iterator<LazyMethodGen> i = clazz.getMethodGens().iterator(); i.hasNext();) { LazyMethodGen existing = i.next(); if (signaturesMatch(mg, existing)) { if (!mg.isAbstract() && existing.isAbstract()) { i.remove(); return false; } return true; } } return false; } private boolean signaturesMatch(LazyMethodGen mg, LazyMethodGen existing) { return mg.getName().equals(existing.getName()) && mg.getSignature().equals(existing.getSignature()); } protected static LazyMethodGen makeBridgeMethod(LazyClassGen gen, ResolvedMember member) { int mods = member.getModifiers(); if (Modifier.isAbstract(mods)) { mods = mods - Modifier.ABSTRACT;
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} LazyMethodGen ret = new LazyMethodGen(mods, BcelWorld.makeBcelType(member.getReturnType()), member.getName(), BcelWorld.makeBcelTypes(member.getParameterTypes()), UnresolvedType.getNames(member.getExceptions()), gen); return ret; } /** * Create a single bridge method called 'theBridgeMethod' that bridges to 'whatToBridgeTo' */ private static void createBridgeMethod(BcelWorld world, LazyMethodGen whatToBridgeToMethodGen, LazyClassGen clazz, ResolvedMember theBridgeMethod) { InstructionList body; InstructionFactory fact; int pos = 0; ResolvedMember whatToBridgeTo = whatToBridgeToMethodGen.getMemberView(); if (whatToBridgeTo == null) { whatToBridgeTo = new ResolvedMemberImpl(Member.METHOD, whatToBridgeToMethodGen.getEnclosingClass().getType(), whatToBridgeToMethodGen.getAccessFlags(), whatToBridgeToMethodGen.getName(), whatToBridgeToMethodGen.getSignature()); } LazyMethodGen bridgeMethod = makeBridgeMethod(clazz, theBridgeMethod); int newflags = bridgeMethod.getAccessFlags() | 0x00000040; if ((newflags & 0x00000100) != 0) { newflags = newflags - 0x100; } bridgeMethod.setAccessFlags(newflags); Type returnType = BcelWorld.makeBcelType(theBridgeMethod.getReturnType()); Type[] paramTypes = BcelWorld.makeBcelTypes(theBridgeMethod.getParameterTypes()); Type[] newParamTypes = whatToBridgeToMethodGen.getArgumentTypes();
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
body = bridgeMethod.getBody(); fact = clazz.getFactory(); if (!whatToBridgeToMethodGen.isStatic()) { body.append(InstructionFactory.createThis()); pos++; } for (int i = 0, len = paramTypes.length; i < len; i++) { Type paramType = paramTypes[i]; body.append(InstructionFactory.createLoad(paramType, pos)); if (!newParamTypes[i].equals(paramTypes[i])) { if (world.forDEBUG_bridgingCode) { System.err.println("Bridging: Cast " + newParamTypes[i] + " from " + paramTypes[i]); } body.append(fact.createCast(paramTypes[i], newParamTypes[i])); } pos += paramType.getSize(); } body.append(Utility.createInvoke(fact, world, whatToBridgeTo)); body.append(InstructionFactory.createReturn(returnType)); clazz.addMethodGen(bridgeMethod); } /** * Weave a class and indicate through the return value whether the class was modified. * * @return true if the class was modified */ public boolean weave() { if (clazz.isWoven() && !clazz.isReweavable()) { if (world.getLint().nonReweavableTypeEncountered.isEnabled()) { world.getLint().nonReweavableTypeEncountered.signal(clazz.getType().getName(), ty.getSourceLocation());
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} return false; } Set<String> aspectsAffectingType = null; if (inReweavableMode || clazz.getType().isAspect()) { aspectsAffectingType = new HashSet<String>(); } boolean isChanged = false; if (clazz.getType().isAspect()) { isChanged = true; } WeaverStateInfo typeWeaverState = (world.isOverWeaving() ? getLazyClassGen().getType().getWeaverState() : null); for (ConcreteTypeMunger o : typeMungers) { if (!(o instanceof BcelTypeMunger)) { continue; } BcelTypeMunger munger = (BcelTypeMunger) o; if (typeWeaverState != null && typeWeaverState.isAspectAlreadyApplied(munger.getAspectType())) { continue; } boolean typeMungerAffectedType = munger.munge(this);
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (typeMungerAffectedType) { isChanged = true; if (inReweavableMode || clazz.getType().isAspect()) { aspectsAffectingType.add(munger.getAspectType().getSignature()); } } } isChanged = weaveDeclareAtMethodCtor(clazz) || isChanged; isChanged = weaveDeclareAtField(clazz) || isChanged; addedSuperInitializersAsList = new ArrayList<IfaceInitList>(addedSuperInitializers.values()); addedSuperInitializersAsList = PartialOrder.sort(addedSuperInitializersAsList); if (addedSuperInitializersAsList == null) { throw new BCException("circularity in inter-types"); } LazyMethodGen staticInit = clazz.getStaticInitializer(); staticInit.getBody().insert(genInitInstructions(addedClassInitializers, true)); List<LazyMethodGen> methodGens = new ArrayList<LazyMethodGen>(clazz.getMethodGens()); for (LazyMethodGen member : methodGens) { if (!member.hasBody()) { continue;
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} if (world.isJoinpointSynchronizationEnabled() && world.areSynchronizationPointcutsInUse() && member.getMethod().isSynchronized()) { transformSynchronizedMethod(member); } boolean shadowMungerMatched = match(member); if (shadowMungerMatched) { if (inReweavableMode || clazz.getType().isAspect()) { aspectsAffectingType.addAll(findAspectsForMungers(member)); } isChanged = true; } } for (LazyMethodGen methodGen : methodGens) { if (!methodGen.hasBody()) { continue; } implement(methodGen); } if (!initializationShadows.isEmpty()) { List<LazyMethodGen> recursiveCtors = new ArrayList<LazyMethodGen>(); while (inlineSelfConstructors(methodGens, recursiveCtors)) { }
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
positionAndImplement(initializationShadows); } if (lateTypeMungers != null) { for (Iterator<ConcreteTypeMunger> i = lateTypeMungers.iterator(); i.hasNext();) { BcelTypeMunger munger = (BcelTypeMunger) i.next(); if (munger.matches(clazz.getType())) { boolean typeMungerAffectedType = munger.munge(this); if (typeMungerAffectedType) { isChanged = true; if (inReweavableMode || clazz.getType().isAspect()) { aspectsAffectingType.add(munger.getAspectType().getSignature()); } } } } } if (isChanged) { clazz.getOrCreateWeaverStateInfo(inReweavableMode); weaveInAddedMethods(); } if (inReweavableMode) { WeaverStateInfo wsi = clazz.getOrCreateWeaverStateInfo(true);
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
wsi.addAspectsAffectingType(aspectsAffectingType); wsi.setUnwovenClassFileData(ty.getJavaClass().getBytes()); wsi.setReweavable(true); } else { clazz.getOrCreateWeaverStateInfo(false).setReweavable(false); } for (LazyMethodGen mg : methodGens) { BcelMethod method = mg.getMemberView(); if (method != null) { method.wipeJoinpointSignatures(); } } return isChanged; } /** * Check if a particular method is overriding another - refactored into this helper so it can be used from multiple places. * @return method that is overriding if it */ private static ResolvedMember isOverriding(ResolvedType typeToCheck, ResolvedMember methodThatMightBeGettingOverridden, String mname, String mrettype, int mmods, boolean inSamePackage, UnresolvedType[] methodParamsArray) { if (Modifier.isStatic(methodThatMightBeGettingOverridden.getModifiers())) { return null; }
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (Modifier.isPrivate(methodThatMightBeGettingOverridden.getModifiers())) { return null; } if (!methodThatMightBeGettingOverridden.getName().equals(mname)) { return null; } if (methodThatMightBeGettingOverridden.getParameterTypes().length != methodParamsArray.length) { return null; } if (!isVisibilityOverride(mmods, methodThatMightBeGettingOverridden, inSamePackage)) { return null; } if (typeToCheck.getWorld().forDEBUG_bridgingCode) { System.err.println(" Bridging:seriously considering this might be getting overridden '" + methodThatMightBeGettingOverridden + "'"); } World w = typeToCheck.getWorld(); boolean sameParams = true; for (int p = 0, max = methodThatMightBeGettingOverridden.getParameterTypes().length; p < max; p++) { UnresolvedType mtmbgoParameter = methodThatMightBeGettingOverridden.getParameterTypes()[p]; UnresolvedType ptype = methodParamsArray[p]; if (mtmbgoParameter.isTypeVariableReference()) { if (!mtmbgoParameter.resolve(w).isAssignableFrom(ptype.resolve(w))) { sameParams = false; }
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} else { boolean b = !methodThatMightBeGettingOverridden.getParameterTypes()[p].getErasureSignature().equals( methodParamsArray[p].getErasureSignature()); UnresolvedType parameterType = methodThatMightBeGettingOverridden.getParameterTypes()[p]; if (parameterType instanceof UnresolvedTypeVariableReferenceType) { parameterType = ((UnresolvedTypeVariableReferenceType) parameterType).getTypeVariable().getFirstBound(); } if (b) { sameParams = false; } } } if (sameParams) { if (typeToCheck.isParameterizedType()) { return methodThatMightBeGettingOverridden.getBackingGenericMember();
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} else if (!methodThatMightBeGettingOverridden.getReturnType().getErasureSignature().equals(mrettype)) { ResolvedType superReturn = typeToCheck.getWorld().resolve( UnresolvedType.forSignature(methodThatMightBeGettingOverridden.getReturnType().getErasureSignature())); ResolvedType subReturn = typeToCheck.getWorld().resolve(UnresolvedType.forSignature(mrettype)); if (superReturn.isAssignableFrom(subReturn)) { return methodThatMightBeGettingOverridden; } } else { return methodThatMightBeGettingOverridden; } } return null; } /** * Looks at the visibility modifiers between two methods, and knows whether they are from classes in the same package, and * decides whether one overrides the other. * * @return true if there is an overrides rather than a 'hides' relationship */ static boolean isVisibilityOverride(int methodMods, ResolvedMember inheritedMethod, boolean inSamePackage) { int inheritedModifiers = inheritedMethod.getModifiers(); if (Modifier.isStatic(inheritedModifiers)) { return false; } if (methodMods == inheritedModifiers) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
return true; } if (Modifier.isPrivate(inheritedModifiers)) { return false; } boolean isPackageVisible = !Modifier.isPrivate(inheritedModifiers) && !Modifier.isProtected(inheritedModifiers) && !Modifier.isPublic(inheritedModifiers); if (isPackageVisible && !inSamePackage) { return false; } return true; } /** * This method recurses up a specified type looking for a method that overrides the one passed in. * * @return the method being overridden or null if none is found */ public static void checkForOverride(ResolvedType typeToCheck, String mname, String mparams, String mrettype, int mmods, String mpkg, UnresolvedType[] methodParamsArray, List<ResolvedMember> overriddenMethodsCollector) { if (typeToCheck == null) { return; } if (typeToCheck instanceof MissingResolvedTypeWithKnownSignature) { return; } if (typeToCheck.getWorld().forDEBUG_bridgingCode) { System.err.println(" Bridging:checking for override of " + mname + " in " + typeToCheck); } String packageName = typeToCheck.getPackageName();
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (packageName == null) { packageName = ""; } boolean inSamePackage = packageName.equals(mpkg); ResolvedMember[] methods = typeToCheck.getDeclaredMethods(); for (int ii = 0; ii < methods.length; ii++) { ResolvedMember methodThatMightBeGettingOverridden = methods[ii]; ResolvedMember isOverriding = isOverriding(typeToCheck, methodThatMightBeGettingOverridden, mname, mrettype, mmods, inSamePackage, methodParamsArray); if (isOverriding != null) { overriddenMethodsCollector.add(isOverriding); } } List<ConcreteTypeMunger> l = (typeToCheck.isRawType() ? typeToCheck.getGenericType().getInterTypeMungers() : typeToCheck .getInterTypeMungers()); for (Iterator<ConcreteTypeMunger> iterator = l.iterator(); iterator.hasNext();) { ConcreteTypeMunger o = iterator.next(); if (o instanceof BcelTypeMunger) { BcelTypeMunger element = (BcelTypeMunger) o; if (element.getMunger() instanceof NewMethodTypeMunger) { if (typeToCheck.getWorld().forDEBUG_bridgingCode) { System.err.println("Possible ITD candidate " + element); } ResolvedMember aMethod = element.getSignature(); ResolvedMember isOverriding = isOverriding(typeToCheck, aMethod, mname, mrettype, mmods, inSamePackage,
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
methodParamsArray); if (isOverriding != null) { overriddenMethodsCollector.add(isOverriding); } } } } if (typeToCheck.equals(UnresolvedType.OBJECT)) { return; } ResolvedType superclass = typeToCheck.getSuperclass(); checkForOverride(superclass, mname, mparams, mrettype, mmods, mpkg, methodParamsArray,overriddenMethodsCollector); ResolvedType[] interfaces = typeToCheck.getDeclaredInterfaces(); for (int i = 0; i < interfaces.length; i++) { ResolvedType anInterface = interfaces[i]; checkForOverride(anInterface, mname, mparams, mrettype, mmods, mpkg, methodParamsArray,overriddenMethodsCollector); } } /** * We need to determine if any methods in this type require bridge methods - this method should only be called if necessary to * do this calculation, i.e. we are on a 1.5 VM (where covariance/generics exist) and the type hierarchy for the specified class * has changed (via decp/itd). * * See pr108101 */ public static boolean calculateAnyRequiredBridgeMethods(BcelWorld world, LazyClassGen clazz) { world.ensureAdvancedConfigurationProcessed(); if (!world.isInJava5Mode()) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
return false; } if (clazz.isInterface()) { return false; } boolean didSomething = false; List<LazyMethodGen> methods = clazz.getMethodGens(); Set<String> methodsSet = new HashSet<String>(); for (int i = 0; i < methods.size(); i++) { LazyMethodGen aMethod = methods.get(i); StringBuilder sb = new StringBuilder(aMethod.getName()); sb.append(aMethod.getSignature()); methodsSet.add(sb.toString()); } for (int i = 0; i < methods.size(); i++) { LazyMethodGen bridgeToCandidate = methods.get(i); if (bridgeToCandidate.isBridgeMethod()) { continue; } String name = bridgeToCandidate.getName(); String psig = bridgeToCandidate.getParameterSignature(); String rsig = bridgeToCandidate.getReturnType().getSignature(); if (bridgeToCandidate.isStatic()) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
continue; } if (name.endsWith("init>")) { continue; } if (world.forDEBUG_bridgingCode) { System.err.println("Bridging: Determining if we have to bridge to " + clazz.getName() + "." + name + "" + bridgeToCandidate.getSignature()); } ResolvedType theSuperclass = clazz.getSuperClass(); if (world.forDEBUG_bridgingCode) { System.err.println("Bridging: Checking supertype " + theSuperclass); } String pkgName = clazz.getPackageName(); UnresolvedType[] bm = BcelWorld.fromBcel(bridgeToCandidate.getArgumentTypes()); List<ResolvedMember> overriddenMethodsCollector = new ArrayList<ResolvedMember>(); checkForOverride(theSuperclass, name, psig, rsig, bridgeToCandidate.getAccessFlags(), pkgName, bm, overriddenMethodsCollector); if (overriddenMethodsCollector.size() != 0) { for (ResolvedMember overriddenMethod: overriddenMethodsCollector) { String key = new StringBuilder(overriddenMethod.getName()).append(overriddenMethod.getSignatureErased()).toString(); boolean alreadyHaveABridgeMethod = methodsSet.contains(key); if (!alreadyHaveABridgeMethod) { if (world.forDEBUG_bridgingCode) { System.err.println("Bridging:bridging to '" + overriddenMethod + "'"); } createBridgeMethod(world, bridgeToCandidate, clazz, overriddenMethod); methodsSet.add(key); didSomething = true; } }
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} String[] interfaces = clazz.getInterfaceNames(); for (int j = 0; j < interfaces.length; j++) { if (world.forDEBUG_bridgingCode) { System.err.println("Bridging:checking superinterface " + interfaces[j]); } ResolvedType interfaceType = world.resolve(interfaces[j]); overriddenMethodsCollector.clear(); checkForOverride(interfaceType, name, psig, rsig, bridgeToCandidate.getAccessFlags(), clazz.getPackageName(), bm, overriddenMethodsCollector); for (ResolvedMember overriddenMethod: overriddenMethodsCollector) { String key = new StringBuffer().append(overriddenMethod.getName()).append(overriddenMethod.getSignatureErased()).toString(); boolean alreadyHaveABridgeMethod = methodsSet.contains(key); if (!alreadyHaveABridgeMethod) { createBridgeMethod(world, bridgeToCandidate, clazz, overriddenMethod); methodsSet.add(key); didSomething = true; if (world.forDEBUG_bridgingCode) { System.err.println("Bridging:bridging to " + overriddenMethod); } } } } } return didSomething; } /** * Weave any declare @method/@ctor statements into the members of the supplied class
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
*/ private boolean weaveDeclareAtMethodCtor(LazyClassGen clazz) { List<Integer> reportedProblems = new ArrayList<Integer>(); List<DeclareAnnotation> allDecams = world.getDeclareAnnotationOnMethods(); if (allDecams.isEmpty()) { return false; } boolean isChanged = false; List<ConcreteTypeMunger> itdMethodsCtors = getITDSubset(clazz, ResolvedTypeMunger.Method); itdMethodsCtors.addAll(getITDSubset(clazz, ResolvedTypeMunger.Constructor)); if (!itdMethodsCtors.isEmpty()) { isChanged = weaveAtMethodOnITDSRepeatedly(allDecams, itdMethodsCtors, reportedProblems); } List<LazyMethodGen> members = clazz.getMethodGens(); List<DeclareAnnotation> decaMs = getMatchingSubset(allDecams, clazz.getType()); if (decaMs.isEmpty()) { return false; } if (!members.isEmpty()) { Set<DeclareAnnotation> unusedDecams = new HashSet<DeclareAnnotation>(); unusedDecams.addAll(decaMs); for (int memberCounter = 0; memberCounter < members.size(); memberCounter++) { LazyMethodGen mg = members.get(memberCounter); if (!mg.getName().startsWith(NameMangler.PREFIX)) { List<DeclareAnnotation> worthRetrying = new ArrayList<DeclareAnnotation>();
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
boolean modificationOccured = false; List<AnnotationGen> annotationsToAdd = null; for (DeclareAnnotation decaM : decaMs) { if (decaM.matches(mg.getMemberView(), world)) { if (doesAlreadyHaveAnnotation(mg.getMemberView(), decaM, reportedProblems)) { unusedDecams.remove(decaM); continue; } if (annotationsToAdd == null) { annotationsToAdd = new ArrayList<AnnotationGen>(); } AnnotationGen a = ((BcelAnnotation) decaM.getAnnotation()).getBcelAnnotation(); AnnotationGen ag = new AnnotationGen(a, clazz.getConstantPool(), true); annotationsToAdd.add(ag); mg.addAnnotation(decaM.getAnnotation()); AsmRelationshipProvider.addDeclareAnnotationMethodRelationship(decaM.getSourceLocation(), clazz.getName(), mg.getMemberView(), world.getModelAsAsmManager()); reportMethodCtorWeavingMessage(clazz, mg.getMemberView(), decaM, mg.getDeclarationLineNumber()); isChanged = true; modificationOccured = true; unusedDecams.remove(decaM); } else { if (!decaM.isStarredAnnotationPattern()) { worthRetrying.add(decaM);
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} } } while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); for (DeclareAnnotation decaM : worthRetrying) { if (decaM.matches(mg.getMemberView(), world)) { if (doesAlreadyHaveAnnotation(mg.getMemberView(), decaM, reportedProblems)) { unusedDecams.remove(decaM); continue; } if (annotationsToAdd == null) { annotationsToAdd = new ArrayList<AnnotationGen>(); } AnnotationGen a = ((BcelAnnotation) decaM.getAnnotation()).getBcelAnnotation(); AnnotationGen ag = new AnnotationGen(a, clazz.getConstantPool(), true); annotationsToAdd.add(ag); mg.addAnnotation(decaM.getAnnotation()); AsmRelationshipProvider.addDeclareAnnotationMethodRelationship(decaM.getSourceLocation(), clazz.getName(), mg.getMemberView(), world.getModelAsAsmManager()); isChanged = true;
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
modificationOccured = true; forRemoval.add(decaM); unusedDecams.remove(decaM); } } worthRetrying.removeAll(forRemoval); } if (annotationsToAdd != null) { Method oldMethod = mg.getMethod(); MethodGen myGen = new MethodGen(oldMethod, clazz.getClassName(), clazz.getConstantPool(), false); for (AnnotationGen a : annotationsToAdd) { myGen.addAnnotation(a); } Method newMethod = myGen.getMethod(); members.set(memberCounter, new LazyMethodGen(newMethod, clazz)); } } } checkUnusedDeclareAts(unusedDecams, false); } return isChanged; } private void reportMethodCtorWeavingMessage(LazyClassGen clazz, ResolvedMember member, DeclareAnnotation decaM, int memberLineNumber) { if (!getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) { StringBuffer parmString = new StringBuffer("("); UnresolvedType[] paramTypes = member.getParameterTypes();
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
for (int i = 0; i < paramTypes.length; i++) { UnresolvedType type = paramTypes[i]; String s = org.aspectj.apache.bcel.classfile.Utility.signatureToString(type.getSignature()); if (s.lastIndexOf('.') != -1) { s = s.substring(s.lastIndexOf('.') + 1); } parmString.append(s); if ((i + 1) < paramTypes.length) { parmString.append(","); } } parmString.append(")"); String methodName = member.getName(); StringBuffer sig = new StringBuffer(); sig.append(org.aspectj.apache.bcel.classfile.Utility.accessToString(member.getModifiers())); sig.append(" "); sig.append(member.getReturnType().toString()); sig.append(" "); sig.append(member.getDeclaringType().toString()); sig.append("."); sig.append(methodName.equals("<init>") ? "new" : methodName); sig.append(parmString); StringBuffer loc = new StringBuffer(); if (clazz.getFileName() == null) { loc.append("no debug info available"); } else { loc.append(clazz.getFileName()); if (memberLineNumber != -1) { loc.append(":" + memberLineNumber); }
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} getWorld().getMessageHandler().handleMessage( WeaveMessage.constructWeavingMessage( WeaveMessage.WEAVEMESSAGE_ANNOTATES, new String[] { sig.toString(), loc.toString(), decaM.getAnnotationString(), methodName.startsWith("<init>") ? "constructor" : "method", decaM.getAspect().toString(), Utility.beautifyLocation(decaM.getSourceLocation()) })); } } /** * Looks through a list of declare annotation statements and only returns those that could possibly match on a field/method/ctor * in type. */ private List<DeclareAnnotation> getMatchingSubset(List<DeclareAnnotation> declareAnnotations, ResolvedType type) { List<DeclareAnnotation> subset = new ArrayList<DeclareAnnotation>(); for (DeclareAnnotation da : declareAnnotations) { if (da.couldEverMatch(type)) { subset.add(da); } } return subset; } /** * Get a subset of all the type mungers defined on this aspect */ private List<ConcreteTypeMunger> getITDSubset(LazyClassGen clazz, ResolvedTypeMunger.Kind wantedKind) { List<ConcreteTypeMunger> subset = new ArrayList<ConcreteTypeMunger>(); for (ConcreteTypeMunger typeMunger : clazz.getBcelObjectType().getTypeMungers()) { if (typeMunger.getMunger().getKind() == wantedKind) { subset.add(typeMunger);
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} } return subset; } public LazyMethodGen locateAnnotationHolderForFieldMunger(LazyClassGen clazz, ConcreteTypeMunger fieldMunger) { NewFieldTypeMunger newFieldMunger = (NewFieldTypeMunger) fieldMunger.getMunger(); ResolvedMember lookingFor = AjcMemberMaker.interFieldInitializer(newFieldMunger.getSignature(), clazz.getType()); for (LazyMethodGen method : clazz.getMethodGens()) { if (method.getName().equals(lookingFor.getName())) { return method; } } return null; } public LazyMethodGen locateAnnotationHolderForMethodCtorMunger(LazyClassGen clazz, ConcreteTypeMunger methodCtorMunger) { ResolvedTypeMunger rtMunger = methodCtorMunger.getMunger(); ResolvedMember lookingFor = null; if (rtMunger instanceof NewMethodTypeMunger) { NewMethodTypeMunger nftm = (NewMethodTypeMunger) rtMunger; lookingFor = AjcMemberMaker.interMethodDispatcher(nftm.getSignature(), methodCtorMunger.getAspectType()); } else if (rtMunger instanceof NewConstructorTypeMunger) { NewConstructorTypeMunger nftm = (NewConstructorTypeMunger) rtMunger; lookingFor = AjcMemberMaker.postIntroducedConstructor(methodCtorMunger.getAspectType(), nftm.getSignature() .getDeclaringType(), nftm.getSignature().getParameterTypes()); } else { throw new BCException("Not sure what this is: " + methodCtorMunger); } String name = lookingFor.getName(); String paramSignature = lookingFor.getParameterSignature();
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
for (LazyMethodGen member : clazz.getMethodGens()) { if (member.getName().equals(name) && member.getParameterSignature().equals(paramSignature)) { return member; } } return null; } /** * Applies some set of declare @field constructs (List<DeclareAnnotation>) to some bunch of ITDfields (List<BcelTypeMunger>. It * will iterate over the fields repeatedly until everything has been applied. * */ private boolean weaveAtFieldRepeatedly(List<DeclareAnnotation> decaFs, List<ConcreteTypeMunger> itdFields, List<Integer> reportedErrors) { boolean isChanged = false; for (Iterator<ConcreteTypeMunger> iter = itdFields.iterator(); iter.hasNext();) { BcelTypeMunger fieldMunger = (BcelTypeMunger) iter.next(); ResolvedMember itdIsActually = fieldMunger.getSignature(); Set<DeclareAnnotation> worthRetrying = new LinkedHashSet<DeclareAnnotation>(); boolean modificationOccured = false; for (Iterator<DeclareAnnotation> iter2 = decaFs.iterator(); iter2.hasNext();) { DeclareAnnotation decaF = iter2.next(); if (decaF.matches(itdIsActually, world)) { if (decaF.isRemover()) { LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, fieldMunger); if (annotationHolder.hasAnnotation(decaF.getAnnotationType())) { isChanged = true; annotationHolder.removeAnnotation(decaF.getAnnotationType()); AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(),
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
decaF.getSourceLocation(), itdIsActually.getSourceLocation(), true); } else { worthRetrying.add(decaF); } } else { LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, fieldMunger); if (doesAlreadyHaveAnnotation(annotationHolder, itdIsActually, decaF, reportedErrors)) { continue; } annotationHolder.addAnnotation(decaF.getAnnotation()); AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(), decaF.getSourceLocation(), itdIsActually.getSourceLocation(), false); isChanged = true; modificationOccured = true; } } else { if (!decaF.isStarredAnnotationPattern()) { worthRetrying.add(decaF); } } } while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); for (Iterator<DeclareAnnotation> iter2 = worthRetrying.iterator(); iter2.hasNext();) { DeclareAnnotation decaF = iter2.next(); if (decaF.matches(itdIsActually, world)) { if (decaF.isRemover()) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, fieldMunger); if (annotationHolder.hasAnnotation(decaF.getAnnotationType())) { isChanged = true; annotationHolder.removeAnnotation(decaF.getAnnotationType()); AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(), decaF.getSourceLocation(), itdIsActually.getSourceLocation(), true); forRemoval.add(decaF); } } else { LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, fieldMunger); if (doesAlreadyHaveAnnotation(annotationHolder, itdIsActually, decaF, reportedErrors)) { continue; } annotationHolder.addAnnotation(decaF.getAnnotation()); AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(), decaF.getSourceLocation(), itdIsActually.getSourceLocation(), false); isChanged = true; modificationOccured = true; forRemoval.add(decaF); } } } worthRetrying.removeAll(forRemoval); } } return isChanged; } /** * Applies some set of declare @method/@ctor constructs (List<DeclareAnnotation>) to some bunch of ITDmembers
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
* (List<BcelTypeMunger>. It will iterate over the fields repeatedly until everything has been applied. */ private boolean weaveAtMethodOnITDSRepeatedly(List<DeclareAnnotation> decaMCs, List<ConcreteTypeMunger> itdsForMethodAndConstructor, List<Integer> reportedErrors) { boolean isChanged = false; AsmManager asmManager = world.getModelAsAsmManager(); for (ConcreteTypeMunger methodctorMunger : itdsForMethodAndConstructor) { ResolvedMember unMangledInterMethod = methodctorMunger.getSignature(); List<DeclareAnnotation> worthRetrying = new ArrayList<DeclareAnnotation>(); boolean modificationOccured = false; for (Iterator<DeclareAnnotation> iter2 = decaMCs.iterator(); iter2.hasNext();) { DeclareAnnotation decaMC = iter2.next(); if (decaMC.matches(unMangledInterMethod, world)) { LazyMethodGen annotationHolder = locateAnnotationHolderForMethodCtorMunger(clazz, methodctorMunger); if (annotationHolder == null || doesAlreadyHaveAnnotation(annotationHolder, unMangledInterMethod, decaMC, reportedErrors)) { continue; } annotationHolder.addAnnotation(decaMC.getAnnotation()); isChanged = true; AsmRelationshipProvider.addDeclareAnnotationRelationship(asmManager, decaMC.getSourceLocation(), unMangledInterMethod.getSourceLocation(), false); reportMethodCtorWeavingMessage(clazz, unMangledInterMethod, decaMC, -1); modificationOccured = true; } else { if (!decaMC.isStarredAnnotationPattern()) { worthRetrying.add(decaMC);
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} } } while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); for (Iterator<DeclareAnnotation> iter2 = worthRetrying.iterator(); iter2.hasNext();) { DeclareAnnotation decaMC = iter2.next(); if (decaMC.matches(unMangledInterMethod, world)) { LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, methodctorMunger); if (doesAlreadyHaveAnnotation(annotationHolder, unMangledInterMethod, decaMC, reportedErrors)) { continue; } annotationHolder.addAnnotation(decaMC.getAnnotation()); unMangledInterMethod.addAnnotation(decaMC.getAnnotation()); AsmRelationshipProvider.addDeclareAnnotationRelationship(asmManager, decaMC.getSourceLocation(), unMangledInterMethod.getSourceLocation(), false); isChanged = true; modificationOccured = true; forRemoval.add(decaMC); } worthRetrying.removeAll(forRemoval); } } } return isChanged; } private boolean dontAddTwice(DeclareAnnotation decaF, AnnotationAJ[] dontAddMeTwice) { for (AnnotationAJ ann : dontAddMeTwice) { if (ann != null && decaF.getAnnotation().getTypeName().equals(ann.getTypeName())) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
return true; } } return false; } /** * Remove an annotation from the supplied array, if it is in there. */ private AnnotationAJ[] removeFromAnnotationsArray(AnnotationAJ[] annotations,AnnotationAJ annotation) { for (int i=0;i<annotations.length;i++) { if (annotations[i] != null && annotation.getTypeName().equals(annotations[i].getTypeName())) { AnnotationAJ[] newArray = new AnnotationAJ[annotations.length-1]; int index=0; for (int j=0;j<annotations.length;j++) { if (j!=i) { newArray[index++]=annotations[j]; } } return newArray; } } return annotations; } /**
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
* Weave any declare @field statements into the fields of the supplied class. This will attempt to apply them to the ITDs too. * * Interesting case relating to public ITDd fields. The annotations are really stored against the interfieldinit method in the * aspect, but the public field is placed in the target type and then is processed in the 2nd pass over fields that occurs. I * think it would be more expensive to avoid putting the annotation on that inserted public field than just to have it put there * as well as on the interfieldinit method. */ private boolean weaveDeclareAtField(LazyClassGen clazz) { List<Integer> reportedProblems = new ArrayList<Integer>(); List<DeclareAnnotation> allDecafs = world.getDeclareAnnotationOnFields(); if (allDecafs.isEmpty()) { return false; } boolean typeIsChanged = false; List<ConcreteTypeMunger> relevantItdFields = getITDSubset(clazz, ResolvedTypeMunger.Field); if (relevantItdFields != null) { typeIsChanged = weaveAtFieldRepeatedly(allDecafs, relevantItdFields, reportedProblems); } List<DeclareAnnotation> decafs = getMatchingSubset(allDecafs, clazz.getType()); if (decafs.isEmpty()) { return typeIsChanged; } List<BcelField> fields = clazz.getFieldGens(); if (fields != null) { Set<DeclareAnnotation> unusedDecafs = new HashSet<DeclareAnnotation>(); unusedDecafs.addAll(decafs); for (BcelField field : fields) { if (!field.getName().startsWith(NameMangler.PREFIX)) { Set<DeclareAnnotation> worthRetrying = new LinkedHashSet<DeclareAnnotation>();
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
boolean modificationOccured = false; AnnotationAJ[] dontAddMeTwice = field.getAnnotations(); for (DeclareAnnotation decaf : decafs) { if (decaf.getAnnotation() == null) { return false; } if (decaf.matches(field, world)) { if (decaf.isRemover()) { AnnotationAJ annotation = decaf.getAnnotation(); if (field.hasAnnotation(annotation.getType())) { typeIsChanged = true; field.removeAnnotation(annotation); AsmRelationshipProvider.addDeclareAnnotationFieldRelationship(world.getModelAsAsmManager(), decaf.getSourceLocation(), clazz.getName(), field, true); reportFieldAnnotationWeavingMessage(clazz, field, decaf, true); dontAddMeTwice = removeFromAnnotationsArray(dontAddMeTwice, annotation); } else { worthRetrying.add(decaf); } unusedDecafs.remove(decaf); } else { if (!dontAddTwice(decaf, dontAddMeTwice)) { if (doesAlreadyHaveAnnotation(field, decaf, reportedProblems)) { unusedDecafs.remove(decaf); continue; } field.addAnnotation(decaf.getAnnotation());
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} AsmRelationshipProvider.addDeclareAnnotationFieldRelationship(world.getModelAsAsmManager(), decaf.getSourceLocation(), clazz.getName(), field, false); reportFieldAnnotationWeavingMessage(clazz, field, decaf, false); typeIsChanged = true; modificationOccured = true; unusedDecafs.remove(decaf); } } else if (!decaf.isStarredAnnotationPattern() || decaf.isRemover()) { worthRetrying.add(decaf); } } while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); for (Iterator<DeclareAnnotation> iter = worthRetrying.iterator(); iter.hasNext();) { DeclareAnnotation decaF = iter.next(); if (decaF.matches(field, world)) { if (decaF.isRemover()) { AnnotationAJ annotation = decaF.getAnnotation(); if (field.hasAnnotation(annotation.getType())) { typeIsChanged = modificationOccured = true; forRemoval.add(decaF); field.removeAnnotation(annotation); AsmRelationshipProvider.addDeclareAnnotationFieldRelationship(world.getModelAsAsmManager(), decaF.getSourceLocation(), clazz.getName(), field, true); reportFieldAnnotationWeavingMessage(clazz, field, decaF, true);
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} } else { unusedDecafs.remove(decaF); if (doesAlreadyHaveAnnotation(field, decaF, reportedProblems)) { continue; } field.addAnnotation(decaF.getAnnotation()); AsmRelationshipProvider.addDeclareAnnotationFieldRelationship(world.getModelAsAsmManager(), decaF.getSourceLocation(), clazz.getName(), field, false); typeIsChanged = modificationOccured = true; forRemoval.add(decaF); } } } worthRetrying.removeAll(forRemoval); } } } checkUnusedDeclareAts(unusedDecafs, true); } return typeIsChanged; } /** * Report an error if the reason a "declare @method/ctor/field" was not used was because the member specified does not exist. * This method is passed some set of declare statements that didn't match and a flag indicating whether the set contains declare @field * or declare @method/ctor entries. */ private void checkUnusedDeclareAts(Set<DeclareAnnotation> unusedDecaTs, boolean isDeclareAtField) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
for (DeclareAnnotation declA : unusedDecaTs) { boolean shouldCheck = declA.isExactPattern() || declA.getSignaturePattern().getExactDeclaringTypes().size() != 0; if (shouldCheck && declA.getKind() != DeclareAnnotation.AT_CONSTRUCTOR) { if (declA.getSignaturePattern().isMatchOnAnyName()) { shouldCheck = false; } else { List<ExactTypePattern> declaringTypePatterns = declA.getSignaturePattern().getExactDeclaringTypes(); if (declaringTypePatterns.size() == 0) { shouldCheck = false; } else { for (ExactTypePattern exactTypePattern : declaringTypePatterns) { if (exactTypePattern.isIncludeSubtypes()) { shouldCheck = false; break; } } } } } if (shouldCheck) { boolean itdMatch = false; List<ConcreteTypeMunger> lst = clazz.getType().getInterTypeMungers(); for (Iterator<ConcreteTypeMunger> iterator = lst.iterator(); iterator.hasNext() && !itdMatch;) { ConcreteTypeMunger element = iterator.next(); if (element.getMunger() instanceof NewFieldTypeMunger) { NewFieldTypeMunger nftm = (NewFieldTypeMunger) element.getMunger(); itdMatch = declA.matches(nftm.getSignature(), world); } else if (element.getMunger() instanceof NewMethodTypeMunger) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
NewMethodTypeMunger nmtm = (NewMethodTypeMunger) element.getMunger(); itdMatch = declA.matches(nmtm.getSignature(), world); } else if (element.getMunger() instanceof NewConstructorTypeMunger) { NewConstructorTypeMunger nctm = (NewConstructorTypeMunger) element.getMunger(); itdMatch = declA.matches(nctm.getSignature(), world); } } if (!itdMatch) { IMessage message = null; if (isDeclareAtField) { message = new Message("The field '" + declA.getSignaturePattern().toString() + "' does not exist", declA.getSourceLocation(), true); } else { message = new Message("The method '" + declA.getSignaturePattern().toString() + "' does not exist", declA.getSourceLocation(), true); } world.getMessageHandler().handleMessage(message); } } } } private void reportFieldAnnotationWeavingMessage(LazyClassGen clazz, BcelField theField, DeclareAnnotation decaf, boolean isRemove) { if (!getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) { world.getMessageHandler().handleMessage( WeaveMessage.constructWeavingMessage( isRemove ? WeaveMessage.WEAVEMESSAGE_REMOVES_ANNOTATION : WeaveMessage.WEAVEMESSAGE_ANNOTATES, new String[] { theField.getFieldAsIs().toString() + "' of type '" + clazz.getName(), clazz.getFileName(), decaf.getAnnotationString(), "field", decaf.getAspect().toString(),
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
Utility.beautifyLocation(decaf.getSourceLocation()) })); } } /** * Check if a resolved member (field/method/ctor) already has an annotation, if it does then put out a warning and return true */ private boolean doesAlreadyHaveAnnotation(ResolvedMember rm, DeclareAnnotation deca, List<Integer> reportedProblems) { if (rm.hasAnnotation(deca.getAnnotationType())) { if (world.getLint().elementAlreadyAnnotated.isEnabled()) { Integer uniqueID = new Integer(rm.hashCode() * deca.hashCode()); if (!reportedProblems.contains(uniqueID)) { reportedProblems.add(uniqueID); world.getLint().elementAlreadyAnnotated.signal(new String[] { rm.toString(), deca.getAnnotationType().toString() }, rm.getSourceLocation(), new ISourceLocation[] { deca.getSourceLocation() }); } } return true; } return false; } private boolean doesAlreadyHaveAnnotation(LazyMethodGen rm, ResolvedMember itdfieldsig, DeclareAnnotation deca, List<Integer> reportedProblems) { if (rm != null && rm.hasAnnotation(deca.getAnnotationType())) { if (world.getLint().elementAlreadyAnnotated.isEnabled()) { Integer uniqueID = new Integer(rm.hashCode() * deca.hashCode()); if (!reportedProblems.contains(uniqueID)) { reportedProblems.add(uniqueID); reportedProblems.add(new Integer(itdfieldsig.hashCode() * deca.hashCode())); world.getLint().elementAlreadyAnnotated.signal(new String[] { itdfieldsig.toString(),
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
deca.getAnnotationType().toString() }, rm.getSourceLocation(), new ISourceLocation[] { deca.getSourceLocation() }); } } return true; } return false; } private Set<String> findAspectsForMungers(LazyMethodGen mg) { Set<String> aspectsAffectingType = new HashSet<String>(); for (BcelShadow shadow : mg.matchedShadows) { for (ShadowMunger munger : shadow.getMungers()) { if (munger instanceof BcelAdvice) { BcelAdvice bcelAdvice = (BcelAdvice) munger; if (bcelAdvice.getConcreteAspect() != null) { aspectsAffectingType.add(bcelAdvice.getConcreteAspect().getSignature()); } } else { } } } return aspectsAffectingType; } private boolean inlineSelfConstructors(List<LazyMethodGen> methodGens, List<LazyMethodGen> recursiveCtors) { boolean inlinedSomething = false; List<LazyMethodGen> newRecursiveCtors = new ArrayList<LazyMethodGen>(); for (LazyMethodGen methodGen : methodGens) { if (!methodGen.getName().equals("<init>")) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
continue; } InstructionHandle ih = findSuperOrThisCall(methodGen); if (ih != null && isThisCall(ih)) { LazyMethodGen donor = getCalledMethod(ih); if (donor.equals(methodGen)) { newRecursiveCtors.add(donor); } else { if (!recursiveCtors.contains(donor)) { inlineMethod(donor, methodGen, ih); inlinedSomething = true; } } } } recursiveCtors.addAll(newRecursiveCtors); return inlinedSomething; } private void positionAndImplement(List<BcelShadow> initializationShadows) { for (BcelShadow s : initializationShadows) { positionInitializationShadow(s); s.implement(); } } private void positionInitializationShadow(BcelShadow s) { LazyMethodGen mg = s.getEnclosingMethod(); InstructionHandle call = findSuperOrThisCall(mg); InstructionList body = mg.getBody(); ShadowRange r = new ShadowRange(body);
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
r.associateWithShadow(s); if (s.getKind() == Shadow.PreInitialization) { r.associateWithTargets(Range.genStart(body, body.getStart().getNext()), Range.genEnd(body, call.getPrev())); } else { r.associateWithTargets(Range.genStart(body, call.getNext()), Range.genEnd(body)); } } private boolean isThisCall(InstructionHandle ih) { InvokeInstruction inst = (InvokeInstruction) ih.getInstruction(); return inst.getClassName(cpg).equals(clazz.getName()); } /** * inline a particular call in bytecode. * * @param donor the method we want to inline * @param recipient the method containing the call we want to inline * @param call the instructionHandle in recipient's body holding the call we want to inline. */ public static void inlineMethod(LazyMethodGen donor, LazyMethodGen recipient, InstructionHandle call) { /* * Implementation notes: * * We allocate two slots for every tempvar so we don't screw up longs and doubles which may share space. This could be * conservatively avoided (no reference to a long/double instruction, don't do it) or packed later. Right now we don't
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
* bother to pack. * * Allocate a new var for each formal param of the inlined. Fill with stack contents. Then copy the inlined instructions in * with the appropriate remap table. Any framelocs used by locals in inlined are reallocated to top of frame, */ final InstructionFactory fact = recipient.getEnclosingClass().getFactory(); IntMap frameEnv = new IntMap(); InstructionList argumentStores = genArgumentStores(donor, recipient, frameEnv, fact); InstructionList inlineInstructions = genInlineInstructions(donor, recipient, frameEnv, fact, false); inlineInstructions.insert(argumentStores); recipient.getBody().append(call, inlineInstructions); Utility.deleteInstruction(call, recipient); } /** * Input method is a synchronized method, we remove the bit flag for synchronized and then insert a try..finally block * * Some jumping through firey hoops required - depending on the input code level (1.5 or not) we may or may not be able to use * the LDC instruction that takes a class literal (doesnt on <1.5). * * FIXME asc Before promoting -Xjoinpoints:synchronization to be a standard option, this needs a bunch of tidying up - there is * some duplication that can be removed.
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
*/ public static void transformSynchronizedMethod(LazyMethodGen synchronizedMethod) { if (trace.isTraceEnabled()) { trace.enter("transformSynchronizedMethod", synchronizedMethod); } final InstructionFactory fact = synchronizedMethod.getEnclosingClass().getFactory(); InstructionList body = synchronizedMethod.getBody(); InstructionList prepend = new InstructionList(); Type enclosingClassType = BcelWorld.makeBcelType(synchronizedMethod.getEnclosingClass().getType()); if (synchronizedMethod.isStatic()) { if (synchronizedMethod.getEnclosingClass().isAtLeastJava5()) { int slotForLockObject = synchronizedMethod.allocateLocal(enclosingClassType); prepend.append(fact.createConstant(enclosingClassType)); prepend.append(InstructionFactory.createDup(1)); prepend.append(InstructionFactory.createStore(enclosingClassType, slotForLockObject)); prepend.append(InstructionFactory.MONITORENTER);
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
InstructionList finallyBlock = new InstructionList(); finallyBlock.append(InstructionFactory.createLoad(Type.getType(java.lang.Class.class), slotForLockObject)); finallyBlock.append(InstructionConstants.MONITOREXIT); finallyBlock.append(InstructionConstants.ATHROW);
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
InstructionHandle walker = body.getStart(); List<InstructionHandle> rets = new ArrayList<InstructionHandle>(); while (walker != null) { if (walker.getInstruction().isReturnInstruction()) { rets.add(walker); } walker = walker.getNext(); } if (!rets.isEmpty()) { for (Iterator<InstructionHandle> iter = rets.iterator(); iter.hasNext();) { InstructionHandle element = iter.next(); InstructionList monitorExitBlock = new InstructionList(); monitorExitBlock.append(InstructionFactory.createLoad(enclosingClassType, slotForLockObject)); monitorExitBlock.append(InstructionConstants.MONITOREXIT); InstructionHandle monitorExitBlockStart = body.insert(element, monitorExitBlock); for (InstructionTargeter targeter : element.getTargetersCopy()) { if (targeter instanceof LocalVariableTag) { } else if (targeter instanceof LineNumberTag) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} else if (targeter instanceof InstructionBranch) { targeter.updateTarget(element, monitorExitBlockStart); } else { throw new BCException("Unexpected targeter encountered during transform: " + targeter); } } } } InstructionHandle finallyStart = finallyBlock.getStart(); InstructionHandle tryPosition = body.getStart(); InstructionHandle catchPosition = body.getEnd(); body.insert(body.getStart(), prepend); synchronizedMethod.getBody().append(finallyBlock); synchronizedMethod.addExceptionHandler(tryPosition, catchPosition, finallyStart, null, false); synchronizedMethod.addExceptionHandler(finallyStart, finallyStart.getNext(), finallyStart, null, false); } else {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
Type classType = BcelWorld.makeBcelType(synchronizedMethod.getEnclosingClass().getType()); Type clazzType = Type.getType(Class.class); InstructionList parttwo = new InstructionList(); parttwo.append(InstructionFactory.createDup(1)); int slotForThis = synchronizedMethod.allocateLocal(classType); parttwo.append(InstructionFactory.createStore(clazzType, slotForThis));
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
parttwo.append(InstructionFactory.MONITORENTER); String fieldname = synchronizedMethod.getEnclosingClass().allocateField("class$"); FieldGen f = new FieldGen(Modifier.STATIC | Modifier.PRIVATE, Type.getType(Class.class), fieldname, synchronizedMethod.getEnclosingClass().getConstantPool()); synchronizedMethod.getEnclosingClass().addField(f, null); String name = synchronizedMethod.getEnclosingClass().getName(); prepend.append(fact.createGetStatic(name, fieldname, Type.getType(Class.class))); prepend.append(InstructionFactory.createDup(1)); prepend.append(InstructionFactory.createBranchInstruction(Constants.IFNONNULL, parttwo.getStart())); prepend.append(InstructionFactory.POP); prepend.append(fact.createConstant(name)); InstructionHandle tryInstruction = prepend.getEnd(); prepend.append(fact.createInvoke("java.lang.Class", "forName", clazzType, new Type[] { Type.getType(String.class) }, Constants.INVOKESTATIC)); InstructionHandle catchInstruction = prepend.getEnd(); prepend.append(InstructionFactory.createDup(1));
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
prepend.append(fact.createPutStatic(synchronizedMethod.getEnclosingClass().getType().getName(), fieldname, Type.getType(Class.class))); prepend.append(InstructionFactory.createBranchInstruction(Constants.GOTO, parttwo.getStart())); InstructionList catchBlockForLiteralLoadingFail = new InstructionList(); catchBlockForLiteralLoadingFail.append(fact.createNew((ObjectType) Type.getType(NoClassDefFoundError.class))); catchBlockForLiteralLoadingFail.append(InstructionFactory.createDup_1(1)); catchBlockForLiteralLoadingFail.append(InstructionFactory.SWAP); catchBlockForLiteralLoadingFail.append(fact.createInvoke("java.lang.Throwable", "getMessage", Type.getType(String.class), new Type[] {}, Constants.INVOKEVIRTUAL)); catchBlockForLiteralLoadingFail.append(fact.createInvoke("java.lang.NoClassDefFoundError", "<init>", Type.VOID, new Type[] { Type.getType(String.class) }, Constants.INVOKESPECIAL)); catchBlockForLiteralLoadingFail.append(InstructionFactory.ATHROW); InstructionHandle catchBlockStart = catchBlockForLiteralLoadingFail.getStart(); prepend.append(catchBlockForLiteralLoadingFail); prepend.append(parttwo);
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
InstructionList finallyBlock = new InstructionList(); finallyBlock.append(InstructionFactory.createLoad(Type.getType(java.lang.Class.class), slotForThis)); finallyBlock.append(InstructionConstants.MONITOREXIT); finallyBlock.append(InstructionConstants.ATHROW);
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
InstructionHandle walker = body.getStart(); List<InstructionHandle> rets = new ArrayList<InstructionHandle>(); while (walker != null) { if (walker.getInstruction().isReturnInstruction()) { rets.add(walker); } walker = walker.getNext(); } if (rets.size() > 0) { for (InstructionHandle ret : rets) { InstructionList monitorExitBlock = new InstructionList(); monitorExitBlock.append(InstructionFactory.createLoad(classType, slotForThis)); monitorExitBlock.append(InstructionConstants.MONITOREXIT); InstructionHandle monitorExitBlockStart = body.insert(ret, monitorExitBlock); for (InstructionTargeter targeter : ret.getTargetersCopy()) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (targeter instanceof LocalVariableTag) { } else if (targeter instanceof LineNumberTag) { } else if (targeter instanceof InstructionBranch) { targeter.updateTarget(ret, monitorExitBlockStart); } else { throw new BCException("Unexpected targeter encountered during transform: " + targeter); } } } } InstructionHandle finallyStart = finallyBlock.getStart(); InstructionHandle tryPosition = body.getStart(); InstructionHandle catchPosition = body.getEnd(); body.insert(body.getStart(), prepend); synchronizedMethod.getBody().append(finallyBlock);
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
synchronizedMethod.addExceptionHandler(tryPosition, catchPosition, finallyStart, null, false); synchronizedMethod.addExceptionHandler(tryInstruction, catchInstruction, catchBlockStart, (ObjectType) Type.getType(ClassNotFoundException.class), true); synchronizedMethod.addExceptionHandler(finallyStart, finallyStart.getNext(), finallyStart, null, false); } } else { Type classType = BcelWorld.makeBcelType(synchronizedMethod.getEnclosingClass().getType()); prepend.append(InstructionFactory.createLoad(classType, 0)); prepend.append(InstructionFactory.createDup(1)); int slotForThis = synchronizedMethod.allocateLocal(classType); prepend.append(InstructionFactory.createStore(classType, slotForThis)); prepend.append(InstructionFactory.MONITORENTER);
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
InstructionList finallyBlock = new InstructionList(); finallyBlock.append(InstructionFactory.createLoad(classType, slotForThis)); finallyBlock.append(InstructionConstants.MONITOREXIT); finallyBlock.append(InstructionConstants.ATHROW); InstructionHandle walker = body.getStart(); List<InstructionHandle> rets = new ArrayList<InstructionHandle>(); while (walker != null) { if (walker.getInstruction().isReturnInstruction()) { rets.add(walker); } walker = walker.getNext(); } if (!rets.isEmpty()) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
for (Iterator<InstructionHandle> iter = rets.iterator(); iter.hasNext();) { InstructionHandle element = iter.next(); InstructionList monitorExitBlock = new InstructionList(); monitorExitBlock.append(InstructionFactory.createLoad(classType, slotForThis)); monitorExitBlock.append(InstructionConstants.MONITOREXIT); InstructionHandle monitorExitBlockStart = body.insert(element, monitorExitBlock); for (InstructionTargeter targeter : element.getTargetersCopy()) { if (targeter instanceof LocalVariableTag) { } else if (targeter instanceof LineNumberTag) { } else if (targeter instanceof InstructionBranch) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
targeter.updateTarget(element, monitorExitBlockStart); } else { throw new BCException("Unexpected targeter encountered during transform: " + targeter); } } } } InstructionHandle finallyStart = finallyBlock.getStart(); InstructionHandle tryPosition = body.getStart(); InstructionHandle catchPosition = body.getEnd(); body.insert(body.getStart(), prepend); synchronizedMethod.getBody().append(finallyBlock); synchronizedMethod.addExceptionHandler(tryPosition, catchPosition, finallyStart, null, false); synchronizedMethod.addExceptionHandler(finallyStart, finallyStart.getNext(), finallyStart, null, false); } if (trace.isTraceEnabled()) { trace.exit("transformSynchronizedMethod"); } } /** * generate the instructions to be inlined.
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
* * @param donor the method from which we will copy (and adjust frame and jumps) instructions. * @param recipient the method the instructions will go into. Used to get the frame size so we can allocate new frame locations * for locals in donor. * @param frameEnv an environment to map from donor frame to recipient frame, initially populated with argument locations. * @param fact an instruction factory for recipient */ static InstructionList genInlineInstructions(LazyMethodGen donor, LazyMethodGen recipient, IntMap frameEnv, InstructionFactory fact, boolean keepReturns) { InstructionList footer = new InstructionList(); InstructionHandle end = footer.append(InstructionConstants.NOP); InstructionList ret = new InstructionList(); InstructionList sourceList = donor.getBody(); Map<InstructionHandle, InstructionHandle> srcToDest = new HashMap<InstructionHandle, InstructionHandle>(); ConstantPool donorCpg = donor.getEnclosingClass().getConstantPool(); ConstantPool recipientCpg = recipient.getEnclosingClass().getConstantPool(); boolean isAcrossClass = donorCpg != recipientCpg; for (InstructionHandle src = sourceList.getStart(); src != null; src = src.getNext()) { Instruction fresh = Utility.copyInstruction(src.getInstruction()); InstructionHandle dest; if (fresh.isConstantPoolInstruction()) { if (isAcrossClass) { InstructionCP cpi = (InstructionCP) fresh;
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
cpi.setIndex(recipientCpg.addConstant(donorCpg.getConstant(cpi.getIndex()), donorCpg)); } } if (src.getInstruction() == Range.RANGEINSTRUCTION) { dest = ret.append(Range.RANGEINSTRUCTION); } else if (fresh.isReturnInstruction()) { if (keepReturns) { dest = ret.append(fresh); } else { dest = ret.append(InstructionFactory.createBranchInstruction(Constants.GOTO, end)); } } else if (fresh instanceof InstructionBranch) { dest = ret.append((InstructionBranch) fresh); } else if (fresh.isLocalVariableInstruction() || fresh instanceof RET) { int oldIndex = fresh.getIndex(); int freshIndex; if (!frameEnv.hasKey(oldIndex)) { freshIndex = recipient.allocateLocal(2); frameEnv.put(oldIndex, freshIndex); } else { freshIndex = frameEnv.get(oldIndex); } if (fresh instanceof RET) { fresh.setIndex(freshIndex); } else { fresh = ((InstructionLV) fresh).setIndexAndCopyIfNecessary(freshIndex); } dest = ret.append(fresh); } else {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
dest = ret.append(fresh); } srcToDest.put(src, dest); } Map<Tag, Tag> tagMap = new HashMap<Tag, Tag>(); Map<BcelShadow, BcelShadow> shadowMap = new HashMap<BcelShadow, BcelShadow>(); for (InstructionHandle dest = ret.getStart(), src = sourceList.getStart(); dest != null; dest = dest.getNext(), src = src .getNext()) { Instruction inst = dest.getInstruction(); if (inst instanceof InstructionBranch) { InstructionBranch branch = (InstructionBranch) inst; InstructionHandle oldTarget = branch.getTarget(); InstructionHandle newTarget = srcToDest.get(oldTarget); if (newTarget == null) { } else { branch.setTarget(newTarget); if (branch instanceof InstructionSelect) { InstructionSelect select = (InstructionSelect) branch; InstructionHandle[] oldTargets = select.getTargets(); for (int k = oldTargets.length - 1; k >= 0; k--) { select.setTarget(k, srcToDest.get(oldTargets[k])); } } } }
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
Iterator<InstructionTargeter> tIter = src.getTargeters().iterator(); while (tIter.hasNext()) { InstructionTargeter old = tIter.next(); if (old instanceof Tag) { Tag oldTag = (Tag) old; Tag fresh = tagMap.get(oldTag); if (fresh == null) { fresh = oldTag.copy(); if (old instanceof LocalVariableTag) { LocalVariableTag lvTag = (LocalVariableTag) old; LocalVariableTag lvTagFresh = (LocalVariableTag) fresh; if (lvTag.getSlot() == 0) { fresh = new LocalVariableTag(lvTag.getRealType().getSignature(), "ajc$aspectInstance", frameEnv.get(lvTag.getSlot()), 0); } else { lvTagFresh.updateSlot(frameEnv.get(lvTag.getSlot())); } } tagMap.put(oldTag, fresh); } dest.addTargeter(fresh); } else if (old instanceof ExceptionRange) { ExceptionRange er = (ExceptionRange) old; if (er.getStart() == src) { ExceptionRange freshEr = new ExceptionRange(recipient.getBody(), er.getCatchType(), er.getPriority());
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
freshEr.associateWithTargets(dest, srcToDest.get(er.getEnd()), srcToDest.get(er.getHandler())); } } else if (old instanceof ShadowRange) { ShadowRange oldRange = (ShadowRange) old; if (oldRange.getStart() == src) { BcelShadow oldShadow = oldRange.getShadow(); BcelShadow freshEnclosing = oldShadow.getEnclosingShadow() == null ? null : (BcelShadow) shadowMap .get(oldShadow.getEnclosingShadow()); BcelShadow freshShadow = oldShadow.copyInto(recipient, freshEnclosing); ShadowRange freshRange = new ShadowRange(recipient.getBody()); freshRange.associateWithShadow(freshShadow); freshRange.associateWithTargets(dest, srcToDest.get(oldRange.getEnd())); shadowMap.put(oldShadow, freshShadow); } } } } if (!keepReturns) { ret.append(footer); } return ret; }
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
/** * generate the argument stores in preparation for inlining. * * @param donor the method we will inline from. Used to get the signature. * @param recipient the method we will inline into. Used to get the frame size so we can allocate fresh locations. * @param frameEnv an empty environment we populate with a map from donor frame to recipient frame. * @param fact an instruction factory for recipient */ private static InstructionList genArgumentStores(LazyMethodGen donor, LazyMethodGen recipient, IntMap frameEnv, InstructionFactory fact) { InstructionList ret = new InstructionList();
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
int donorFramePos = 0; if (!donor.isStatic()) { int targetSlot = recipient.allocateLocal(Type.OBJECT); ret.insert(InstructionFactory.createStore(Type.OBJECT, targetSlot)); frameEnv.put(donorFramePos, targetSlot); donorFramePos += 1; } Type[] argTypes = donor.getArgumentTypes(); for (int i = 0, len = argTypes.length; i < len; i++) { Type argType = argTypes[i]; int argSlot = recipient.allocateLocal(argType); ret.insert(InstructionFactory.createStore(argType, argSlot)); frameEnv.put(donorFramePos, argSlot); donorFramePos += argType.getSize(); } return ret; } /** * get a called method: Assumes the called method is in this class, and the reference to it is exact (a la INVOKESPECIAL). * * @param ih The InvokeInstruction instructionHandle pointing to the called method. */ private LazyMethodGen getCalledMethod(InstructionHandle ih) { InvokeInstruction inst = (InvokeInstruction) ih.getInstruction(); String methodName = inst.getName(cpg); String signature = inst.getSignature(cpg); return clazz.getLazyMethodGen(methodName, signature); } private void weaveInAddedMethods() {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
Collections.sort(addedLazyMethodGens, new Comparator<LazyMethodGen>() { public int compare(LazyMethodGen aa, LazyMethodGen bb) { int i = aa.getName().compareTo(bb.getName()); if (i != 0) { return i; } return aa.getSignature().compareTo(bb.getSignature()); } }); for (LazyMethodGen addedMember : addedLazyMethodGens) { clazz.addMethodGen(addedMember); } }
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
/** * Returns null if this is not a Java constructor, and then we won't weave into it at all */ private InstructionHandle findSuperOrThisCall(LazyMethodGen mg) { int depth = 1; InstructionHandle start = mg.getBody().getStart(); while (true) { if (start == null) { return null; } Instruction inst = start.getInstruction(); if (inst.opcode == Constants.INVOKESPECIAL && ((InvokeInstruction) inst).getName(cpg).equals("<init>")) { depth--; if (depth == 0) { return start; } } else if (inst.opcode == Constants.NEW) { depth++; } start = start.getNext(); } } private boolean match(LazyMethodGen mg) { BcelShadow enclosingShadow; List<BcelShadow> shadowAccumulator = new ArrayList<BcelShadow>(); boolean isOverweaving = world.isOverWeaving(); boolean startsAngly = mg.getName().charAt(0) == '<'; if (startsAngly && mg.getName().equals("<init>")) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
return matchInit(mg, shadowAccumulator); } else if (!shouldWeaveBody(mg)) { return false; } else { if (startsAngly && mg.getName().equals("<clinit>")) { enclosingShadow = BcelShadow.makeStaticInitialization(world, mg); } else if (mg.isAdviceMethod()) { enclosingShadow = BcelShadow.makeAdviceExecution(world, mg); } else { AjAttribute.EffectiveSignatureAttribute effective = mg.getEffectiveSignature(); if (effective == null) { if (isOverweaving && mg.getName().startsWith(NameMangler.PREFIX)) { return false; } enclosingShadow = BcelShadow.makeMethodExecution(world, mg, !canMatchBodyShadows); } else if (effective.isWeaveBody()) { ResolvedMember rm = effective.getEffectiveSignature(); fixParameterNamesForResolvedMember(rm, mg.getMemberView()); fixAnnotationsForResolvedMember(rm, mg.getMemberView()); enclosingShadow = BcelShadow.makeShadowForMethod(world, mg, effective.getShadowKind(), rm); } else { return false;
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} } if (canMatchBodyShadows) { for (InstructionHandle h = mg.getBody().getStart(); h != null; h = h.getNext()) { match(mg, h, enclosingShadow, shadowAccumulator); } } if (canMatch(enclosingShadow.getKind()) && !(mg.getName().charAt(0) == 'a' && mg.getName().startsWith("ajc$interFieldInit"))) { if (match(enclosingShadow, shadowAccumulator)) { enclosingShadow.init(); } } mg.matchedShadows = shadowAccumulator; return !shadowAccumulator.isEmpty(); } } private boolean matchInit(LazyMethodGen mg, List<BcelShadow> shadowAccumulator) { BcelShadow enclosingShadow; InstructionHandle superOrThisCall = findSuperOrThisCall(mg); if (superOrThisCall == null) { return false; } enclosingShadow = BcelShadow.makeConstructorExecution(world, mg, superOrThisCall); if (mg.getEffectiveSignature() != null) { enclosingShadow.setMatchingSignature(mg.getEffectiveSignature().getEffectiveSignature());
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} boolean beforeSuperOrThisCall = true; if (shouldWeaveBody(mg)) { if (canMatchBodyShadows) { for (InstructionHandle h = mg.getBody().getStart(); h != null; h = h.getNext()) { if (h == superOrThisCall) { beforeSuperOrThisCall = false; continue; } match(mg, h, beforeSuperOrThisCall ? null : enclosingShadow, shadowAccumulator); } } if (canMatch(Shadow.ConstructorExecution)) { match(enclosingShadow, shadowAccumulator); } } if (!isThisCall(superOrThisCall)) { InstructionHandle curr = enclosingShadow.getRange().getStart(); for (Iterator<IfaceInitList> i = addedSuperInitializersAsList.iterator(); i.hasNext();) { IfaceInitList l = i.next(); Member ifaceInitSig = AjcMemberMaker.interfaceConstructor(l.onType); BcelShadow initShadow = BcelShadow.makeIfaceInitialization(world, mg, ifaceInitSig); InstructionList inits = genInitInstructions(l.list, false); if (match(initShadow, shadowAccumulator) || !inits.isEmpty()) { initShadow.initIfaceInitializer(curr); initShadow.getRange().insert(inits, Range.OutsideBefore);
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} } InstructionList inits = genInitInstructions(addedThisInitializers, false); enclosingShadow.getRange().insert(inits, Range.OutsideBefore); } boolean addedInitialization = match(BcelShadow.makeUnfinishedInitialization(world, mg), initializationShadows); addedInitialization |= match(BcelShadow.makeUnfinishedPreinitialization(world, mg), initializationShadows); mg.matchedShadows = shadowAccumulator; return addedInitialization || !shadowAccumulator.isEmpty(); } private boolean shouldWeaveBody(LazyMethodGen mg) { if (mg.isBridgeMethod()) { return false; } if (mg.isAjSynthetic()) { return mg.getName().equals("<clinit>"); } AjAttribute.EffectiveSignatureAttribute a = mg.getEffectiveSignature(); if (a != null) { return a.isWeaveBody(); } return true; }
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
/** * first sorts the mungers, then gens the initializers in the right order */ private InstructionList genInitInstructions(List<ConcreteTypeMunger> list, boolean isStatic) { list = PartialOrder.sort(list); if (list == null) { throw new BCException("circularity in inter-types"); } InstructionList ret = new InstructionList(); for (ConcreteTypeMunger cmunger : list) { NewFieldTypeMunger munger = (NewFieldTypeMunger) cmunger.getMunger(); ResolvedMember initMethod = munger.getInitMethod(cmunger.getAspectType()); if (!isStatic) { ret.append(InstructionConstants.ALOAD_0); } ret.append(Utility.createInvoke(fact, world, initMethod)); } return ret; } private void match(LazyMethodGen mg, InstructionHandle ih, BcelShadow enclosingShadow, List<BcelShadow> shadowAccumulator) { Instruction i = ih.getInstruction(); if (canMatch(Shadow.ExceptionHandler) && !Range.isRangeHandle(ih)) { Set<InstructionTargeter> targeters = ih.getTargetersCopy(); for (InstructionTargeter t : targeters) { if (t instanceof ExceptionRange) { ExceptionRange er = (ExceptionRange) t; if (er.getCatchType() == null) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
continue; } if (isInitFailureHandler(ih)) { return; } if (!ih.getInstruction().isStoreInstruction() && ih.getInstruction().getOpcode() != Constants.NOP) { mg.getBody().insert(ih, InstructionConstants.NOP); InstructionHandle newNOP = ih.getPrev(); er.updateTarget(ih, newNOP, mg.getBody()); for (InstructionTargeter t2 : targeters) { newNOP.addTargeter(t2); } ih.removeAllTargeters(); match(BcelShadow.makeExceptionHandler(world, er, mg, newNOP, enclosingShadow), shadowAccumulator); } else { match(BcelShadow.makeExceptionHandler(world, er, mg, ih, enclosingShadow), shadowAccumulator); } } }
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} if ((i instanceof FieldInstruction) && (canMatch(Shadow.FieldGet) || canMatch(Shadow.FieldSet))) { FieldInstruction fi = (FieldInstruction) i; if (fi.opcode == Constants.PUTFIELD || fi.opcode == Constants.PUTSTATIC) { InstructionHandle prevHandle = ih.getPrev(); Instruction prevI = prevHandle.getInstruction(); if (Utility.isConstantPushInstruction(prevI)) { Member field = BcelWorld.makeFieldJoinPointSignature(clazz, (FieldInstruction) i); ResolvedMember resolvedField = field.resolve(world); if (resolvedField == null) { } else if (Modifier.isFinal(resolvedField.getModifiers())) { } else { if (canMatch(Shadow.FieldSet)) { matchSetInstruction(mg, ih, enclosingShadow, shadowAccumulator); } } } else { if (canMatch(Shadow.FieldSet)) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
matchSetInstruction(mg, ih, enclosingShadow, shadowAccumulator); } } } else { if (canMatch(Shadow.FieldGet)) { matchGetInstruction(mg, ih, enclosingShadow, shadowAccumulator); } } } else if (i instanceof InvokeInstruction) { InvokeInstruction ii = (InvokeInstruction) i; if (ii.getMethodName(clazz.getConstantPool()).equals("<init>")) { if (canMatch(Shadow.ConstructorCall)) { match(BcelShadow.makeConstructorCall(world, mg, ih, enclosingShadow), shadowAccumulator); } } else if (ii.opcode == Constants.INVOKESPECIAL) { String onTypeName = ii.getClassName(cpg); if (onTypeName.equals(mg.getEnclosingClass().getName())) { matchInvokeInstruction(mg, ih, ii, enclosingShadow, shadowAccumulator); } else { } } else { if (ii.getOpcode()!=Constants.INVOKEDYNAMIC) { matchInvokeInstruction(mg, ih, ii, enclosingShadow, shadowAccumulator); } } } else if (world.isJoinpointArrayConstructionEnabled() && i.isArrayCreationInstruction()) { if (canMatch(Shadow.ConstructorCall)) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (i.opcode == Constants.ANEWARRAY) { BcelShadow ctorCallShadow = BcelShadow.makeArrayConstructorCall(world, mg, ih, enclosingShadow); match(ctorCallShadow, shadowAccumulator); } else if (i.opcode == Constants.NEWARRAY) { BcelShadow ctorCallShadow = BcelShadow.makeArrayConstructorCall(world, mg, ih, enclosingShadow); match(ctorCallShadow, shadowAccumulator); } else if (i instanceof MULTIANEWARRAY) { BcelShadow ctorCallShadow = BcelShadow.makeArrayConstructorCall(world, mg, ih, enclosingShadow); match(ctorCallShadow, shadowAccumulator); } } } else if (world.isJoinpointSynchronizationEnabled() && ((i.getOpcode() == Constants.MONITORENTER) || (i.getOpcode() == Constants.MONITOREXIT))) { if (i.getOpcode() == Constants.MONITORENTER) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
BcelShadow monitorEntryShadow = BcelShadow.makeMonitorEnter(world, mg, ih, enclosingShadow); match(monitorEntryShadow, shadowAccumulator); } else { BcelShadow monitorExitShadow = BcelShadow.makeMonitorExit(world, mg, ih, enclosingShadow); match(monitorExitShadow, shadowAccumulator); } } } private boolean isInitFailureHandler(InstructionHandle ih) { InstructionHandle twoInstructionsAway = ih.getNext().getNext(); if (twoInstructionsAway.getInstruction().opcode == Constants.PUTSTATIC) { String name = ((FieldInstruction) twoInstructionsAway.getInstruction()).getFieldName(cpg); if (name.equals(NameMangler.INITFAILURECAUSE_FIELD_NAME)) { return true; } } return false; } private void matchSetInstruction(LazyMethodGen mg, InstructionHandle ih, BcelShadow enclosingShadow, List<BcelShadow> shadowAccumulator) { FieldInstruction fi = (FieldInstruction) ih.getInstruction(); Member field = BcelWorld.makeFieldJoinPointSignature(clazz, fi); if (field.getName().startsWith(NameMangler.PREFIX)) { return;
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} ResolvedMember resolvedField = field.resolve(world); if (resolvedField == null) { return; } else if (Modifier.isFinal(resolvedField.getModifiers()) && Utility.isConstantPushInstruction(ih.getPrev().getInstruction())) { return; } else if (resolvedField.isSynthetic()) { return; } else { BcelShadow bs = BcelShadow.makeFieldSet(world, resolvedField, mg, ih, enclosingShadow); String cname = fi.getClassName(cpg); if (!resolvedField.getDeclaringType().getName().equals(cname)) { bs.setActualTargetType(cname); } match(bs, shadowAccumulator); } } private void matchGetInstruction(LazyMethodGen mg, InstructionHandle ih, BcelShadow enclosingShadow, List<BcelShadow> shadowAccumulator) { FieldInstruction fi = (FieldInstruction) ih.getInstruction(); Member field = BcelWorld.makeFieldJoinPointSignature(clazz, fi); if (field.getName().startsWith(NameMangler.PREFIX)) { return;
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} ResolvedMember resolvedField = field.resolve(world); if (resolvedField == null) { return; } else if (resolvedField.isSynthetic()) { return; } else { BcelShadow bs = BcelShadow.makeFieldGet(world, resolvedField, mg, ih, enclosingShadow); String cname = fi.getClassName(cpg); if (!resolvedField.getDeclaringType().getName().equals(cname)) { bs.setActualTargetType(cname); } match(bs, shadowAccumulator); } } /** * For some named resolved type, this method looks for a member with a particular name - it should only be used when you truly * believe there is only one member with that name in the type as it returns the first one it finds. */ private ResolvedMember findResolvedMemberNamed(ResolvedType type, String methodName) { ResolvedMember[] allMethods = type.getDeclaredMethods(); for (int i = 0; i < allMethods.length; i++) { ResolvedMember member = allMethods[i]; if (member.getName().equals(methodName)) { return member; } } return null;
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} /** * Find the specified member in the specified type. * * @param type the type to search for the member * @param methodName the name of the method to find * @param params the method parameters that the discovered method should have */ private ResolvedMember findResolvedMemberNamed(ResolvedType type, String methodName, UnresolvedType[] params) { ResolvedMember[] allMethods = type.getDeclaredMethods(); List<ResolvedMember> candidates = new ArrayList<ResolvedMember>(); for (int i = 0; i < allMethods.length; i++) { ResolvedMember candidate = allMethods[i]; if (candidate.getName().equals(methodName)) { if (candidate.getArity() == params.length) { candidates.add(candidate); } } } if (candidates.size() == 0) { return null; } else if (candidates.size() == 1) { return candidates.get(0); } else { for (ResolvedMember candidate : candidates) { boolean allOK = true; UnresolvedType[] candidateParams = candidate.getParameterTypes();
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
for (int p = 0; p < candidateParams.length; p++) { if (!candidateParams[p].getErasureSignature().equals(params[p].getErasureSignature())) { allOK = false; break; } } if (allOK) { return candidate; } } } return null; } /** * For a given resolvedmember, this will discover the real annotations for it. <b>Should only be used when the resolvedmember is * the contents of an effective signature attribute, as thats the only time when the annotations aren't stored directly in the * resolvedMember</b> * * @param rm the sig we want it to pretend to be 'int A.m()' or somesuch ITD like thing * @param declaredSig the real sig 'blah.ajc$xxx' */ private void fixParameterNamesForResolvedMember(ResolvedMember rm, ResolvedMember declaredSig) { UnresolvedType memberHostType = declaredSig.getDeclaringType(); String methodName = declaredSig.getName(); String[] pnames = null; if (rm.getKind() == Member.METHOD && !rm.isAbstract()) { if (methodName.startsWith("ajc$inlineAccessMethod") || methodName.startsWith("ajc$superDispatch")) { ResolvedMember resolvedDooberry = world.resolve(declaredSig); pnames = resolvedDooberry.getParameterNames(); } else {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
ResolvedMember realthing = AjcMemberMaker.interMethodDispatcher(rm.resolve(world), memberHostType).resolve(world); ResolvedMember theRealMember = findResolvedMemberNamed(memberHostType.resolve(world), realthing.getName()); if (theRealMember != null) { pnames = theRealMember.getParameterNames(); if (pnames.length > 0 && pnames[0].equals("ajc$this_")) { String[] pnames2 = new String[pnames.length - 1]; System.arraycopy(pnames, 1, pnames2, 0, pnames2.length); pnames = pnames2; } } } } rm.setParameterNames(pnames); } /** * For a given resolvedmember, this will discover the real annotations for it. <b>Should only be used when the resolvedmember is * the contents of an effective signature attribute, as thats the only time when the annotations aren't stored directly in the * resolvedMember</b> * * @param rm the sig we want it to pretend to be 'int A.m()' or somesuch ITD like thing * @param declaredSig the real sig 'blah.ajc$xxx' */ private void fixAnnotationsForResolvedMember(ResolvedMember rm, ResolvedMember declaredSig) { try { UnresolvedType memberHostType = declaredSig.getDeclaringType(); boolean containsKey = mapToAnnotationHolder.containsKey(rm); ResolvedMember realAnnotationHolder = mapToAnnotationHolder.get(rm); String methodName = declaredSig.getName();
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (!containsKey) { if (rm.getKind() == Member.FIELD) { if (methodName.startsWith("ajc$inlineAccessField")) { realAnnotationHolder = world.resolve(rm); } else { ResolvedMember realthing = AjcMemberMaker.interFieldInitializer(rm, memberHostType); realAnnotationHolder = world.resolve(realthing); } } else if (rm.getKind() == Member.METHOD && !rm.isAbstract()) { if (methodName.startsWith("ajc$inlineAccessMethod") || methodName.startsWith("ajc$superDispatch")) { realAnnotationHolder = world.resolve(declaredSig); } else { ResolvedMember realthing = AjcMemberMaker.interMethodDispatcher(rm.resolve(world), memberHostType).resolve(world); realAnnotationHolder = findResolvedMemberNamed(memberHostType.resolve(world), realthing.getName(),realthing.getParameterTypes()); if (realAnnotationHolder == null) { throw new UnsupportedOperationException( "Known limitation in M4 - can't find ITD members when type variable is used as an argument and has upper bound specified"); } } } else if (rm.getKind() == Member.CONSTRUCTOR) { ResolvedMember realThing = AjcMemberMaker.postIntroducedConstructor(memberHostType.resolve(world),rm.getDeclaringType(), rm.getParameterTypes()); realAnnotationHolder = world.resolve(realThing); if (realAnnotationHolder == null) { throw new UnsupportedOperationException("Known limitation in M4 - can't find ITD members when type variable is used as an argument and has upper bound specified"); } } mapToAnnotationHolder.put(rm, realAnnotationHolder); }
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
ResolvedType[] annotationTypes; AnnotationAJ[] annotations; if (realAnnotationHolder!=null) { annotationTypes = realAnnotationHolder.getAnnotationTypes(); annotations = realAnnotationHolder.getAnnotations(); if (annotationTypes==null) { annotationTypes = ResolvedType.EMPTY_ARRAY; } if (annotations==null) { annotations = AnnotationAJ.EMPTY_ARRAY; } } else { annotations = AnnotationAJ.EMPTY_ARRAY; annotationTypes = ResolvedType.EMPTY_ARRAY; } rm.setAnnotations(annotations); rm.setAnnotationTypes(annotationTypes); } catch (UnsupportedOperationException ex) { throw ex; } catch (Throwable t) { throw new BCException("Unexpectedly went bang when searching for annotations on " + rm, t); } } private void matchInvokeInstruction(LazyMethodGen mg, InstructionHandle ih, InvokeInstruction invoke, BcelShadow enclosingShadow, List<BcelShadow> shadowAccumulator) { String methodName = invoke.getName(cpg); if (methodName.startsWith(NameMangler.PREFIX)) { Member jpSig = world.makeJoinPointSignatureForMethodInvocation(clazz, invoke);
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
ResolvedMember declaredSig = jpSig.resolve(world); if (declaredSig == null) { return; } if (declaredSig.getKind() == Member.FIELD) { Shadow.Kind kind; if (jpSig.getReturnType().equals(UnresolvedType.VOID)) { kind = Shadow.FieldSet; } else { kind = Shadow.FieldGet; } if (canMatch(Shadow.FieldGet) || canMatch(Shadow.FieldSet)) { match(BcelShadow.makeShadowForMethodCall(world, mg, ih, enclosingShadow, kind, declaredSig), shadowAccumulator); } } else { AjAttribute.EffectiveSignatureAttribute effectiveSig = declaredSig.getEffectiveSignature(); if (effectiveSig == null) { return; } if (effectiveSig.isWeaveBody()) { return; } ResolvedMember rm = effectiveSig.getEffectiveSignature(); fixParameterNamesForResolvedMember(rm, declaredSig); fixAnnotationsForResolvedMember(rm, declaredSig); if (canMatch(effectiveSig.getShadowKind())) { match(BcelShadow.makeShadowForMethodCall(world, mg, ih, enclosingShadow, effectiveSig.getShadowKind(), rm),
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
shadowAccumulator); } } } else { if (canMatch(Shadow.MethodCall)) { boolean proceed = true; if (world.isOverWeaving()) { String s = invoke.getClassName(mg.getConstantPool()); if (s.length() > 4 && s.charAt(4) == 'a' && (s.equals("org.aspectj.runtime.internal.CFlowCounter") || s.equals("org.aspectj.runtime.internal.CFlowStack") || s .equals("org.aspectj.runtime.reflect.Factory"))) { proceed = false; } else { if (methodName.equals("aspectOf")) { proceed = false; } } } if (proceed) { match(BcelShadow.makeMethodCall(world, mg, ih, enclosingShadow), shadowAccumulator); } } } }
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
private static boolean checkedXsetForLowLevelContextCapturing = false; private static boolean captureLowLevelContext = false; private boolean match(BcelShadow shadow, List<BcelShadow> shadowAccumulator) { if (captureLowLevelContext) { ContextToken shadowMatchToken = CompilationAndWeavingContext.enteringPhase( CompilationAndWeavingContext.MATCHING_SHADOW, shadow); boolean isMatched = false; Shadow.Kind shadowKind = shadow.getKind(); List<ShadowMunger> candidateMungers = indexedShadowMungers[shadowKind.getKey()]; if (candidateMungers != null) { for (ShadowMunger munger : candidateMungers) { ContextToken mungerMatchToken = CompilationAndWeavingContext.enteringPhase( CompilationAndWeavingContext.MATCHING_POINTCUT, munger.getPointcut()); if (munger.match(shadow, world)) { shadow.addMunger(munger); isMatched = true; if (shadow.getKind() == Shadow.StaticInitialization) { clazz.warnOnAddedStaticInitializer(shadow, munger.getSourceLocation()); } } CompilationAndWeavingContext.leavingPhase(mungerMatchToken); } if (isMatched) { shadowAccumulator.add(shadow); } } CompilationAndWeavingContext.leavingPhase(shadowMatchToken); return isMatched;
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} else { boolean isMatched = false; Shadow.Kind shadowKind = shadow.getKind(); List<ShadowMunger> candidateMungers = indexedShadowMungers[shadowKind.getKey()]; if (candidateMungers != null) { for (ShadowMunger munger : candidateMungers) { if (munger.match(shadow, world)) { shadow.addMunger(munger); isMatched = true; if (shadow.getKind() == Shadow.StaticInitialization) { clazz.warnOnAddedStaticInitializer(shadow, munger.getSourceLocation()); } } } if (isMatched) { shadowAccumulator.add(shadow); } } return isMatched; } } private void implement(LazyMethodGen mg) { List<BcelShadow> shadows = mg.matchedShadows; if (shadows == null) { return; }
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
for (BcelShadow shadow : shadows) { ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.IMPLEMENTING_ON_SHADOW, shadow); shadow.implement(); CompilationAndWeavingContext.leavingPhase(tok); } mg.getMaxLocals(); mg.matchedShadows = null; } public LazyClassGen getLazyClassGen() { return clazz; } public BcelWorld getWorld() { return world; } public void setReweavableMode(boolean mode) { inReweavableMode = mode; } public boolean getReweavableMode() { return inReweavableMode; } @Override public String toString() { return "BcelClassWeaver instance for : " + clazz; } }
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
/* ******************************************************************* * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). * All rights reserved. * This program and the accompanying materials are made available * under the terms of the Eclipse Public License v1.0 * which accompanies this distribution and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * PARC initial implementation * Alexandre Vasseur perClause support for @AJ aspects * ******************************************************************/ package org.aspectj.weaver.bcel; import java.io.File; import java.io.IOException; import java.lang.reflect.Modifier; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map;
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
import java.util.StringTokenizer; import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.ClassParser; import org.aspectj.apache.bcel.classfile.ConstantPool; import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.apache.bcel.generic.FieldInstruction; import org.aspectj.apache.bcel.generic.INVOKEINTERFACE; import org.aspectj.apache.bcel.generic.Instruction; import org.aspectj.apache.bcel.generic.InstructionHandle; import org.aspectj.apache.bcel.generic.InvokeInstruction; import org.aspectj.apache.bcel.generic.MULTIANEWARRAY; import org.aspectj.apache.bcel.generic.ObjectType; import org.aspectj.apache.bcel.generic.Type; import org.aspectj.apache.bcel.util.ClassLoaderReference; import org.aspectj.apache.bcel.util.ClassLoaderRepository; import org.aspectj.apache.bcel.util.ClassPath; import org.aspectj.apache.bcel.util.NonCachingClassLoaderRepository; import org.aspectj.apache.bcel.util.Repository; import org.aspectj.asm.AsmManager; import org.aspectj.asm.IRelationship; import org.aspectj.asm.internal.CharOperation; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.IMessageHandler; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.Message; import org.aspectj.bridge.MessageUtil; import org.aspectj.bridge.WeaveMessage; import org.aspectj.weaver.Advice; import org.aspectj.weaver.AdviceKind; import org.aspectj.weaver.AnnotationAJ;
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
import org.aspectj.weaver.AnnotationOnTypeMunger; import org.aspectj.weaver.BCException; import org.aspectj.weaver.Checker; import org.aspectj.weaver.ICrossReferenceHandler; import org.aspectj.weaver.IWeavingSupport; import org.aspectj.weaver.Member; import org.aspectj.weaver.MemberImpl; import org.aspectj.weaver.MemberKind; import org.aspectj.weaver.NewParentTypeMunger; import org.aspectj.weaver.ReferenceType; import org.aspectj.weaver.ReferenceTypeDelegate; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedMemberImpl; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.ResolvedTypeMunger; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.ShadowMunger; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.World; import org.aspectj.weaver.loadtime.definition.Definition; import org.aspectj.weaver.loadtime.definition.DocumentParser; import org.aspectj.weaver.model.AsmRelationshipProvider; import org.aspectj.weaver.patterns.DeclareAnnotation; import org.aspectj.weaver.patterns.DeclareParents; import org.aspectj.weaver.patterns.ParserException; import org.aspectj.weaver.patterns.PatternParser; import org.aspectj.weaver.patterns.TypePattern; import org.aspectj.weaver.tools.Trace; import org.aspectj.weaver.tools.TraceFactory; public class BcelWorld extends World implements Repository {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
private final ClassPathManager classPath; protected Repository delegate; private BcelWeakClassLoaderReference loaderRef; private final BcelWeavingSupport bcelWeavingSupport = new BcelWeavingSupport(); private boolean isXmlConfiguredWorld = false; private WeavingXmlConfig xmlConfiguration; private List<TypeDelegateResolver> typeDelegateResolvers; private static Trace trace = TraceFactory.getTraceFactory().getTrace(BcelWorld.class); public BcelWorld() { this(""); } public BcelWorld(String cp) { this(makeDefaultClasspath(cp), IMessageHandler.THROW, null); } public IRelationship.Kind determineRelKind(ShadowMunger munger) { AdviceKind ak = ((Advice) munger).getKind(); if (ak.getKey() == AdviceKind.Before.getKey()) { return IRelationship.Kind.ADVICE_BEFORE; } else if (ak.getKey() == AdviceKind.After.getKey()) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
return IRelationship.Kind.ADVICE_AFTER; } else if (ak.getKey() == AdviceKind.AfterThrowing.getKey()) { return IRelationship.Kind.ADVICE_AFTERTHROWING; } else if (ak.getKey() == AdviceKind.AfterReturning.getKey()) { return IRelationship.Kind.ADVICE_AFTERRETURNING; } else if (ak.getKey() == AdviceKind.Around.getKey()) { return IRelationship.Kind.ADVICE_AROUND; } else if (ak.getKey() == AdviceKind.CflowEntry.getKey() || ak.getKey() == AdviceKind.CflowBelowEntry.getKey() || ak.getKey() == AdviceKind.InterInitializer.getKey() || ak.getKey() == AdviceKind.PerCflowEntry.getKey() || ak.getKey() == AdviceKind.PerCflowBelowEntry.getKey() || ak.getKey() == AdviceKind.PerThisEntry.getKey() || ak.getKey() == AdviceKind.PerTargetEntry.getKey() || ak.getKey() == AdviceKind.Softener.getKey() || ak.getKey() == AdviceKind.PerTypeWithinEntry.getKey()) { return null; } throw new RuntimeException("Shadow.determineRelKind: What the hell is it? " + ak); } @Override public void reportMatch(ShadowMunger munger, Shadow shadow) { if (getCrossReferenceHandler() != null) { getCrossReferenceHandler().addCrossReference(munger.getSourceLocation(), shadow.getSourceLocation(), determineRelKind(munger).getName(), ((Advice) munger).hasDynamicTests() ); } if (!getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) { reportWeavingMessage(munger, shadow); } if (getModel() != null) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
AsmRelationshipProvider.addAdvisedRelationship(getModelAsAsmManager(), shadow, munger); } } /* * Report a message about the advice weave that has occurred. Some messing about to make it pretty ! This code is just asking * for an NPE to occur ... */ private void reportWeavingMessage(ShadowMunger munger, Shadow shadow) { Advice advice = (Advice) munger; AdviceKind aKind = advice.getKind(); if (aKind == null || advice.getConcreteAspect() == null) { return; } if (!(aKind.equals(AdviceKind.Before) || aKind.equals(AdviceKind.After) || aKind.equals(AdviceKind.AfterReturning) || aKind.equals(AdviceKind.AfterThrowing) || aKind.equals(AdviceKind.Around) || aKind.equals(AdviceKind.Softener))) { return; } if (shadow.getKind() == Shadow.SynchronizationUnlock) { if (advice.lastReportedMonitorExitJoinpointLocation == null) { advice.lastReportedMonitorExitJoinpointLocation = shadow.getSourceLocation(); } else { if (areTheSame(shadow.getSourceLocation(), advice.lastReportedMonitorExitJoinpointLocation)) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
advice.lastReportedMonitorExitJoinpointLocation = null; return; } advice.lastReportedMonitorExitJoinpointLocation = shadow.getSourceLocation(); } } String description = advice.getKind().toString(); String advisedType = shadow.getEnclosingType().getName(); String advisingType = advice.getConcreteAspect().getName(); Message msg = null; if (advice.getKind().equals(AdviceKind.Softener)) { msg = WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_SOFTENS, new String[] { advisedType, beautifyLocation(shadow.getSourceLocation()), advisingType, beautifyLocation(munger.getSourceLocation()) }, advisedType, advisingType); } else { boolean runtimeTest = advice.hasDynamicTests(); String joinPointDescription = shadow.toString(); msg = WeaveMessage .constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_ADVISES, new String[] { joinPointDescription, advisedType, beautifyLocation(shadow.getSourceLocation()), description, advisingType, beautifyLocation(munger.getSourceLocation()), (runtimeTest ? " [with runtime test]" : "") }, advisedType, advisingType); } getMessageHandler().handleMessage(msg); } private boolean areTheSame(ISourceLocation locA, ISourceLocation locB) { if (locA == null) {
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
return locB == null; } if (locB == null) { return false; } if (locA.getLine() != locB.getLine()) { return false; } File fA = locA.getSourceFile(); File fB = locA.getSourceFile(); if (fA == null) { return fB == null; } if (fB == null) { return false; } return fA.getName().equals(fB.getName()); } /* * Ensure we report a nice source location - particular in the case where the source info is missing (binary weave). */ private String beautifyLocation(ISourceLocation isl) { StringBuffer nice = new StringBuffer(); if (isl == null || isl.getSourceFile() == null || isl.getSourceFile().getName().indexOf("no debug info available") != -1) { nice.append("no debug info available"); } else { int takeFrom = isl.getSourceFile().getPath().lastIndexOf('/'); if (takeFrom == -1) { takeFrom = isl.getSourceFile().getPath().lastIndexOf('\\');
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
} int binary = isl.getSourceFile().getPath().lastIndexOf('!'); if (binary != -1 && binary < takeFrom) { String pathToBinaryLoc = isl.getSourceFile().getPath().substring(0, binary + 1); if (pathToBinaryLoc.indexOf(".jar") != -1) { int lastSlash = pathToBinaryLoc.lastIndexOf('/'); if (lastSlash == -1) { lastSlash = pathToBinaryLoc.lastIndexOf('\\'); } nice.append(pathToBinaryLoc.substring(lastSlash + 1)); } } nice.append(isl.getSourceFile().getPath().substring(takeFrom + 1)); if (isl.getLine() != 0) { nice.append(":").append(isl.getLine()); } if (isl.getSourceFileName() != null) { nice.append("(from " + isl.getSourceFileName() + ")"); } } return nice.toString(); } private static List<String> makeDefaultClasspath(String cp) { List<String> classPath = new ArrayList<String>(); classPath.addAll(getPathEntries(cp)); classPath.addAll(getPathEntries(ClassPath.getClassPath())); return classPath;
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
} private static List<String> getPathEntries(String s) { List<String> ret = new ArrayList<String>(); StringTokenizer tok = new StringTokenizer(s, File.pathSeparator); while (tok.hasMoreTokens()) { ret.add(tok.nextToken()); } return ret; } public BcelWorld(List classPath, IMessageHandler handler, ICrossReferenceHandler xrefHandler) { this.classPath = new ClassPathManager(classPath, handler); setMessageHandler(handler); setCrossReferenceHandler(xrefHandler); delegate = this; } public BcelWorld(ClassPathManager cpm, IMessageHandler handler, ICrossReferenceHandler xrefHandler) { classPath = cpm; setMessageHandler(handler); setCrossReferenceHandler(xrefHandler); delegate = this; } /** * Build a World from a ClassLoader, for LTW support * * @param loader * @param handler * @param xrefHandler
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
*/ public BcelWorld(ClassLoader loader, IMessageHandler handler, ICrossReferenceHandler xrefHandler) { classPath = null; loaderRef = new BcelWeakClassLoaderReference(loader); setMessageHandler(handler); setCrossReferenceHandler(xrefHandler); } public void ensureRepositorySetup() { if (delegate == null) { delegate = getClassLoaderRepositoryFor(loaderRef); } } public Repository getClassLoaderRepositoryFor(ClassLoaderReference loader) { if (bcelRepositoryCaching) { return new ClassLoaderRepository(loader); } else { return new NonCachingClassLoaderRepository(loader); } } public void addPath(String name) { classPath.addPath(name, this.getMessageHandler()); } public static Type makeBcelType(UnresolvedType type) { return Type.getType(type.getErasureSignature()); } static Type[] makeBcelTypes(UnresolvedType[] types) { Type[] ret = new Type[types.length];
418,129
Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect
null
resolved fixed
2393bef
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
"2013-10-01T17:00:14Z"
"2013-09-26T18:26:40Z"
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
for (int i = 0, len = types.length; i < len; i++) { ret[i] = makeBcelType(types[i]); } return ret; } static String[] makeBcelTypesAsClassNames(UnresolvedType[] types) { String[] ret = new String[types.length]; for (int i = 0, len = types.length; i < len; i++) { ret[i] = types[i].getName(); } return ret; } public static UnresolvedType fromBcel(Type t) { return UnresolvedType.forSignature(t.getSignature()); } static UnresolvedType[] fromBcel(Type[] ts) { UnresolvedType[] ret = new UnresolvedType[ts.length]; for (int i = 0, len = ts.length; i < len; i++) { ret[i] = fromBcel(ts[i]); } return ret; } public ResolvedType resolve(Type t) { return resolve(fromBcel(t)); } @Override protected ReferenceTypeDelegate resolveDelegate(ReferenceType ty) { String name = ty.getName(); ensureAdvancedConfigurationProcessed(); JavaClass jc = lookupJavaClass(classPath, name);