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/BcelWorld.java | if (jc == null) {
if (typeDelegateResolvers != null) {
for (TypeDelegateResolver tdr : typeDelegateResolvers) {
ReferenceTypeDelegate delegate = tdr.getDelegate(ty);
if (delegate != null) {
return delegate;
}
}
}
return null;
} else {
return buildBcelDelegate(ty, jc, false, false);
}
}
public BcelObjectType buildBcelDelegate(ReferenceType type, JavaClass jc, boolean artificial, boolean exposedToWeaver) {
BcelObjectType ret = new BcelObjectType(type, jc, artificial, exposedToWeaver);
return ret;
}
private JavaClass lookupJavaClass(ClassPathManager classPath, String name) {
if (classPath == null) {
try {
ensureRepositorySetup();
JavaClass jc = delegate.loadClass(name);
if (trace.isTraceEnabled()) {
trace.event("lookupJavaClass", this, new Object[] { name, jc });
}
return jc;
} catch (ClassNotFoundException e) {
if (trace.isTraceEnabled()) { |
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 | trace.error("Unable to find class '" + name + "' in repository", e);
}
return null;
}
}
ClassPathManager.ClassFile file = null;
try {
file = classPath.find(UnresolvedType.forName(name));
if (file == null) {
return null;
}
ClassParser parser = new ClassParser(file.getInputStream(), file.getPath());
JavaClass jc = parser.parse();
return jc;
} catch (IOException ioe) {
return null;
} finally {
if (file != null) {
file.close();
}
}
}
public BcelObjectType addSourceObjectType(JavaClass jc, boolean artificial) {
return addSourceObjectType(jc.getClassName(), jc, artificial);
}
public BcelObjectType addSourceObjectType(String classname, JavaClass jc, boolean artificial) {
BcelObjectType ret = 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 | if (!jc.getClassName().equals(classname)) {
throw new RuntimeException(jc.getClassName() + "!=" + classname);
}
String signature = UnresolvedType.forName(jc.getClassName()).getSignature();
ResolvedType fromTheMap = typeMap.get(signature);
if (fromTheMap != null && !(fromTheMap instanceof ReferenceType)) {
StringBuffer exceptionText = new StringBuffer();
exceptionText.append("Found invalid (not a ReferenceType) entry in the type map. ");
exceptionText.append("Signature=[" + signature + "] Found=[" + fromTheMap + "] Class=[" + fromTheMap.getClass() + "]");
throw new BCException(exceptionText.toString());
}
ReferenceType nameTypeX = (ReferenceType) fromTheMap;
if (nameTypeX == null) {
if (jc.isGeneric() && isInJava5Mode()) {
ReferenceType rawType = ReferenceType.fromTypeX(UnresolvedType.forRawTypeName(jc.getClassName()), this);
ret = buildBcelDelegate(rawType, jc, artificial, true);
ReferenceType genericRefType = new ReferenceType(UnresolvedType.forGenericTypeSignature(signature,
ret.getDeclaredGenericSignature()), this);
rawType.setDelegate(ret);
genericRefType.setDelegate(ret);
rawType.setGenericType(genericRefType);
typeMap.put(signature, rawType);
} else {
nameTypeX = new ReferenceType(signature, this);
ret = buildBcelDelegate(nameTypeX, jc, artificial, true);
typeMap.put(signature, nameTypeX);
}
} else {
ret = buildBcelDelegate(nameTypeX, jc, artificial, 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/BcelWorld.java | }
return ret;
}
public BcelObjectType addSourceObjectType(String classname, byte[] bytes, boolean artificial) {
BcelObjectType ret = null;
String signature = UnresolvedType.forName(classname).getSignature();
ResolvedType fromTheMap = typeMap.get(signature);
if (fromTheMap != null && !(fromTheMap instanceof ReferenceType)) {
StringBuffer exceptionText = new StringBuffer();
exceptionText.append("Found invalid (not a ReferenceType) entry in the type map. ");
exceptionText.append("Signature=[" + signature + "] Found=[" + fromTheMap + "] Class=[" + fromTheMap.getClass() + "]");
throw new BCException(exceptionText.toString());
}
ReferenceType nameTypeX = (ReferenceType) fromTheMap;
if (nameTypeX == null) {
JavaClass jc = Utility.makeJavaClass(classname, bytes);
if (jc.isGeneric() && isInJava5Mode()) {
nameTypeX = ReferenceType.fromTypeX(UnresolvedType.forRawTypeName(jc.getClassName()), this);
ret = buildBcelDelegate(nameTypeX, jc, artificial, true);
ReferenceType genericRefType = new ReferenceType(UnresolvedType.forGenericTypeSignature(signature,
ret.getDeclaredGenericSignature()), this);
nameTypeX.setDelegate(ret);
genericRefType.setDelegate(ret);
nameTypeX.setGenericType(genericRefType);
typeMap.put(signature, nameTypeX);
} else {
nameTypeX = new ReferenceType(signature, this);
ret = buildBcelDelegate(nameTypeX, jc, artificial, true);
typeMap.put(signature, nameTypeX); |
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 | }
} else {
Object o = nameTypeX.getDelegate();
if (!(o instanceof BcelObjectType)) {
throw new IllegalStateException("For " + classname + " should be BcelObjectType, but is " + o.getClass());
}
ret = (BcelObjectType) o;
if (ret.isArtificial() || ret.isExposedToWeaver()) {
ret = buildBcelDelegate(nameTypeX, Utility.makeJavaClass(classname, bytes), artificial, true);
} else {
ret.setExposedToWeaver(true);
}
}
return ret;
}
void deleteSourceObjectType(UnresolvedType ty) {
typeMap.remove(ty.getSignature());
}
public static Member makeFieldJoinPointSignature(LazyClassGen cg, FieldInstruction fi) {
ConstantPool cpg = cg.getConstantPool();
return MemberImpl.field(fi.getClassName(cpg),
(fi.opcode == Constants.GETSTATIC || fi.opcode == Constants.PUTSTATIC) ? Modifier.STATIC : 0, fi.getName(cpg),
fi.getSignature(cpg)); |
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 Member makeJoinPointSignatureFromMethod(LazyMethodGen mg, MemberKind kind) {
Member ret = mg.getMemberView();
if (ret == null) {
int mods = mg.getAccessFlags();
if (mg.getEnclosingClass().isInterface()) {
mods |= Modifier.INTERFACE;
}
return new ResolvedMemberImpl(kind, UnresolvedType.forName(mg.getClassName()), mods, fromBcel(mg.getReturnType()),
mg.getName(), fromBcel(mg.getArgumentTypes()));
} else {
return ret;
}
}
public Member makeJoinPointSignatureForMonitorEnter(LazyClassGen cg, InstructionHandle h) {
return MemberImpl.monitorEnter();
}
public Member makeJoinPointSignatureForMonitorExit(LazyClassGen cg, InstructionHandle h) {
return MemberImpl.monitorExit();
}
public Member makeJoinPointSignatureForArrayConstruction(LazyClassGen cg, InstructionHandle handle) {
Instruction i = handle.getInstruction();
ConstantPool cpg = cg.getConstantPool();
Member retval = null;
if (i.opcode == Constants.ANEWARRAY) {
Type ot = i.getType(cpg);
UnresolvedType ut = fromBcel(ot);
ut = UnresolvedType.makeArray(ut, 1);
retval = MemberImpl.method(ut, Modifier.PUBLIC, UnresolvedType.VOID, "<init>", new ResolvedType[] { INT }); |
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 | } else if (i instanceof MULTIANEWARRAY) {
MULTIANEWARRAY arrayInstruction = (MULTIANEWARRAY) i;
UnresolvedType ut = null;
short dimensions = arrayInstruction.getDimensions();
ObjectType ot = arrayInstruction.getLoadClassType(cpg);
if (ot != null) {
ut = fromBcel(ot);
ut = UnresolvedType.makeArray(ut, dimensions);
} else {
Type t = arrayInstruction.getType(cpg);
ut = fromBcel(t);
}
ResolvedType[] parms = new ResolvedType[dimensions];
for (int ii = 0; ii < dimensions; ii++) {
parms[ii] = INT;
}
retval = MemberImpl.method(ut, Modifier.PUBLIC, UnresolvedType.VOID, "<init>", parms);
} else if (i.opcode == Constants.NEWARRAY) {
Type ot = i.getType();
UnresolvedType ut = fromBcel(ot);
retval = MemberImpl.method(ut, Modifier.PUBLIC, UnresolvedType.VOID, "<init>", new ResolvedType[] { INT });
} else {
throw new BCException("Cannot create array construction signature for this non-array instruction:" + i);
}
return retval;
}
public Member makeJoinPointSignatureForMethodInvocation(LazyClassGen cg, InvokeInstruction ii) {
ConstantPool cpg = cg.getConstantPool();
String name = ii.getName(cpg); |
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 | String declaring = ii.getClassName(cpg);
UnresolvedType declaringType = null;
String signature = ii.getSignature(cpg);
int modifier = (ii instanceof INVOKEINTERFACE) ? Modifier.INTERFACE
: (ii.opcode == Constants.INVOKESTATIC) ? Modifier.STATIC : (ii.opcode == Constants.INVOKESPECIAL && !name
.equals("<init>")) ? Modifier.PRIVATE : 0;
if (ii.opcode == Constants.INVOKESTATIC) {
ResolvedType appearsDeclaredBy = resolve(declaring);
for (Iterator<ResolvedMember> iterator = appearsDeclaredBy.getMethods(true, true); iterator.hasNext();) {
ResolvedMember method = iterator.next();
if (Modifier.isStatic(method.getModifiers())) {
if (name.equals(method.getName()) && signature.equals(method.getSignature())) {
declaringType = method.getDeclaringType();
break;
}
}
}
}
if (declaringType == null) {
if (declaring.charAt(0) == '[') {
declaringType = UnresolvedType.forSignature(declaring);
} else {
declaringType = UnresolvedType.forName(declaring);
} |
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 MemberImpl.method(declaringType, modifier, name, signature);
}
@Override
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("BcelWorld(");
buf.append(")");
return buf.toString();
}
/**
* Retrieve a bcel delegate for an aspect - this will return NULL if the delegate is an EclipseSourceType and not a
* BcelObjectType - this happens quite often when incrementally compiling.
*/
public static BcelObjectType getBcelObjectType(ResolvedType concreteAspect) {
if (concreteAspect == null) {
return null;
}
if (!(concreteAspect instanceof ReferenceType)) {
return null;
}
ReferenceTypeDelegate rtDelegate = ((ReferenceType) concreteAspect).getDelegate();
if (rtDelegate instanceof BcelObjectType) {
return (BcelObjectType) rtDelegate;
} else {
return null;
}
}
public void tidyUp() { |
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 | classPath.closeArchives();
typeMap.report();
typeMap.demote(true);
}
public JavaClass findClass(String className) {
return lookupJavaClass(classPath, className);
}
public JavaClass loadClass(String className) throws ClassNotFoundException {
return lookupJavaClass(classPath, className);
}
public void storeClass(JavaClass clazz) {
}
public void removeClass(JavaClass clazz) {
throw new RuntimeException("Not implemented");
}
public JavaClass loadClass(Class clazz) throws ClassNotFoundException {
throw new RuntimeException("Not implemented");
}
public void clear() {
delegate.clear();
}
/**
* The aim of this method is to make sure a particular type is 'ok'. Some operations on the delegate for a type modify it and
* this method is intended to undo that... see pr85132 |
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 | */
@Override
public void validateType(UnresolvedType type) {
ResolvedType result = typeMap.get(type.getSignature());
if (result == null) {
return;
}
if (!result.isExposedToWeaver()) {
return;
}
result.ensureConsistent();
}
/**
* Apply a single declare parents - return true if we change the type
*/
private boolean applyDeclareParents(DeclareParents p, ResolvedType onType) {
boolean didSomething = false;
List<ResolvedType> newParents = p.findMatchingNewParents(onType, true);
if (!newParents.isEmpty()) {
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/BcelWorld.java | BcelObjectType classType = BcelWorld.getBcelObjectType(onType);
for (ResolvedType newParent : newParents) {
onType.addParent(newParent);
ResolvedTypeMunger newParentMunger = new NewParentTypeMunger(newParent, p.getDeclaringType());
newParentMunger.setSourceLocation(p.getSourceLocation());
onType.addInterTypeMunger(new BcelTypeMunger(newParentMunger, getCrosscuttingMembersSet()
.findAspectDeclaringParents(p)), false);
}
}
return didSomething;
}
/**
* Apply a declare @type - return true if we change the type
*/
private boolean applyDeclareAtType(DeclareAnnotation decA, ResolvedType onType, boolean reportProblems) {
boolean didSomething = false;
if (decA.matches(onType)) {
if (onType.hasAnnotation(decA.getAnnotation().getType())) {
return false;
}
AnnotationAJ annoX = decA.getAnnotation();
boolean isOK = checkTargetOK(decA, onType, annoX); |
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 | if (isOK) {
didSomething = true;
ResolvedTypeMunger newAnnotationTM = new AnnotationOnTypeMunger(annoX);
newAnnotationTM.setSourceLocation(decA.getSourceLocation());
onType.addInterTypeMunger(new BcelTypeMunger(newAnnotationTM, decA.getAspect().resolve(this)), false);
decA.copyAnnotationTo(onType);
}
}
return didSomething;
}
/**
* Apply the specified declare @field construct to any matching fields in the specified type.
* @param deca the declare annotation targeting fields
* @param type the type to check for members matching the declare annotation
* @return true if something matched and the type was modified
*/
private boolean applyDeclareAtField(DeclareAnnotation deca, ResolvedType type) {
boolean changedType = false;
ResolvedMember[] fields = type.getDeclaredFields();
for (ResolvedMember field: fields) {
if (deca.matches(field, this)) {
AnnotationAJ anno = deca.getAnnotation();
if (!field.hasAnnotation(anno.getType())) {
field.addAnnotation(anno);
changedType=true;
}
}
}
return changedType; |
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 | }
/**
* Checks for an @target() on the annotation and if found ensures it allows the annotation to be attached to the target type
* that matched.
*/
private boolean checkTargetOK(DeclareAnnotation decA, ResolvedType onType, AnnotationAJ annoX) {
if (annoX.specifiesTarget()) {
if ((onType.isAnnotation() && !annoX.allowedOnAnnotationType()) || (!annoX.allowedOnRegularType())) {
return false;
}
}
return true;
}
protected void weaveInterTypeDeclarations(ResolvedType onType) {
List<DeclareParents> declareParentsList = getCrosscuttingMembersSet().getDeclareParents();
if (onType.isRawType()) {
onType = onType.getGenericType();
}
onType.clearInterTypeMungers();
List<DeclareParents> decpToRepeat = new ArrayList<DeclareParents>();
boolean aParentChangeOccurred = false;
boolean anAnnotationChangeOccurred = false;
for (Iterator<DeclareParents> i = declareParentsList.iterator(); i.hasNext();) {
DeclareParents decp = i.next(); |
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 | boolean typeChanged = applyDeclareParents(decp, onType);
if (typeChanged) {
aParentChangeOccurred = true;
} else {
if (!decp.getChild().isStarAnnotation()) {
decpToRepeat.add(decp);
}
}
}
for (DeclareAnnotation decA : getCrosscuttingMembersSet().getDeclareAnnotationOnTypes()) {
boolean typeChanged = applyDeclareAtType(decA, onType, true);
if (typeChanged) {
anAnnotationChangeOccurred = true;
}
}
for (DeclareAnnotation deca: getCrosscuttingMembersSet().getDeclareAnnotationOnFields()) {
if (applyDeclareAtField(deca,onType)) {
anAnnotationChangeOccurred = true;
}
}
while ((aParentChangeOccurred || anAnnotationChangeOccurred) && !decpToRepeat.isEmpty()) {
anAnnotationChangeOccurred = aParentChangeOccurred = false;
List<DeclareParents> decpToRepeatNextTime = new ArrayList<DeclareParents>();
for (DeclareParents decp: decpToRepeat) {
if (applyDeclareParents(decp, onType)) {
aParentChangeOccurred = 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/BcelWorld.java | } else {
decpToRepeatNextTime.add(decp);
}
}
for (DeclareAnnotation deca: getCrosscuttingMembersSet().getDeclareAnnotationOnTypes()) {
if (applyDeclareAtType(deca, onType, false)) {
anAnnotationChangeOccurred = true;
}
}
for (DeclareAnnotation deca: getCrosscuttingMembersSet().getDeclareAnnotationOnFields()) {
if (applyDeclareAtField(deca, onType)) {
anAnnotationChangeOccurred = true;
}
}
decpToRepeat = decpToRepeatNextTime;
}
}
@Override
public IWeavingSupport getWeavingSupport() {
return bcelWeavingSupport;
}
@Override
public void reportCheckerMatch(Checker checker, Shadow shadow) {
IMessage iMessage = new Message(checker.getMessage(shadow), shadow.toString(), checker.isError() ? IMessage.ERROR
: IMessage.WARNING, shadow.getSourceLocation(), null, new ISourceLocation[] { checker.getSourceLocation() }, true,
0, -1, -1);
getMessageHandler().handleMessage(iMessage);
if (getCrossReferenceHandler() != 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 | getCrossReferenceHandler()
.addCrossReference(
checker.getSourceLocation(),
shadow.getSourceLocation(),
(checker.isError() ? IRelationship.Kind.DECLARE_ERROR.getName() : IRelationship.Kind.DECLARE_WARNING
.getName()), false);
}
if (getModel() != null) {
AsmRelationshipProvider.addDeclareErrorOrWarningRelationship(getModelAsAsmManager(), shadow, checker);
}
}
public AsmManager getModelAsAsmManager() {
return (AsmManager) getModel();
}
void raiseError(String message) {
getMessageHandler().handleMessage(MessageUtil.error(message));
}
/**
* These are aop.xml files that can be used to alter the aspects that actually apply from those passed in - and also their scope
* of application to other files in the system.
*
* @param xmlFiles list of File objects representing any aop.xml files passed in to configure the build process
*/
public void setXmlFiles(List<File> xmlFiles) {
if (!isXmlConfiguredWorld && !xmlFiles.isEmpty()) {
raiseError("xml configuration files only supported by the compiler when -xmlConfigured option specified");
return;
}
if (!xmlFiles.isEmpty()) {
xmlConfiguration = new WeavingXmlConfig(this, WeavingXmlConfig.MODE_COMPILE); |
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 (File xmlfile : xmlFiles) {
try {
Definition d = DocumentParser.parse(xmlfile.toURI().toURL());
xmlConfiguration.add(d);
} catch (MalformedURLException e) {
raiseError("Unexpected problem processing XML config file '" + xmlfile.getName() + "' :" + e.getMessage());
} catch (Exception e) {
raiseError("Unexpected problem processing XML config file '" + xmlfile.getName() + "' :" + e.getMessage());
}
}
}
/**
* Add a scoped aspects where the scoping was defined in an aop.xml file and this world is being used in a LTW configuration
*/
public void addScopedAspect(String name, String scope) {
this.isXmlConfiguredWorld = true;
if (xmlConfiguration == null) {
xmlConfiguration = new WeavingXmlConfig(this, WeavingXmlConfig.MODE_LTW);
}
xmlConfiguration.addScopedAspect(name, scope);
}
public void setXmlConfigured(boolean b) {
this.isXmlConfiguredWorld = b;
}
@Override
public boolean isXmlConfigured() {
return isXmlConfiguredWorld && xmlConfiguration != null;
}
public WeavingXmlConfig getXmlConfiguration() { |
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 xmlConfiguration;
}
@Override
public boolean isAspectIncluded(ResolvedType aspectType) {
if (!isXmlConfigured()) {
return true;
}
return xmlConfiguration.specifiesInclusionOfAspect(aspectType.getName());
}
@Override
public TypePattern getAspectScope(ResolvedType declaringType) {
return xmlConfiguration.getScopeFor(declaringType.getName());
}
@Override
public boolean hasUnsatisfiedDependency(ResolvedType aspectType) {
if (aspectRequiredTypes == null) {
return false;
}
String aspectName = aspectType.getName();
if (!aspectRequiredTypesProcessed.contains(aspectName)) {
String requiredTypeName = aspectRequiredTypes.get(aspectName);
if (requiredTypeName==null) {
aspectRequiredTypesProcessed.add(aspectName);
return false;
} else {
ResolvedType rt = resolve(UnresolvedType.forName(requiredTypeName));
if (!rt.isMissing()) {
aspectRequiredTypesProcessed.add(aspectName);
aspectRequiredTypes.remove(aspectName); |
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 false;
} else {
if (!getMessageHandler().isIgnoring(IMessage.INFO)) {
getMessageHandler().handleMessage(
MessageUtil.info("deactivating aspect '" + aspectName + "' as it requires type '"
+ requiredTypeName + "' which cannot be found on the classpath"));
}
aspectRequiredTypesProcessed.add(aspectName);
return true;
}
}
}
return aspectRequiredTypes.containsKey(aspectName);
}
private List<String> aspectRequiredTypesProcessed = new ArrayList<String>();
private Map<String, String> aspectRequiredTypes = null;
public void addAspectRequires(String aspectClassName, String requiredType) {
if (aspectRequiredTypes == null) {
aspectRequiredTypes = new HashMap<String, String>();
}
aspectRequiredTypes.put(aspectClassName, requiredType);
}
/**
* A WeavingXmlConfig is initially a collection of definitions from XML files - once the world is ready and weaving is running
* it will initialize and transform those definitions into an optimized set of values (eg. resolve type patterns and string
* names to real entities). It can then answer questions quickly: (1) is this aspect included in the weaving? (2) Is there a
* scope specified for this aspect and does it include type X?
*
*/
static class WeavingXmlConfig { |
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 | final static int MODE_COMPILE = 1;
final static int MODE_LTW = 2;
private int mode;
private boolean initialized = false;
private List<Definition> definitions = new ArrayList<Definition>();
private List<String> resolvedIncludedAspects = new ArrayList<String>();
private Map<String, TypePattern> scopes = new HashMap<String, TypePattern>();
private List<String> includedFastMatchPatterns = Collections.emptyList();
private List<TypePattern> includedPatterns = Collections.emptyList();
private List<String> excludedFastMatchPatterns = Collections.emptyList();
private List<TypePattern> excludedPatterns = Collections.emptyList();
private BcelWorld world;
public WeavingXmlConfig(BcelWorld bcelWorld, int mode) {
this.world = bcelWorld;
this.mode = mode;
}
public void add(Definition d) {
definitions.add(d);
}
public void addScopedAspect(String aspectName, String scope) {
ensureInitialized();
resolvedIncludedAspects.add(aspectName); |
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 | try {
TypePattern scopePattern = new PatternParser(scope).parseTypePattern();
scopePattern.resolve(world);
scopes.put(aspectName, scopePattern);
if (!world.getMessageHandler().isIgnoring(IMessage.INFO)) {
world.getMessageHandler().handleMessage(
MessageUtil.info("Aspect '" + aspectName + "' is scoped to apply against types matching pattern '"
+ scopePattern.toString() + "'"));
}
} catch (Exception e) {
world.getMessageHandler().handleMessage(
MessageUtil.error("Unable to parse scope as type pattern. Scope was '" + scope + "': " + e.getMessage()));
}
}
public void ensureInitialized() {
if (!initialized) {
try {
resolvedIncludedAspects = new ArrayList<String>();
for (Definition definition : definitions) {
List<String> aspectNames = definition.getAspectClassNames();
for (String name : aspectNames) {
resolvedIncludedAspects.add(name); |
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 | String scope = definition.getScopeForAspect(name);
if (scope != null) {
try {
TypePattern scopePattern = new PatternParser(scope).parseTypePattern();
scopePattern.resolve(world);
scopes.put(name, scopePattern);
if (!world.getMessageHandler().isIgnoring(IMessage.INFO)) {
world.getMessageHandler().handleMessage(
MessageUtil.info("Aspect '" + name
+ "' is scoped to apply against types matching pattern '"
+ scopePattern.toString() + "'"));
}
} catch (Exception e) {
world.getMessageHandler().handleMessage(
MessageUtil.error("Unable to parse scope as type pattern. Scope was '" + scope + "': "
+ e.getMessage()));
}
}
}
try {
List<String> includePatterns = definition.getIncludePatterns();
if (includePatterns.size() > 0) {
includedPatterns = new ArrayList<TypePattern>();
includedFastMatchPatterns = new ArrayList<String>();
}
for (String includePattern : includePatterns) {
if (includePattern.endsWith("..*")) { |
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 | includedFastMatchPatterns.add(includePattern.substring(0, includePattern.length() - 2));
} else {
TypePattern includedPattern = new PatternParser(includePattern).parseTypePattern();
includedPatterns.add(includedPattern);
}
}
List<String> excludePatterns = definition.getExcludePatterns();
if (excludePatterns.size() > 0) {
excludedPatterns = new ArrayList<TypePattern>();
excludedFastMatchPatterns = new ArrayList<String>();
}
for (String excludePattern : excludePatterns) {
if (excludePattern.endsWith("..*")) {
excludedFastMatchPatterns.add(excludePattern.substring(0, excludePattern.length() - 2));
} else {
TypePattern excludedPattern = new PatternParser(excludePattern).parseTypePattern();
excludedPatterns.add(excludedPattern);
}
}
} catch (ParserException pe) {
world.getMessageHandler().handleMessage(
MessageUtil.error("Unable to parse type pattern: " + pe.getMessage()));
}
}
} finally {
initialized = 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/BcelWorld.java | }
public boolean specifiesInclusionOfAspect(String name) {
ensureInitialized();
return resolvedIncludedAspects.contains(name);
}
public TypePattern getScopeFor(String name) {
return scopes.get(name);
}
public boolean excludesType(ResolvedType type) {
if (mode == MODE_LTW) {
return false;
}
String typename = type.getName();
boolean excluded = false;
for (String excludedPattern : excludedFastMatchPatterns) {
if (typename.startsWith(excludedPattern)) {
excluded = true;
break;
}
}
if (!excluded) {
for (TypePattern excludedPattern : excludedPatterns) {
if (excludedPattern.matchesStatically(type)) {
excluded = 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/BcelWorld.java | break;
}
}
}
return excluded;
}
}
public TypeMap getTypeMap() {
return typeMap;
}
public boolean isLoadtimeWeaving() {
return false;
}
public void addTypeDelegateResolver(TypeDelegateResolver typeDelegateResolver) {
if (typeDelegateResolvers == null) {
typeDelegateResolvers = new ArrayList<TypeDelegateResolver>();
}
typeDelegateResolvers.add(typeDelegateResolver);
}
public void classWriteEvent(char[][] compoundName) {
typeMap.classWriteEvent(new String(CharOperation.concatWith(compoundName, '.')));
}
/**
* Force demote a type.
*/
public void demote(ResolvedType type) {
typeMap.demote(type);
}
} |
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/LazyMethodGen.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
* ******************************************************************/
package org.aspectj.weaver.bcel;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.reflect.Modifier; |
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/LazyMethodGen.java | import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
import org.aspectj.apache.bcel.Constants;
import org.aspectj.apache.bcel.classfile.Attribute;
import org.aspectj.apache.bcel.classfile.ConstantPool;
import org.aspectj.apache.bcel.classfile.Method;
import org.aspectj.apache.bcel.classfile.Synthetic;
import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen;
import org.aspectj.apache.bcel.generic.BranchHandle;
import org.aspectj.apache.bcel.generic.ClassGenException;
import org.aspectj.apache.bcel.generic.CodeExceptionGen;
import org.aspectj.apache.bcel.generic.Instruction;
import org.aspectj.apache.bcel.generic.InstructionBranch;
import org.aspectj.apache.bcel.generic.InstructionHandle;
import org.aspectj.apache.bcel.generic.InstructionList;
import org.aspectj.apache.bcel.generic.InstructionSelect;
import org.aspectj.apache.bcel.generic.InstructionTargeter;
import org.aspectj.apache.bcel.generic.LineNumberTag;
import org.aspectj.apache.bcel.generic.LocalVariableTag;
import org.aspectj.apache.bcel.generic.MethodGen;
import org.aspectj.apache.bcel.generic.ObjectType;
import org.aspectj.apache.bcel.generic.Tag; |
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/LazyMethodGen.java | import org.aspectj.apache.bcel.generic.TargetLostException;
import org.aspectj.apache.bcel.generic.Type;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.weaver.AjAttribute;
import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
import org.aspectj.weaver.AnnotationAJ;
import org.aspectj.weaver.BCException;
import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.MemberImpl;
import org.aspectj.weaver.NameMangler;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.tools.Traceable;
/**
* A LazyMethodGen should be treated as a MethodGen. It's our way of abstracting over the low-level Method objects. It converts
* through {@link MethodGen} to create and to serialize, but that's it.
*
* <p>
* At any rate, there are two ways to create LazyMethodGens. One is from a method, which does work through MethodGen to do the
* correct thing. The other is the creation of a completely empty LazyMethodGen, and it is used when we're constructing code from
* scratch.
*
* <p>
* We stay away from targeters for rangey things like Shadows and Exceptions.
*/
public final class LazyMethodGen implements Traceable { |
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/LazyMethodGen.java | private static final int ACC_SYNTHETIC = 0x1000;
private int modifiers;
private Type returnType;
private final String name;
private Type[] argumentTypes;
private String[] declaredExceptions;
private InstructionList body;
private List<Attribute> attributes;
private List<AnnotationAJ> newAnnotations;
private List<ResolvedType> annotationsForRemoval;
private AnnotationAJ[][] newParameterAnnotations;
private final LazyClassGen enclosingClass;
private BcelMethod memberView;
private AjAttribute.EffectiveSignatureAttribute effectiveSignature;
int highestLineNumber = 0;
boolean wasPackedOptimally = false;
private Method savedMethod = null;
private static final AnnotationAJ[] NO_ANNOTATIONAJ = new AnnotationAJ[] {};
/*
* We use LineNumberTags and not Gens.
*
* This option specifies whether we let the BCEL classes create LineNumberGens and LocalVariableGens or if we make it create
* LineNumberTags and LocalVariableTags. Up until 1.5.1 we always created Gens - then on return from the MethodGen ctor we took
* them apart, reprocessed them all and created Tags. (see unpackLocals/unpackLineNumbers). As we have our own copy of Bcel, why
* not create the right thing straightaway? So setting this to true will call the MethodGen ctor() in such a way that it creates
* Tags - removing the need for unpackLocals/unpackLineNumbers - HOWEVER see the ensureAllLineNumberSetup() method for some |
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/LazyMethodGen.java | * other relevant info.
*
* Whats the difference between a Tag and a Gen? A Tag is more lightweight, it doesn't know which instructions it targets, it
* relies on the instructions targettingit - this reduces the amount of targeter manipulation we have to do.
*/
/**
* This is nonnull if this method is the result of an "inlining". We currently copy methods into other classes for around
* advice. We add this field so we can get JSR45 information correct. If/when we do _actual_ inlining, we'll need to subtype
* LineNumberTag to have external line numbers.
*/
String fromFilename = null;
private int maxLocals;
private boolean canInline = true;
private boolean isSynthetic = false;
List<BcelShadow> matchedShadows;
public ResolvedType definingType = null;
public LazyMethodGen(int modifiers, Type returnType, String name, Type[] paramTypes, String[] declaredExceptions,
LazyClassGen enclosingClass) {
this.memberView = null;
this.modifiers = modifiers;
this.returnType = returnType;
this.name = name;
this.argumentTypes = paramTypes;
this.declaredExceptions = declaredExceptions;
if (!Modifier.isAbstract(modifiers)) {
body = new InstructionList();
setMaxLocals(calculateMaxLocals()); |
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/LazyMethodGen.java | } else {
body = null;
}
this.attributes = new ArrayList<Attribute>();
this.enclosingClass = enclosingClass;
assertGoodBody();
if (memberView != null && isAdviceMethod()) {
if (enclosingClass.getType().isAnnotationStyleAspect()) {
this.canInline = false;
}
}
}
private int calculateMaxLocals() {
int ret = Modifier.isStatic(modifiers) ? 0 : 1;
for (Type type : argumentTypes) {
ret += type.getSize();
}
return ret;
}
public LazyMethodGen(Method m, LazyClassGen enclosingClass) {
savedMethod = m;
this.enclosingClass = enclosingClass;
if (!(m.isAbstract() || m.isNative()) && m.getCode() == 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/LazyMethodGen.java | throw new RuntimeException("bad non-abstract method with no code: " + m + " on " + enclosingClass);
}
if ((m.isAbstract() || m.isNative()) && m.getCode() != null) {
throw new RuntimeException("bad abstract method with code: " + m + " on " + enclosingClass);
}
this.memberView = new BcelMethod(enclosingClass.getBcelObjectType(), m);
this.modifiers = m.getModifiers();
this.name = m.getName();
if (memberView != null && isAdviceMethod()) {
if (enclosingClass.getType().isAnnotationStyleAspect()) {
this.canInline = false;
}
}
}
private boolean isAbstractOrNative(int modifiers) {
return Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers);
}
public LazyMethodGen(BcelMethod m, LazyClassGen enclosingClass) {
savedMethod = m.getMethod();
this.enclosingClass = enclosingClass;
if (!isAbstractOrNative(m.getModifiers()) && savedMethod.getCode() == null) {
throw new RuntimeException("bad non-abstract method with no code: " + m + " on " + enclosingClass); |
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/LazyMethodGen.java | }
if (isAbstractOrNative(m.getModifiers()) && savedMethod.getCode() != null) {
throw new RuntimeException("bad abstract method with code: " + m + " on " + enclosingClass);
}
this.memberView = m;
this.modifiers = savedMethod.getModifiers();
this.name = m.getName();
if (memberView != null && isAdviceMethod()) {
if (enclosingClass.getType().isAnnotationStyleAspect()) {
this.canInline = false;
}
}
}
public boolean hasDeclaredLineNumberInfo() {
return (memberView != null && memberView.hasDeclarationLineNumberInfo());
}
public int getDeclarationLineNumber() {
if (hasDeclaredLineNumberInfo()) {
return memberView.getDeclarationLineNumber();
} 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/LazyMethodGen.java | return -1;
}
}
public int getDeclarationOffset() {
if (hasDeclaredLineNumberInfo()) {
return memberView.getDeclarationOffset();
} else {
return 0;
}
}
public void addAnnotation(AnnotationAJ ax) {
initialize();
if (memberView == null) {
if (newAnnotations == null) {
newAnnotations = new ArrayList<AnnotationAJ>();
}
newAnnotations.add(ax);
} else {
memberView.addAnnotation(ax);
}
}
public void removeAnnotation(ResolvedType annotationType) {
initialize();
if (memberView == null) {
if (annotationsForRemoval == null) {
annotationsForRemoval = new ArrayList<ResolvedType>();
}
annotationsForRemoval.add(annotationType); |
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/LazyMethodGen.java | } else {
memberView.removeAnnotation(annotationType);
}
}
public void addParameterAnnotation(int parameterNumber, AnnotationAJ anno) {
initialize();
if (memberView == null) {
if (newParameterAnnotations == null) {
int pcount = getArgumentTypes().length;
newParameterAnnotations = new AnnotationAJ[pcount][];
for (int i = 0; i < pcount; i++) {
if (i == parameterNumber) {
newParameterAnnotations[i] = new AnnotationAJ[1];
newParameterAnnotations[i][0] = anno;
} else {
newParameterAnnotations[i] = NO_ANNOTATIONAJ;
}
}
} else {
AnnotationAJ[] currentAnnoArray = newParameterAnnotations[parameterNumber];
AnnotationAJ[] newAnnoArray = new AnnotationAJ[currentAnnoArray.length + 1];
System.arraycopy(currentAnnoArray, 0, newAnnoArray, 0, currentAnnoArray.length);
newAnnoArray[currentAnnoArray.length] = anno;
newParameterAnnotations[parameterNumber] = newAnnoArray;
}
} else {
memberView.addParameterAnnotation(parameterNumber, anno);
}
} |
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/LazyMethodGen.java | public boolean hasAnnotation(UnresolvedType annotationType) {
initialize();
if (memberView == null) {
if (annotationsForRemoval != null) {
for (ResolvedType at : annotationsForRemoval) {
if (at.equals(annotationType)) {
return false;
}
}
}
if (newAnnotations != null) {
for (AnnotationAJ annotation : newAnnotations) {
if (annotation.getTypeSignature().equals(annotationType.getSignature())) {
return true;
}
}
}
memberView = new BcelMethod(getEnclosingClass().getBcelObjectType(), getMethod());
return memberView.hasAnnotation(annotationType);
}
return memberView.hasAnnotation(annotationType);
}
private void initialize() {
if (returnType != null) {
return;
}
MethodGen gen = new MethodGen(savedMethod, enclosingClass.getName(), enclosingClass.getConstantPool(), true);
this.returnType = gen.getReturnType();
this.argumentTypes = gen.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/LazyMethodGen.java | this.declaredExceptions = gen.getExceptions();
this.attributes = gen.getAttributes();
this.maxLocals = gen.getMaxLocals();
if (gen.isAbstract() || gen.isNative()) {
body = null;
} else {
body = gen.getInstructionList();
unpackHandlers(gen);
ensureAllLineNumberSetup();
highestLineNumber = gen.getHighestlinenumber();
}
assertGoodBody();
} |
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/LazyMethodGen.java | private void unpackHandlers(MethodGen gen) {
CodeExceptionGen[] exns = gen.getExceptionHandlers();
if (exns != null) {
int len = exns.length;
int priority = len - 1;
for (int i = 0; i < len; i++, priority--) {
CodeExceptionGen exn = exns[i];
InstructionHandle start = Range.genStart(body, getOutermostExceptionStart(exn.getStartPC()));
InstructionHandle end = Range.genEnd(body, getOutermostExceptionEnd(exn.getEndPC()));
ExceptionRange er = new ExceptionRange(body, exn.getCatchType() == null ? null : BcelWorld.fromBcel(exn
.getCatchType()), priority);
er.associateWithTargets(start, end, exn.getHandlerPC());
exn.setStartPC(null);
exn.setEndPC(null);
exn.setHandlerPC(null);
}
gen.removeExceptionHandlers();
}
}
private InstructionHandle getOutermostExceptionStart(InstructionHandle ih) {
while (true) {
if (ExceptionRange.isExceptionStart(ih.getPrev())) {
ih = ih.getPrev();
} else {
return ih;
} |
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/LazyMethodGen.java | }
}
private InstructionHandle getOutermostExceptionEnd(InstructionHandle ih) {
while (true) {
if (ExceptionRange.isExceptionEnd(ih.getNext())) {
ih = ih.getNext();
} else {
return ih;
}
}
}
/**
* On entry to this method we have a method whose instruction stream contains a few instructions that have line numbers assigned
* to them (LineNumberTags). The aim is to ensure every instruction has the right line number. This is necessary because some of
* them may be extracted out into other methods - and it'd be useful for them to maintain the source line number for debugging.
*/
public void ensureAllLineNumberSetup() {
LineNumberTag lastKnownLineNumberTag = null;
boolean skip = false;
for (InstructionHandle ih = body.getStart(); ih != null; ih = ih.getNext()) {
skip = false;
for (InstructionTargeter targeter : ih.getTargeters()) {
if (targeter instanceof LineNumberTag) {
lastKnownLineNumberTag = (LineNumberTag) targeter;
skip = true;
}
}
if (lastKnownLineNumberTag != null && !skip) {
ih.addTargeter(lastKnownLineNumberTag);
} |
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/LazyMethodGen.java | }
}
public int allocateLocal(Type type) {
return allocateLocal(type.getSize());
}
public int allocateLocal(int slots) {
int max = getMaxLocals();
setMaxLocals(max + slots);
return max;
}
public Method getMethod() {
if (savedMethod != null) {
return savedMethod;
}
try {
MethodGen gen = pack();
savedMethod = gen.getMethod();
return savedMethod;
} catch (ClassGenException e) {
enclosingClass
.getBcelObjectType()
.getResolvedTypeX()
.getWorld()
.showMessage(
IMessage.ERROR,
WeaverMessages.format(WeaverMessages.PROBLEM_GENERATING_METHOD, this.getClassName(), this.getName(),
e.getMessage()),
this.getMemberView() == null ? null : this.getMemberView().getSourceLocation(), 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/LazyMethodGen.java | body = null;
MethodGen gen = pack();
return gen.getMethod();
} catch (RuntimeException re) {
if (re.getCause() instanceof ClassGenException) {
enclosingClass
.getBcelObjectType()
.getResolvedTypeX()
.getWorld()
.showMessage(
IMessage.ERROR,
WeaverMessages.format(WeaverMessages.PROBLEM_GENERATING_METHOD, this.getClassName(),
this.getName(), re.getCause().getMessage()),
this.getMemberView() == null ? null : this.getMemberView().getSourceLocation(), null);
body = null;
MethodGen gen = pack();
return gen.getMethod();
}
throw re;
}
}
public void markAsChanged() {
if (wasPackedOptimally) {
throw new RuntimeException("Already packed method is being re-modified: " + getClassName() + " " + toShortString());
}
initialize(); |
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/LazyMethodGen.java | savedMethod = null;
}
@Override
public String toString() {
BcelObjectType bot = enclosingClass.getBcelObjectType();
WeaverVersionInfo weaverVersion = (bot == null ? WeaverVersionInfo.CURRENT : bot.getWeaverVersionAttribute());
return toLongString(weaverVersion);
}
public String toShortString() {
String access = org.aspectj.apache.bcel.classfile.Utility.accessToString(getAccessFlags());
StringBuffer buf = new StringBuffer();
if (!access.equals("")) {
buf.append(access);
buf.append(" ");
}
buf.append(org.aspectj.apache.bcel.classfile.Utility.signatureToString(getReturnType().getSignature(), true));
buf.append(" ");
buf.append(getName());
buf.append("(");
{
int len = argumentTypes.length;
if (len > 0) {
buf.append(org.aspectj.apache.bcel.classfile.Utility.signatureToString(argumentTypes[0].getSignature(), true));
for (int i = 1; i < argumentTypes.length; i++) {
buf.append(", ");
buf.append(org.aspectj.apache.bcel.classfile.Utility.signatureToString(argumentTypes[i].getSignature(), 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/LazyMethodGen.java | buf.append(")");
{
int len = declaredExceptions != null ? declaredExceptions.length : 0;
if (len > 0) {
buf.append(" throws ");
buf.append(declaredExceptions[0]);
for (int i = 1; i < declaredExceptions.length; i++) {
buf.append(", ");
buf.append(declaredExceptions[i]);
}
}
}
return buf.toString();
}
public String toLongString(WeaverVersionInfo weaverVersion) {
ByteArrayOutputStream s = new ByteArrayOutputStream();
print(new PrintStream(s), weaverVersion);
return new String(s.toByteArray());
}
public void print(WeaverVersionInfo weaverVersion) {
print(System.out, weaverVersion);
}
public void print(PrintStream out, WeaverVersionInfo weaverVersion) {
out.print(" " + toShortString());
printAspectAttributes(out, weaverVersion);
InstructionList body = getBody();
if (body == null) {
out.println(";");
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/LazyMethodGen.java | out.println(":");
new BodyPrinter(out).run();
out.println(" end " + toShortString());
}
private void printAspectAttributes(PrintStream out, WeaverVersionInfo weaverVersion) {
ISourceContext context = null;
if (enclosingClass != null && enclosingClass.getType() != null) {
context = enclosingClass.getType().getSourceContext();
}
List<AjAttribute> as = Utility.readAjAttributes(getClassName(), attributes.toArray(new Attribute[] {}), context, null, weaverVersion,
new BcelConstantPoolReader(this.enclosingClass.getConstantPool()));
if (!as.isEmpty()) {
out.println(" " + as.get(0));
}
}
private class BodyPrinter {
Map<InstructionHandle, String> labelMap = new HashMap<InstructionHandle, String>();
InstructionList body;
PrintStream out;
ConstantPool pool;
BodyPrinter(PrintStream out) {
this.pool = enclosingClass.getConstantPool();
this.body = getBodyForPrint();
this.out = out;
}
BodyPrinter(PrintStream out, InstructionList il) {
this.pool = enclosingClass.getConstantPool();
this.body = il;
this.out = out; |
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/LazyMethodGen.java | }
void run() {
assignLabels();
print();
}
void assignLabels() {
LinkedList<ExceptionRange> exnTable = new LinkedList<ExceptionRange>();
String pendingLabel = null;
int lcounter = 0;
for (InstructionHandle ih = body.getStart(); ih != null; ih = ih.getNext()) {
Iterator<InstructionTargeter> tIter = ih.getTargeters().iterator();
while (tIter.hasNext()) {
InstructionTargeter t = tIter.next();
if (t instanceof ExceptionRange) {
ExceptionRange r = (ExceptionRange) t;
if (r.getStart() == ih) {
insertHandler(r, exnTable);
}
} else if (t instanceof InstructionBranch) {
if (pendingLabel == null) {
pendingLabel = "L" + lcounter++;
} |
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/LazyMethodGen.java | } else {
}
}
if (pendingLabel != null) {
labelMap.put(ih, pendingLabel);
if (!Range.isRangeHandle(ih)) {
pendingLabel = null;
}
}
}
int ecounter = 0;
for (Iterator i = exnTable.iterator(); i.hasNext();) {
ExceptionRange er = (ExceptionRange) i.next();
String exceptionLabel = "E" + ecounter++;
labelMap.put(Range.getRealStart(er.getHandler()), exceptionLabel);
labelMap.put(er.getHandler(), exceptionLabel);
}
}
void print() {
int depth = 0;
int currLine = -1;
bodyPrint: for (InstructionHandle ih = body.getStart(); ih != null; ih = ih.getNext()) {
if (Range.isRangeHandle(ih)) {
Range r = Range.getRange(ih);
for (InstructionHandle xx = r.getStart(); Range.isRangeHandle(xx); xx = xx.getNext()) {
if (xx == r.getEnd()) { |
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/LazyMethodGen.java | continue bodyPrint;
}
}
if (r.getStart() == ih) {
printRangeString(r, depth++);
} else {
if (r.getEnd() != ih) {
throw new RuntimeException("bad");
}
printRangeString(r, --depth);
}
} else {
printInstruction(ih, depth);
int line = getLineNumber(ih, currLine);
if (line != currLine) {
currLine = line;
out.println(" (line " + line + ")");
} else {
out.println();
}
}
}
}
void printRangeString(Range r, int depth) {
printDepth(depth);
out.println(getRangeString(r, labelMap));
}
String getRangeString(Range r, Map<InstructionHandle, String> labelMap) { |
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/LazyMethodGen.java | if (r instanceof ExceptionRange) {
ExceptionRange er = (ExceptionRange) r;
return er.toString() + " -> " + labelMap.get(er.getHandler());
} else {
return r.toString();
}
}
void printDepth(int depth) {
pad(BODY_INDENT);
while (depth > 0) {
out.print("| ");
depth--;
}
}
void printLabel(String s, int depth) {
int space = Math.max(CODE_INDENT - depth * 2, 0);
if (s == null) {
pad(space);
} else {
space = Math.max(space - (s.length() + 2), 0);
pad(space);
out.print(s);
out.print(": ");
}
}
void printInstruction(InstructionHandle h, int depth) {
printDepth(depth);
printLabel(labelMap.get(h), depth); |
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/LazyMethodGen.java | Instruction inst = h.getInstruction();
if (inst.isConstantPoolInstruction()) {
out.print(Constants.OPCODE_NAMES[inst.opcode].toUpperCase());
out.print(" ");
out.print(pool.constantToString(pool.getConstant(inst.getIndex())));
} else if (inst instanceof InstructionSelect) {
InstructionSelect sinst = (InstructionSelect) inst;
out.println(Constants.OPCODE_NAMES[sinst.opcode].toUpperCase());
int[] matches = sinst.getMatchs();
InstructionHandle[] targets = sinst.getTargets();
InstructionHandle defaultTarget = sinst.getTarget();
for (int i = 0, len = matches.length; i < len; i++) {
printDepth(depth);
printLabel(null, depth);
out.print(" ");
out.print(matches[i]);
out.print(": \t");
out.println(labelMap.get(targets[i]));
}
printDepth(depth);
printLabel(null, depth);
out.print(" ");
out.print("default: \t");
out.print(labelMap.get(defaultTarget));
} else if (inst instanceof InstructionBranch) {
InstructionBranch brinst = (InstructionBranch) inst;
out.print(Constants.OPCODE_NAMES[brinst.getOpcode()].toUpperCase());
out.print(" ");
out.print(labelMap.get(brinst.getTarget()));
} else if (inst.isLocalVariableInstruction()) { |
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/LazyMethodGen.java | out.print(inst.toString(false).toUpperCase());
int index = inst.getIndex();
LocalVariableTag tag = getLocalVariableTag(h, index);
if (tag != null) {
out.print(" ");
out.print(tag.getType());
out.print(" ");
out.print(tag.getName());
}
} else {
out.print(inst.toString(false).toUpperCase());
}
}
static final int BODY_INDENT = 4;
static final int CODE_INDENT = 16;
void pad(int size) {
for (int i = 0; i < size; i++) {
out.print(" ");
}
}
}
static LocalVariableTag getLocalVariableTag(InstructionHandle ih, int index) {
for (InstructionTargeter t : ih.getTargeters()) {
if (t instanceof LocalVariableTag) {
LocalVariableTag lvt = (LocalVariableTag) t;
if (lvt.getSlot() == index) {
return lvt;
} |
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/LazyMethodGen.java | }
}
return null;
}
static int getLineNumber(InstructionHandle ih, int prevLine) {
for (InstructionTargeter t : ih.getTargeters()) {
if (t instanceof LineNumberTag) {
return ((LineNumberTag) t).getLineNumber();
}
}
return prevLine;
}
public boolean isStatic() {
return Modifier.isStatic(getAccessFlags());
}
public boolean isAbstract() {
return Modifier.isAbstract(getAccessFlags());
}
public boolean isBridgeMethod() {
return (getAccessFlags() & Constants.ACC_BRIDGE) != 0;
}
public void addExceptionHandler(InstructionHandle start, InstructionHandle end, InstructionHandle handlerStart,
ObjectType catchType, boolean highPriority) {
InstructionHandle start1 = Range.genStart(body, start);
InstructionHandle end1 = Range.genEnd(body, end);
ExceptionRange er = new ExceptionRange(body, (catchType == null ? null : BcelWorld.fromBcel(catchType)), highPriority);
er.associateWithTargets(start1, end1, handlerStart);
}
public int getAccessFlags() {
return modifiers; |
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/LazyMethodGen.java | }
public int getAccessFlagsWithoutSynchronized() {
if (isSynchronized()) {
return modifiers - Modifier.SYNCHRONIZED;
}
return modifiers;
}
public boolean isSynchronized() {
return (modifiers & Modifier.SYNCHRONIZED) != 0;
}
public void setAccessFlags(int newFlags) {
this.modifiers = newFlags;
}
public Type[] getArgumentTypes() {
initialize();
return argumentTypes;
}
public LazyClassGen getEnclosingClass() {
return enclosingClass;
}
public int getMaxLocals() {
return maxLocals;
}
public String getName() {
return name;
}
public String getGenericReturnTypeSignature() {
if (memberView == null) {
return getReturnType().getSignature();
} 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/LazyMethodGen.java | return memberView.getGenericReturnType().getSignature();
}
}
public Type getReturnType() {
initialize();
return returnType;
}
public void setMaxLocals(int maxLocals) {
this.maxLocals = maxLocals;
}
public InstructionList getBody() {
markAsChanged();
return body;
}
public InstructionList getBodyForPrint() {
return body;
}
public boolean hasBody() {
if (savedMethod != null) {
return savedMethod.getCode() != null;
}
return body != null;
}
public List<Attribute> getAttributes() {
return attributes;
}
public String[] getDeclaredExceptions() {
return declaredExceptions;
}
public String getClassName() { |
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/LazyMethodGen.java | return enclosingClass.getName();
}
public MethodGen pack() {
forceSyntheticForAjcMagicMembers();
int flags = getAccessFlags();
if (enclosingClass.getWorld().isJoinpointSynchronizationEnabled()
&& enclosingClass.getWorld().areSynchronizationPointcutsInUse()) {
flags = getAccessFlagsWithoutSynchronized();
}
MethodGen gen = new MethodGen(flags, getReturnType(), getArgumentTypes(), null,
getName(), getEnclosingClass().getName(), new InstructionList(), getEnclosingClass().getConstantPool());
for (int i = 0, len = declaredExceptions.length; i < len; i++) {
gen.addException(declaredExceptions[i]);
}
for (Attribute attr : attributes) {
gen.addAttribute(attr);
}
if (newAnnotations != null) {
for (AnnotationAJ element : newAnnotations) {
gen.addAnnotation(new AnnotationGen(((BcelAnnotation) element).getBcelAnnotation(), gen.getConstantPool(), true));
}
}
if (newParameterAnnotations != null) {
for (int i = 0; i < newParameterAnnotations.length; i++) {
AnnotationAJ[] annos = newParameterAnnotations[i];
for (int j = 0; j < annos.length; j++) {
gen.addParameterAnnotation(i,
new AnnotationGen(((BcelAnnotation) annos[j]).getBcelAnnotation(), gen.getConstantPool(), 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/LazyMethodGen.java | }
}
}
if (memberView != null && memberView.getAnnotations() != null && memberView.getAnnotations().length != 0) {
AnnotationAJ[] ans = memberView.getAnnotations();
for (int i = 0, len = ans.length; i < len; i++) {
AnnotationGen a = ((BcelAnnotation) ans[i]).getBcelAnnotation();
gen.addAnnotation(new AnnotationGen(a, gen.getConstantPool(), true));
}
}
if (isSynthetic) {
if (enclosingClass.getWorld().isInJava5Mode()) {
gen.setModifiers(gen.getModifiers() | ACC_SYNTHETIC);
}
if (!hasAttribute("Synthetic")) {
ConstantPool cpg = gen.getConstantPool();
int index = cpg.addUtf8("Synthetic");
gen.addAttribute(new Synthetic(index, 0, new byte[0], cpg));
}
}
if (hasBody()) {
if (this.enclosingClass.getWorld().shouldFastPackMethods()) {
if (isAdviceMethod() || getName().equals("<clinit>")) {
packBody(gen);
} else {
optimizedPackBody(gen);
}
} else {
packBody(gen); |
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/LazyMethodGen.java | }
gen.setMaxLocals();
gen.setMaxStack();
} else {
gen.setInstructionList(null);
}
return gen;
}
private boolean hasAttribute(String attributeName) {
for (Attribute attr: attributes) {
if (attr.getName().equals(attributeName)) {
return true;
}
}
return false;
}
private void forceSyntheticForAjcMagicMembers() {
if (NameMangler.isSyntheticMethod(getName(), inAspect())) {
makeSynthetic();
}
}
private boolean inAspect() {
BcelObjectType objectType = enclosingClass.getBcelObjectType();
return (objectType == null ? false : objectType.isAspect());
}
public void makeSynthetic() {
isSynthetic = true;
}
private static class LVPosition { |
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/LazyMethodGen.java | InstructionHandle start = null;
InstructionHandle end = null;
}
/**
* fill the newly created method gen with our body, inspired by InstructionList.copy()
*/
public void packBody(MethodGen gen) {
InstructionList fresh = gen.getInstructionList();
Map<InstructionHandle, InstructionHandle> map = copyAllInstructionsExceptRangeInstructionsInto(fresh);
/*
* Update branch targets and insert various attributes. Insert our exceptionHandlers into a sorted list, so they can be
* added in order later.
*/
InstructionHandle oldInstructionHandle = getBody().getStart();
InstructionHandle newInstructionHandle = fresh.getStart();
LinkedList<ExceptionRange> exceptionList = new LinkedList<ExceptionRange>();
Map<LocalVariableTag, LVPosition> localVariables = new HashMap<LocalVariableTag, LVPosition>();
int currLine = -1;
int lineNumberOffset = (fromFilename == null) ? 0 : getEnclosingClass().getSourceDebugExtensionOffset(fromFilename);
while (oldInstructionHandle != null) {
if (map.get(oldInstructionHandle) == null) {
handleRangeInstruction(oldInstructionHandle, exceptionList);
oldInstructionHandle = oldInstructionHandle.getNext();
} 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/LazyMethodGen.java | Instruction oldInstruction = oldInstructionHandle.getInstruction();
Instruction newInstruction = newInstructionHandle.getInstruction();
if (oldInstruction instanceof InstructionBranch) {
handleBranchInstruction(map, oldInstruction, newInstruction);
}
for (InstructionTargeter targeter : oldInstructionHandle.getTargeters()) {
if (targeter instanceof LineNumberTag) {
int line = ((LineNumberTag) targeter).getLineNumber();
if (line != currLine) {
gen.addLineNumber(newInstructionHandle, line + lineNumberOffset);
currLine = line;
}
} else if (targeter instanceof LocalVariableTag) {
LocalVariableTag lvt = (LocalVariableTag) targeter;
LVPosition p = localVariables.get(lvt);
if (p == null) {
LVPosition newp = new LVPosition();
newp.start = newp.end = newInstructionHandle;
localVariables.put(lvt, newp);
} else {
p.end = newInstructionHandle;
}
}
} |
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/LazyMethodGen.java | oldInstructionHandle = oldInstructionHandle.getNext();
newInstructionHandle = newInstructionHandle.getNext();
}
}
addExceptionHandlers(gen, map, exceptionList);
if (localVariables.size() == 0) {
createNewLocalVariables(gen);
} else {
addLocalVariables(gen, localVariables);
}
if (gen.getLineNumbers().length == 0) {
gen.addLineNumber(gen.getInstructionList().getStart(), 1);
}
}
private void createNewLocalVariables(MethodGen gen) {
gen.removeLocalVariables();
if (!getName().startsWith("<")) { |
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/LazyMethodGen.java | int slot = 0;
InstructionHandle start = gen.getInstructionList().getStart();
InstructionHandle end = gen.getInstructionList().getEnd();
if (!isStatic()) {
String cname = this.enclosingClass.getClassName();
if (cname == null) {
return;
}
Type enclosingType = BcelWorld.makeBcelType(UnresolvedType.forName(cname));
gen.addLocalVariable("this", enclosingType, slot++, start, end);
}
String[] paramNames = (memberView == null ? null : memberView.getParameterNames());
if (paramNames != null) {
for (int i = 0; i < argumentTypes.length; i++) {
String pname = paramNames[i];
if (pname == null) {
pname = "arg" + i;
}
gen.addLocalVariable(pname, argumentTypes[i], slot, start, end);
slot += argumentTypes[i].getSize();
}
}
}
}
/*
* Optimized packing that does a 'local packing' of the code rather than building a brand new method and packing into it. Only
* usable when the packing is going to be done just once.
*/ |
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/LazyMethodGen.java | public void optimizedPackBody(MethodGen gen) {
InstructionList theBody = getBody();
InstructionHandle iHandle = theBody.getStart();
int currLine = -1;
int lineNumberOffset = (fromFilename == null) ? 0 : getEnclosingClass().getSourceDebugExtensionOffset(fromFilename);
Map<LocalVariableTag, LVPosition> localVariables = new HashMap<LocalVariableTag, LVPosition>();
LinkedList<ExceptionRange> exceptionList = new LinkedList<ExceptionRange>();
Set<InstructionHandle> forDeletion = new HashSet<InstructionHandle>();
Set<BranchHandle> branchInstructions = new HashSet<BranchHandle>();
while (iHandle != null) {
Instruction inst = iHandle.getInstruction();
if (inst == Range.RANGEINSTRUCTION) {
Range r = Range.getRange(iHandle);
if (r instanceof ExceptionRange) {
ExceptionRange er = (ExceptionRange) r;
if (er.getStart() == iHandle) {
if (!er.isEmpty()) {
insertHandler(er, exceptionList);
}
}
}
forDeletion.add(iHandle);
} else {
if (inst 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/LazyMethodGen.java | branchInstructions.add((BranchHandle) iHandle);
}
for (InstructionTargeter targeter : iHandle.getTargetersCopy()) {
if (targeter instanceof LineNumberTag) {
int line = ((LineNumberTag) targeter).getLineNumber();
if (line != currLine) {
gen.addLineNumber(iHandle, line + lineNumberOffset);
currLine = line;
}
} else if (targeter instanceof LocalVariableTag) {
LocalVariableTag lvt = (LocalVariableTag) targeter;
LVPosition p = localVariables.get(lvt);
if (p == null) {
LVPosition newp = new LVPosition();
newp.start = newp.end = iHandle;
localVariables.put(lvt, newp);
} else {
p.end = iHandle;
}
}
}
}
iHandle = iHandle.getNext();
}
for (BranchHandle branchHandle : branchInstructions) {
handleBranchInstruction(branchHandle, forDeletion);
} |
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/LazyMethodGen.java | for (ExceptionRange r : exceptionList) {
if (r.isEmpty()) {
continue;
}
gen.addExceptionHandler(jumpForward(r.getRealStart(), forDeletion), jumpForward(r.getRealEnd(), forDeletion),
jumpForward(r.getHandler(), forDeletion),
(r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType()));
}
for (InstructionHandle handle : forDeletion) {
try {
theBody.delete(handle);
} catch (TargetLostException e) {
e.printStackTrace();
}
}
gen.setInstructionList(theBody);
if (localVariables.size() == 0) {
createNewLocalVariables(gen);
} else {
addLocalVariables(gen, localVariables);
} |
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/LazyMethodGen.java | if (gen.getLineNumbers().length == 0) {
gen.addLineNumber(gen.getInstructionList().getStart(), 1);
}
wasPackedOptimally = true;
}
private void addLocalVariables(MethodGen gen, Map<LocalVariableTag, LVPosition> localVariables) {
gen.removeLocalVariables();
InstructionHandle methodStart = gen.getInstructionList().getStart();
InstructionHandle methodEnd = gen.getInstructionList().getEnd();
int paramSlots = gen.isStatic() ? 0 : 1;
Type[] argTypes = gen.getArgumentTypes();
if (argTypes != null) {
for (int i = 0; i < argTypes.length; i++) {
if (argTypes[i].getSize() == 2) {
paramSlots += 2;
} else {
paramSlots += 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/LazyMethodGen.java | }
}
Map<InstructionHandle, Set<Integer>> duplicatedLocalMap = new HashMap<InstructionHandle, Set<Integer>>();
for (LocalVariableTag tag : localVariables.keySet()) {
LVPosition lvpos = localVariables.get(tag);
InstructionHandle start = (tag.getSlot() < paramSlots ? methodStart : lvpos.start);
InstructionHandle end = (tag.getSlot() < paramSlots ? methodEnd : lvpos.end);
Set<Integer> slots = duplicatedLocalMap.get(start);
if (slots == null) {
slots = new HashSet<Integer>();
duplicatedLocalMap.put(start, slots);
} else if (slots.contains(new Integer(tag.getSlot()))) {
continue;
}
slots.add(Integer.valueOf(tag.getSlot()));
Type t = tag.getRealType();
if (t == null) {
t = BcelWorld.makeBcelType(UnresolvedType.forSignature(tag.getType()));
}
gen.addLocalVariable(tag.getName(), t, tag.getSlot(), start, end);
}
}
private void addExceptionHandlers(MethodGen gen, Map<InstructionHandle, InstructionHandle> map,
LinkedList<ExceptionRange> exnList) {
for (ExceptionRange r : exnList) { |
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/LazyMethodGen.java | if (r.isEmpty()) {
continue;
}
InstructionHandle rMappedStart = remap(r.getRealStart(), map);
InstructionHandle rMappedEnd = remap(r.getRealEnd(), map);
InstructionHandle rMappedHandler = remap(r.getHandler(), map);
gen.addExceptionHandler(rMappedStart, rMappedEnd, rMappedHandler, (r.getCatchType() == null) ? null
: (ObjectType) BcelWorld.makeBcelType(r.getCatchType()));
}
}
private void handleBranchInstruction(Map<InstructionHandle, InstructionHandle> map, Instruction oldInstruction,
Instruction newInstruction) {
InstructionBranch oldBranchInstruction = (InstructionBranch) oldInstruction;
InstructionBranch newBranchInstruction = (InstructionBranch) newInstruction;
InstructionHandle oldTarget = oldBranchInstruction.getTarget();
newBranchInstruction.setTarget(remap(oldTarget, map));
if (oldBranchInstruction instanceof InstructionSelect) {
InstructionHandle[] oldTargets = ((InstructionSelect) oldBranchInstruction).getTargets();
InstructionHandle[] newTargets = ((InstructionSelect) newBranchInstruction).getTargets();
for (int k = oldTargets.length - 1; k >= 0; k--) {
newTargets[k] = remap(oldTargets[k], map);
newTargets[k].addTargeter(newBranchInstruction);
}
}
}
private InstructionHandle jumpForward(InstructionHandle t, Set<InstructionHandle> handlesForDeletion) { |
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/LazyMethodGen.java | InstructionHandle target = t;
if (handlesForDeletion.contains(target)) {
do {
target = target.getNext();
} while (handlesForDeletion.contains(target));
}
return target;
}
/**
* Process a branch instruction with respect to instructions that are about to be deleted. If the target for the branch is a
* candidate for deletion, move it to the next valid instruction after the deleted target.
*/
private void handleBranchInstruction(BranchHandle branchHandle, Set<InstructionHandle> handlesForDeletion) {
InstructionBranch branchInstruction = (InstructionBranch) branchHandle.getInstruction();
InstructionHandle target = branchInstruction.getTarget();
if (handlesForDeletion.contains(target)) {
do {
target = target.getNext();
} while (handlesForDeletion.contains(target));
branchInstruction.setTarget(target);
}
if (branchInstruction instanceof InstructionSelect) {
InstructionSelect iSelect = (InstructionSelect) branchInstruction;
InstructionHandle[] targets = iSelect.getTargets();
for (int k = targets.length - 1; k >= 0; k--) {
InstructionHandle oneTarget = targets[k];
if (handlesForDeletion.contains(oneTarget)) {
do {
oneTarget = oneTarget.getNext(); |
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/LazyMethodGen.java | } while (handlesForDeletion.contains(oneTarget));
iSelect.setTarget(k, oneTarget);
oneTarget.addTargeter(branchInstruction);
}
}
}
}
private void handleRangeInstruction(InstructionHandle ih, LinkedList<ExceptionRange> exnList) {
Range r = Range.getRange(ih);
if (r instanceof ExceptionRange) {
ExceptionRange er = (ExceptionRange) r;
if (er.getStart() == ih) {
if (!er.isEmpty()) {
insertHandler(er, exnList);
}
}
} else {
}
}
/*
* Make copies of all instructions, append them to the new list and associate old instruction references with the new ones,
* i.e., a 1:1 mapping.
*/
private Map<InstructionHandle, InstructionHandle> copyAllInstructionsExceptRangeInstructionsInto(InstructionList intoList) {
Map<InstructionHandle, InstructionHandle> map = new HashMap<InstructionHandle, InstructionHandle>(); |
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/LazyMethodGen.java | for (InstructionHandle ih = getBody().getStart(); ih != null; ih = ih.getNext()) {
if (Range.isRangeHandle(ih)) {
continue;
}
Instruction inst = ih.getInstruction();
Instruction copy = Utility.copyInstruction(inst);
if (copy instanceof InstructionBranch) {
map.put(ih, intoList.append((InstructionBranch) copy));
} else {
map.put(ih, intoList.append(copy));
}
}
return map;
}
/**
* This procedure should not currently be used.
*/ |
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/LazyMethodGen.java | private static InstructionHandle remap(InstructionHandle handle, Map<InstructionHandle, InstructionHandle> map) {
while (true) {
InstructionHandle ret = map.get(handle);
if (ret == null) {
handle = handle.getNext();
} else {
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/LazyMethodGen.java | static void insertHandler(ExceptionRange fresh, LinkedList<ExceptionRange> l) {
for (ListIterator<ExceptionRange> iter = l.listIterator(); iter.hasNext();) {
ExceptionRange r = iter.next();
if (fresh.getPriority() >= r.getPriority()) {
iter.previous();
iter.add(fresh);
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/LazyMethodGen.java | l.add(fresh);
}
public boolean isPrivate() {
return Modifier.isPrivate(getAccessFlags());
}
public boolean isProtected() {
return Modifier.isProtected(getAccessFlags());
}
public boolean isDefault() {
return !(isProtected() || isPrivate() || isPublic());
}
public boolean isPublic() {
return Modifier.isPublic(getAccessFlags());
}
/**
* A good body is a body with the following properties:
*
* <ul>
* <li>For each branch instruction S in body, target T of S is in body.
* <li>For each branch instruction S in body, target T of S has S as a targeter.
* <li>For each instruction T in body, for each branch instruction S that is a targeter of T, S is in body.
* <li>For each non-range-handle instruction T in body, for each instruction S that is a targeter of T, S is either a branch
* instruction, an exception range or a tag
* <li>For each range-handle instruction T in body, there is exactly one targeter S that is a range.
* <li>For each range-handle instruction T in body, the range R targeting T is in body.
* <li>For each instruction T in body, for each exception range R targeting T, R is in body.
* <li>For each exception range R in body, let T := R.handler. T is in body, and R is one of T's targeters
* <li>All ranges are properly nested: For all ranges Q and R, if Q.start preceeds R.start, then R.end preceeds Q.end. |
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/LazyMethodGen.java | * </ul>
*
* Where the shorthand "R is in body" means "R.start is in body, R.end is in body, and any InstructionHandle stored in a field
* of R (such as an exception handle) is in body".
*/
public void assertGoodBody() {
if (true) {
return;
}
assertGoodBody(getBody(), toString());
}
public static void assertGoodBody(InstructionList il, String from) {
if (true) {
return;
}
}
private static void assertTargetedBy(InstructionHandle target, InstructionTargeter targeter, String from) {
Iterator tIter = target.getTargeters().iterator();
while (tIter.hasNext()) {
if (((InstructionTargeter) tIter.next()) == targeter) {
return;
}
}
throw new RuntimeException("bad targeting relationship in " + from);
}
private static void assertTargets(InstructionTargeter targeter, InstructionHandle target, String from) {
if (targeter instanceof Range) {
Range r = (Range) targeter;
if (r.getStart() == target || r.getEnd() == target) { |
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/LazyMethodGen.java | return;
}
if (r instanceof ExceptionRange) {
if (((ExceptionRange) r).getHandler() == target) {
return;
}
}
} else if (targeter instanceof InstructionBranch) {
InstructionBranch bi = (InstructionBranch) targeter;
if (bi.getTarget() == target) {
return;
}
if (targeter instanceof InstructionSelect) {
InstructionSelect sel = (InstructionSelect) targeter;
InstructionHandle[] itargets = sel.getTargets();
for (int k = itargets.length - 1; k >= 0; k--) {
if (itargets[k] == target) {
return;
}
}
}
} else if (targeter instanceof Tag) {
return;
}
throw new BCException(targeter + " doesn't target " + target + " in " + from);
}
private static Range getRangeAndAssertExactlyOne(InstructionHandle ih, String from) {
Range ret = null;
Iterator<InstructionTargeter> tIter = ih.getTargeters().iterator();
if (!tIter.hasNext()) { |
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/LazyMethodGen.java | throw new BCException("range handle with no range in " + from);
}
while (tIter.hasNext()) {
InstructionTargeter ts = tIter.next();
if (ts instanceof Range) {
if (ret != null) {
throw new BCException("range handle with multiple ranges in " + from);
}
ret = (Range) ts;
}
}
if (ret == null) {
throw new BCException("range handle with no range in " + from);
}
return ret;
}
boolean isAdviceMethod() {
if (memberView == null) {
return false;
}
return memberView.getAssociatedShadowMunger() != null;
}
boolean isAjSynthetic() {
if (memberView == null) {
return true;
}
return memberView.isAjSynthetic();
}
boolean isSynthetic() { |
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/LazyMethodGen.java | if (memberView == null) {
return false;
}
return memberView.isSynthetic();
}
public ISourceLocation getSourceLocation() {
if (memberView != null) {
return memberView.getSourceLocation();
}
return null;
}
public AjAttribute.EffectiveSignatureAttribute getEffectiveSignature() {
if (effectiveSignature != null) {
return effectiveSignature;
}
return memberView.getEffectiveSignature();
}
public void setEffectiveSignature(ResolvedMember member, Shadow.Kind kind, boolean shouldWeave) {
this.effectiveSignature = new AjAttribute.EffectiveSignatureAttribute(member, kind, shouldWeave);
}
public String getSignature() {
if (memberView != null) {
return memberView.getSignature();
}
return MemberImpl.typesToSignature(BcelWorld.fromBcel(getReturnType()), BcelWorld.fromBcel(getArgumentTypes()), false);
}
public String getParameterSignature() {
if (memberView != null) {
return memberView.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/LazyMethodGen.java | }
return MemberImpl.typesToSignature(BcelWorld.fromBcel(getArgumentTypes()));
}
public BcelMethod getMemberView() {
return memberView;
}
public void forcePublic() {
markAsChanged();
modifiers = Utility.makePublic(modifiers);
}
public boolean getCanInline() {
return canInline;
}
public void setCanInline(boolean canInline) {
this.canInline = canInline;
}
public void addAttribute(Attribute attribute) {
attributes.add(attribute);
}
public String toTraceString() {
return toShortString();
}
public ConstantPool getConstantPool() {
return enclosingClass.getConstantPool();
}
public static boolean isConstructor(LazyMethodGen aMethod) {
return aMethod.getName().equals("<init>");
}
} |
415,266 | Bug 415266 LTW not working when JMX is enabled | When I enable JMX remote management on a JVM along with AspectJ load-time weaving (LTW), our Aspect doesn't appear to get woven in. This are the JVM arguments: -Dvisualvm.display.name=JdbcTimingAspectTest -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1024 -javaagent:/jars/aspectjweaver.jar -Dorg.aspectj.weaver.loadtime.configuration=com/trgr/cobalt/infrastructure/instrumentation/aspects/timing/jdbc/jdbcmonitor.xml Note that if I don't enable JMX remote management (by remove the -Dcom.sun.management.jmxremote.* JVM arguments), the Aspect works fine. | resolved fixed | 9e992d6 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:08:31Z" | "2013-08-16T21:53:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | /*******************************************************************************
* Copyright (c) 2005 Contributors.
* 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://eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alexandre Vasseur initial implementation
*******************************************************************************/
package org.aspectj.weaver.loadtime;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import org.aspectj.bridge.context.CompilationAndWeavingContext;
import org.aspectj.weaver.Dump;
import org.aspectj.weaver.tools.Trace;
import org.aspectj.weaver.tools.TraceFactory;
import org.aspectj.weaver.tools.WeavingAdaptor;
import org.aspectj.weaver.tools.cache.SimpleCache; |
415,266 | Bug 415266 LTW not working when JMX is enabled | When I enable JMX remote management on a JVM along with AspectJ load-time weaving (LTW), our Aspect doesn't appear to get woven in. This are the JVM arguments: -Dvisualvm.display.name=JdbcTimingAspectTest -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1024 -javaagent:/jars/aspectjweaver.jar -Dorg.aspectj.weaver.loadtime.configuration=com/trgr/cobalt/infrastructure/instrumentation/aspects/timing/jdbc/jdbcmonitor.xml Note that if I don't enable JMX remote management (by remove the -Dcom.sun.management.jmxremote.* JVM arguments), the Aspect works fine. | resolved fixed | 9e992d6 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:08:31Z" | "2013-08-16T21:53:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | import org.aspectj.weaver.tools.cache.SimpleCacheFactory;
/**
* Adapter between the generic class pre processor interface and the AspectJ weaver Load time weaving consistency relies on
* Bcel.setRepository
*
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
*/
public class Aj implements ClassPreProcessor {
private IWeavingContext weavingContext;
public static SimpleCache laCache=SimpleCacheFactory.createSimpleCache();
/**
* References are added to this queue when their associated classloader is removed, and once on here that indicates that we
* should tidy up the adaptor map and remove the adaptor (weaver) from the map we are maintaining from adaptorkey > adaptor
* (weaver)
*/
private static ReferenceQueue adaptorQueue = new ReferenceQueue();
private static Trace trace = TraceFactory.getTraceFactory().getTrace(Aj.class);
public Aj() {
this(null);
}
public Aj(IWeavingContext context) {
if (trace.isTraceEnabled())
trace.enter("<init>", this, new Object[] { context, getClass().getClassLoader() });
this.weavingContext = context;
if (trace.isTraceEnabled())
trace.exit("<init>");
}
/**
* Initialization
*/ |
415,266 | Bug 415266 LTW not working when JMX is enabled | When I enable JMX remote management on a JVM along with AspectJ load-time weaving (LTW), our Aspect doesn't appear to get woven in. This are the JVM arguments: -Dvisualvm.display.name=JdbcTimingAspectTest -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1024 -javaagent:/jars/aspectjweaver.jar -Dorg.aspectj.weaver.loadtime.configuration=com/trgr/cobalt/infrastructure/instrumentation/aspects/timing/jdbc/jdbcmonitor.xml Note that if I don't enable JMX remote management (by remove the -Dcom.sun.management.jmxremote.* JVM arguments), the Aspect works fine. | resolved fixed | 9e992d6 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:08:31Z" | "2013-08-16T21:53:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | public void initialize() {
}
private final static String deleLoader = "sun.reflect.DelegatingClassLoader";
/**
* Weave
*
* @param className
* @param bytes
* @param loader
* @return woven bytes
*/
public byte[] preProcess(String className, byte[] bytes, ClassLoader loader, ProtectionDomain protectionDomain) {
if (loader == null || className == null || loader.getClass().getName().equals(deleLoader)) {
return bytes;
}
if (loadersToSkip != null) {
if (loadersToSkip.contains(loader.getClass().getName())) {
return bytes;
}
}
if (trace.isTraceEnabled())
trace.enter("preProcess", this, new Object[] { className, bytes, loader });
if (trace.isTraceEnabled())
trace.event("preProcess", this, new Object[] { loader.getParent(), Thread.currentThread().getContextClassLoader() });
try {
synchronized (loader) { |
415,266 | Bug 415266 LTW not working when JMX is enabled | When I enable JMX remote management on a JVM along with AspectJ load-time weaving (LTW), our Aspect doesn't appear to get woven in. This are the JVM arguments: -Dvisualvm.display.name=JdbcTimingAspectTest -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1024 -javaagent:/jars/aspectjweaver.jar -Dorg.aspectj.weaver.loadtime.configuration=com/trgr/cobalt/infrastructure/instrumentation/aspects/timing/jdbc/jdbcmonitor.xml Note that if I don't enable JMX remote management (by remove the -Dcom.sun.management.jmxremote.* JVM arguments), the Aspect works fine. | resolved fixed | 9e992d6 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:08:31Z" | "2013-08-16T21:53:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | if (SimpleCacheFactory.isEnabled()) {
byte[] cacheBytes= laCache.getAndInitialize(className, bytes,loader,protectionDomain);
if (cacheBytes!=null){
return cacheBytes;
}
}
WeavingAdaptor weavingAdaptor = WeaverContainer.getWeaver(loader, weavingContext);
if (weavingAdaptor == null) {
if (trace.isTraceEnabled())
trace.exit("preProcess");
return bytes;
}
try {
weavingAdaptor.setActiveProtectionDomain(protectionDomain);
byte[] newBytes = weavingAdaptor.weaveClass(className, bytes, false);
Dump.dumpOnExit(weavingAdaptor.getMessageHolder(), true);
if (trace.isTraceEnabled())
trace.exit("preProcess", newBytes);
if (SimpleCacheFactory.isEnabled()) {
laCache.put(className, bytes, newBytes);
}
return newBytes;
} finally {
weavingAdaptor.setActiveProtectionDomain(null);
}
}
} catch (Throwable th) {
trace.error(className, th);
Dump.dumpWithException(th); |
415,266 | Bug 415266 LTW not working when JMX is enabled | When I enable JMX remote management on a JVM along with AspectJ load-time weaving (LTW), our Aspect doesn't appear to get woven in. This are the JVM arguments: -Dvisualvm.display.name=JdbcTimingAspectTest -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1024 -javaagent:/jars/aspectjweaver.jar -Dorg.aspectj.weaver.loadtime.configuration=com/trgr/cobalt/infrastructure/instrumentation/aspects/timing/jdbc/jdbcmonitor.xml Note that if I don't enable JMX remote management (by remove the -Dcom.sun.management.jmxremote.* JVM arguments), the Aspect works fine. | resolved fixed | 9e992d6 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:08:31Z" | "2013-08-16T21:53:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | if (trace.isTraceEnabled())
trace.exit("preProcess", th);
return bytes;
} finally {
CompilationAndWeavingContext.resetForThread();
}
}
/**
* An AdaptorKey is a WeakReference wrapping a classloader reference that will enqueue to a specified queue when the classloader
* is GC'd. Since the AdaptorKey is used as a key into a hashmap we need to give it a non-varying hashcode/equals
* implementation, and we need that hashcode not to vary even when the internal referent has been GC'd. The hashcode is
* calculated on creation of the AdaptorKey based on the loader instance that it is wrapping. This means even when the referent
* is gone we can still use the AdaptorKey and it will 'point' to the same place as it always did.
*/
private static class AdaptorKey extends WeakReference {
private final int loaderHashCode, sysHashCode, hashValue;
private final String loaderClass;
public AdaptorKey(ClassLoader loader) {
super(loader, adaptorQueue);
loaderHashCode = loader.hashCode();
sysHashCode = System.identityHashCode(loader);
loaderClass = loader.getClass().getName();
hashValue = loaderHashCode + sysHashCode + loaderClass.hashCode();
}
public ClassLoader getClassLoader() {
ClassLoader instance = (ClassLoader) get();
return instance; |
415,266 | Bug 415266 LTW not working when JMX is enabled | When I enable JMX remote management on a JVM along with AspectJ load-time weaving (LTW), our Aspect doesn't appear to get woven in. This are the JVM arguments: -Dvisualvm.display.name=JdbcTimingAspectTest -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1024 -javaagent:/jars/aspectjweaver.jar -Dorg.aspectj.weaver.loadtime.configuration=com/trgr/cobalt/infrastructure/instrumentation/aspects/timing/jdbc/jdbcmonitor.xml Note that if I don't enable JMX remote management (by remove the -Dcom.sun.management.jmxremote.* JVM arguments), the Aspect works fine. | resolved fixed | 9e992d6 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:08:31Z" | "2013-08-16T21:53:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | }
public boolean equals(Object obj) {
if (!(obj instanceof AdaptorKey)) {
return false;
}
AdaptorKey other = (AdaptorKey) obj;
return (other.loaderHashCode == loaderHashCode)
&& (other.sysHashCode == sysHashCode)
&& loaderClass.equals(other.loaderClass);
}
public int hashCode() {
return hashValue;
}
}
/**
* The reference queue is only processed when a request is made for a weaver adaptor. This means there can be one or two stale
* weavers left around. If the user knows they have finished all their weaving, they might wish to call removeStaleAdaptors
* which will process anything left on the reference queue containing adaptorKeys for garbage collected classloaders.
*
* @param displayProgress produce System.err info on the tidying up process
* @return number of stale weavers removed
*/
public static int removeStaleAdaptors(boolean displayProgress) {
int removed = 0;
synchronized (WeaverContainer.weavingAdaptors) {
if (displayProgress) {
System.err.println("Weaver adaptors before queue processing:");
Map m = WeaverContainer.weavingAdaptors;
Set keys = m.keySet();
for (Iterator iterator = keys.iterator(); iterator.hasNext();) { |
415,266 | Bug 415266 LTW not working when JMX is enabled | When I enable JMX remote management on a JVM along with AspectJ load-time weaving (LTW), our Aspect doesn't appear to get woven in. This are the JVM arguments: -Dvisualvm.display.name=JdbcTimingAspectTest -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1024 -javaagent:/jars/aspectjweaver.jar -Dorg.aspectj.weaver.loadtime.configuration=com/trgr/cobalt/infrastructure/instrumentation/aspects/timing/jdbc/jdbcmonitor.xml Note that if I don't enable JMX remote management (by remove the -Dcom.sun.management.jmxremote.* JVM arguments), the Aspect works fine. | resolved fixed | 9e992d6 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:08:31Z" | "2013-08-16T21:53:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | Object object = iterator.next();
System.err.println(object + " = " + WeaverContainer.weavingAdaptors.get(object));
}
}
Object o = adaptorQueue.poll();
while (o != null) {
if (displayProgress)
System.err.println("Processing referencequeue entry " + o);
AdaptorKey wo = (AdaptorKey) o;
boolean didit = WeaverContainer.weavingAdaptors.remove(wo) != null;
if (didit) {
removed++;
} else {
throw new RuntimeException("Eh?? key=" + wo);
}
if (displayProgress)
System.err.println("Removed? " + didit);
o = adaptorQueue.poll();
}
if (displayProgress) {
System.err.println("Weaver adaptors after queue processing:");
Map m = WeaverContainer.weavingAdaptors;
Set keys = m.keySet();
for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
Object object = iterator.next();
System.err.println(object + " = " + WeaverContainer.weavingAdaptors.get(object));
}
}
}
return removed; |
415,266 | Bug 415266 LTW not working when JMX is enabled | When I enable JMX remote management on a JVM along with AspectJ load-time weaving (LTW), our Aspect doesn't appear to get woven in. This are the JVM arguments: -Dvisualvm.display.name=JdbcTimingAspectTest -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1024 -javaagent:/jars/aspectjweaver.jar -Dorg.aspectj.weaver.loadtime.configuration=com/trgr/cobalt/infrastructure/instrumentation/aspects/timing/jdbc/jdbcmonitor.xml Note that if I don't enable JMX remote management (by remove the -Dcom.sun.management.jmxremote.* JVM arguments), the Aspect works fine. | resolved fixed | 9e992d6 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:08:31Z" | "2013-08-16T21:53:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | }
/**
* @return the number of entries still in the weavingAdaptors map
*/
public static int getActiveAdaptorCount() {
return WeaverContainer.weavingAdaptors.size();
}
/**
* Process the reference queue that contains stale AdaptorKeys - the keys are put on the queue when their classloader referent
* is garbage collected and so the associated adaptor (weaver) should be removed from the map
*/
public static void checkQ() {
synchronized (adaptorQueue) {
Object o = adaptorQueue.poll();
while (o != null) {
AdaptorKey wo = (AdaptorKey) o;
WeaverContainer.weavingAdaptors.remove(wo);
o = adaptorQueue.poll();
}
}
}
public static List<String> loadersToSkip = null;
static {
new ExplicitlyInitializedClassLoaderWeavingAdaptor(new ClassLoaderWeavingAdaptor());
try {
String loadersToSkipProperty = System.getProperty("aj.weaving.loadersToSkip",""); |
415,266 | Bug 415266 LTW not working when JMX is enabled | When I enable JMX remote management on a JVM along with AspectJ load-time weaving (LTW), our Aspect doesn't appear to get woven in. This are the JVM arguments: -Dvisualvm.display.name=JdbcTimingAspectTest -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1024 -javaagent:/jars/aspectjweaver.jar -Dorg.aspectj.weaver.loadtime.configuration=com/trgr/cobalt/infrastructure/instrumentation/aspects/timing/jdbc/jdbcmonitor.xml Note that if I don't enable JMX remote management (by remove the -Dcom.sun.management.jmxremote.* JVM arguments), the Aspect works fine. | resolved fixed | 9e992d6 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:08:31Z" | "2013-08-16T21:53:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | StringTokenizer st = new StringTokenizer(loadersToSkipProperty, ",");
if (loadersToSkipProperty != null && loadersToSkip == null) {
if (st.hasMoreTokens()) {
loadersToSkip = new ArrayList<String>();
}
while (st.hasMoreTokens()) {
String nextLoader = st.nextToken();
loadersToSkip.add(nextLoader);
}
}
} catch (Exception e) {
}
}
/**
* Cache of weaver There is one weaver per classloader
*/
static class WeaverContainer {
final static Map weavingAdaptors = Collections.synchronizedMap(new HashMap());
static WeavingAdaptor getWeaver(ClassLoader loader, IWeavingContext weavingContext) {
ExplicitlyInitializedClassLoaderWeavingAdaptor adaptor = null;
AdaptorKey adaptorKey = new AdaptorKey(loader);
String loaderClassName = loader.getClass().getName();
synchronized (weavingAdaptors) {
checkQ();
if(loader.equals(myClassLoader)){
adaptor = myClassLoaderAdpator;
}
else{
adaptor = (ExplicitlyInitializedClassLoaderWeavingAdaptor) weavingAdaptors.get(adaptorKey); |
415,266 | Bug 415266 LTW not working when JMX is enabled | When I enable JMX remote management on a JVM along with AspectJ load-time weaving (LTW), our Aspect doesn't appear to get woven in. This are the JVM arguments: -Dvisualvm.display.name=JdbcTimingAspectTest -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1024 -javaagent:/jars/aspectjweaver.jar -Dorg.aspectj.weaver.loadtime.configuration=com/trgr/cobalt/infrastructure/instrumentation/aspects/timing/jdbc/jdbcmonitor.xml Note that if I don't enable JMX remote management (by remove the -Dcom.sun.management.jmxremote.* JVM arguments), the Aspect works fine. | resolved fixed | 9e992d6 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:08:31Z" | "2013-08-16T21:53:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | }
if (adaptor == null) {
ClassLoaderWeavingAdaptor weavingAdaptor = new ClassLoaderWeavingAdaptor();
adaptor = new ExplicitlyInitializedClassLoaderWeavingAdaptor(weavingAdaptor);
if(myClassLoaderAdpator == null){
myClassLoaderAdpator = adaptor;
}
else{
weavingAdaptors.put(adaptorKey, adaptor);
}
}
}
return adaptor.getWeavingAdaptor(loader, weavingContext);
}
private static final ClassLoader myClassLoader = WeavingAdaptor.class.getClassLoader();
private static ExplicitlyInitializedClassLoaderWeavingAdaptor myClassLoaderAdpator;
}
static class ExplicitlyInitializedClassLoaderWeavingAdaptor {
private final ClassLoaderWeavingAdaptor weavingAdaptor;
private boolean isInitialized;
public ExplicitlyInitializedClassLoaderWeavingAdaptor(ClassLoaderWeavingAdaptor weavingAdaptor) {
this.weavingAdaptor = weavingAdaptor;
this.isInitialized = false;
}
private void initialize(ClassLoader loader, IWeavingContext weavingContext) {
if (!isInitialized) { |
415,266 | Bug 415266 LTW not working when JMX is enabled | When I enable JMX remote management on a JVM along with AspectJ load-time weaving (LTW), our Aspect doesn't appear to get woven in. This are the JVM arguments: -Dvisualvm.display.name=JdbcTimingAspectTest -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1024 -javaagent:/jars/aspectjweaver.jar -Dorg.aspectj.weaver.loadtime.configuration=com/trgr/cobalt/infrastructure/instrumentation/aspects/timing/jdbc/jdbcmonitor.xml Note that if I don't enable JMX remote management (by remove the -Dcom.sun.management.jmxremote.* JVM arguments), the Aspect works fine. | resolved fixed | 9e992d6 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:08:31Z" | "2013-08-16T21:53:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | isInitialized = true;
weavingAdaptor.initialize(loader, weavingContext);
}
}
public ClassLoaderWeavingAdaptor getWeavingAdaptor(ClassLoader loader, IWeavingContext weavingContext) {
initialize(loader, weavingContext);
return weavingAdaptor;
}
}
/**
* Returns a namespace based on the contest of the aspects available
*/
public String getNamespace(ClassLoader loader) {
ClassLoaderWeavingAdaptor weavingAdaptor = (ClassLoaderWeavingAdaptor) WeaverContainer.getWeaver(loader, weavingContext);
return weavingAdaptor.getNamespace();
}
/**
* Check to see if any classes have been generated for a particular classes loader. Calls
* ClassLoaderWeavingAdaptor.generatedClassesExist()
*
* @param loader the class cloder
* @return true if classes have been generated.
*/
public boolean generatedClassesExist(ClassLoader loader) {
return ((ClassLoaderWeavingAdaptor) WeaverContainer.getWeaver(loader, weavingContext)).generatedClassesExistFor(null);
}
public void flushGeneratedClasses(ClassLoader loader) {
((ClassLoaderWeavingAdaptor) WeaverContainer.getWeaver(loader, weavingContext)).flushGeneratedClasses();
}
} |
419,279 | Bug 419279 ajc option to change -Xlint level per-message without Xlintfile | The -Xlintfile option is not a great fit for controlling message across multiple build projects, specifically in my case from the pluginManagement section of a maven parent pom. The problem is that you need a local file to configure the per-message output levels (ignore/warning/error) when you really want to specify it in the build script or in a shared file. As an alternative to -Xlintfile, it would be handy to be able to change an Xlint warning level per message using command line options. For example: ajc -Xlint:adviceDidNotMatch=ignore would override the XlintDefault.properties file for the adviceDidNotMatch message. With Regards Rob | resolved fixed | b2cd5fa | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-23T19:44:23Z" | "2013-10-11T19:33:20Z" | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.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
* Adrian Colyer added constructor to populate javaOptions with
* default settings - 01.20.2003
* Bugzilla #29768, 29769
* ******************************************************************/
package org.aspectj.ajdt.internal.core.builder;
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.aspectj.ajdt.internal.compiler.CompilationResultDestinationManager;
import org.aspectj.util.FileUtil;
/**
* All configuration information needed to run the AspectJ compiler. Compiler options (as opposed to path information) are held in
* an AjCompilerOptions instance
*/
public class AjBuildConfig implements CompilerConfigurationChangeFlags { |
419,279 | Bug 419279 ajc option to change -Xlint level per-message without Xlintfile | The -Xlintfile option is not a great fit for controlling message across multiple build projects, specifically in my case from the pluginManagement section of a maven parent pom. The problem is that you need a local file to configure the per-message output levels (ignore/warning/error) when you really want to specify it in the build script or in a shared file. As an alternative to -Xlintfile, it would be handy to be able to change an Xlint warning level per message using command line options. For example: ajc -Xlint:adviceDidNotMatch=ignore would override the XlintDefault.properties file for the adviceDidNotMatch message. With Regards Rob | resolved fixed | b2cd5fa | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-23T19:44:23Z" | "2013-10-11T19:33:20Z" | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java | private boolean shouldProceed = true;
public static final String AJLINT_IGNORE = "ignore";
public static final String AJLINT_WARN = "warn";
public static final String AJLINT_ERROR = "error";
public static final String AJLINT_DEFAULT = "default";
private File outputDir;
private File outputJar;
private String outxmlName; |
419,279 | Bug 419279 ajc option to change -Xlint level per-message without Xlintfile | The -Xlintfile option is not a great fit for controlling message across multiple build projects, specifically in my case from the pluginManagement section of a maven parent pom. The problem is that you need a local file to configure the per-message output levels (ignore/warning/error) when you really want to specify it in the build script or in a shared file. As an alternative to -Xlintfile, it would be handy to be able to change an Xlint warning level per message using command line options. For example: ajc -Xlint:adviceDidNotMatch=ignore would override the XlintDefault.properties file for the adviceDidNotMatch message. With Regards Rob | resolved fixed | b2cd5fa | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-23T19:44:23Z" | "2013-10-11T19:33:20Z" | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java | private CompilationResultDestinationManager compilationResultDestinationManager = null;
private List<File> sourceRoots = new ArrayList<File>();
private List<File> changedFiles;
private List<File> files = new ArrayList<File>();
private List<File> xmlfiles = new ArrayList<File>();
private List<BinarySourceFile> binaryFiles = new ArrayList<BinarySourceFile>();
private List<File> inJars = new ArrayList<File>();
private List<File> inPath = new ArrayList<File>();
private Map<String, File> sourcePathResources = new HashMap<String, File>();
private List<File> aspectpath = new ArrayList<File>();
private List<String> classpath = new ArrayList<String>();
private List<String> bootclasspath = new ArrayList<String>();
private List<String> cpElementsWithModifiedContents = new ArrayList<String>();
private File configFile;
private String lintMode = AJLINT_DEFAULT;
private File lintSpecFile = null;
private int changes = EVERYTHING;
private AjCompilerOptions options;
private boolean incrementalMode;
private File incrementalFile;
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("BuildConfig[" + (configFile == null ? "null" : configFile.getAbsoluteFile().toString()) + "] #Files="
+ files.size() + " AopXmls=#" + xmlfiles.size());
return sb.toString();
}
public static class BinarySourceFile {
public BinarySourceFile(File dir, File src) {
this.fromInPathDirectory = dir; |
419,279 | Bug 419279 ajc option to change -Xlint level per-message without Xlintfile | The -Xlintfile option is not a great fit for controlling message across multiple build projects, specifically in my case from the pluginManagement section of a maven parent pom. The problem is that you need a local file to configure the per-message output levels (ignore/warning/error) when you really want to specify it in the build script or in a shared file. As an alternative to -Xlintfile, it would be handy to be able to change an Xlint warning level per message using command line options. For example: ajc -Xlint:adviceDidNotMatch=ignore would override the XlintDefault.properties file for the adviceDidNotMatch message. With Regards Rob | resolved fixed | b2cd5fa | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-23T19:44:23Z" | "2013-10-11T19:33:20Z" | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java | this.binSrc = src;
}
public File fromInPathDirectory;
public File binSrc;
public boolean equals(Object obj) {
if (obj != null && (obj instanceof BinarySourceFile)) {
BinarySourceFile other = (BinarySourceFile) obj;
return (binSrc.equals(other.binSrc));
}
return false;
}
public int hashCode() {
return binSrc != null ? binSrc.hashCode() : 0;
}
}
/**
* Intialises the javaOptions Map to hold the default JDT Compiler settings. Added by AMC 01.20.2003 in reponse to bug #29768
* and enh. 29769. The settings here are duplicated from those set in org.eclipse.jdt.internal.compiler.batch.Main, but I've
* elected to copy them rather than refactor the JDT class since this keeps integration with future JDT releases easier (?).
*/
public AjBuildConfig() {
options = new AjCompilerOptions();
}
/**
* returned files includes
* <ul>
* <li>files explicitly listed on command-line</li>
* <li>files listed by reference in argument list files</li>
* <li>files contained in sourceRootDir if that exists</li>
* </ul> |
419,279 | Bug 419279 ajc option to change -Xlint level per-message without Xlintfile | The -Xlintfile option is not a great fit for controlling message across multiple build projects, specifically in my case from the pluginManagement section of a maven parent pom. The problem is that you need a local file to configure the per-message output levels (ignore/warning/error) when you really want to specify it in the build script or in a shared file. As an alternative to -Xlintfile, it would be handy to be able to change an Xlint warning level per message using command line options. For example: ajc -Xlint:adviceDidNotMatch=ignore would override the XlintDefault.properties file for the adviceDidNotMatch message. With Regards Rob | resolved fixed | b2cd5fa | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-23T19:44:23Z" | "2013-10-11T19:33:20Z" | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java | *
* @return all source files that should be compiled.
*/
public List<File> getFiles() {
return files;
}
public List<File> getXmlFiles() {
return xmlfiles;
}
/**
* returned files includes all .class files found in a directory on the inpath, but does not include .class files contained
* within jars.
*/
public List<BinarySourceFile> getBinaryFiles() {
return binaryFiles;
}
public File getOutputDir() {
return outputDir;
}
public CompilationResultDestinationManager getCompilationResultDestinationManager() {
return this.compilationResultDestinationManager;
}
public void setCompilationResultDestinationManager(CompilationResultDestinationManager mgr) {
this.compilationResultDestinationManager = mgr;
}
public void setFiles(List<File> files) {
this.files = files;
}
public void setXmlFiles(List<File> xmlfiles) {
this.xmlfiles = xmlfiles; |
419,279 | Bug 419279 ajc option to change -Xlint level per-message without Xlintfile | The -Xlintfile option is not a great fit for controlling message across multiple build projects, specifically in my case from the pluginManagement section of a maven parent pom. The problem is that you need a local file to configure the per-message output levels (ignore/warning/error) when you really want to specify it in the build script or in a shared file. As an alternative to -Xlintfile, it would be handy to be able to change an Xlint warning level per message using command line options. For example: ajc -Xlint:adviceDidNotMatch=ignore would override the XlintDefault.properties file for the adviceDidNotMatch message. With Regards Rob | resolved fixed | b2cd5fa | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-23T19:44:23Z" | "2013-10-11T19:33:20Z" | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java | }
public void setOutputDir(File outputDir) {
this.outputDir = outputDir;
}
public AjCompilerOptions getOptions() {
return options;
}
/**
* This does not include -bootclasspath but includes -extdirs and -classpath
*/
public List<String> getClasspath() {
return classpath;
}
public void setClasspath(List<String> classpath) {
this.classpath = classpath;
}
public List<String> getBootclasspath() {
return bootclasspath;
}
public void setBootclasspath(List<String> bootclasspath) {
this.bootclasspath = bootclasspath;
}
public File getOutputJar() {
return outputJar;
}
public String getOutxmlName() {
return outxmlName;
}
public List<File> getInpath() { |
419,279 | Bug 419279 ajc option to change -Xlint level per-message without Xlintfile | The -Xlintfile option is not a great fit for controlling message across multiple build projects, specifically in my case from the pluginManagement section of a maven parent pom. The problem is that you need a local file to configure the per-message output levels (ignore/warning/error) when you really want to specify it in the build script or in a shared file. As an alternative to -Xlintfile, it would be handy to be able to change an Xlint warning level per message using command line options. For example: ajc -Xlint:adviceDidNotMatch=ignore would override the XlintDefault.properties file for the adviceDidNotMatch message. With Regards Rob | resolved fixed | b2cd5fa | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-23T19:44:23Z" | "2013-10-11T19:33:20Z" | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java | return inPath;
}
public List<File> getInJars() {
return inJars;
}
public Map<String, File> getSourcePathResources() {
return sourcePathResources;
}
public void setOutputJar(File outputJar) {
this.outputJar = outputJar;
}
public void setOutxmlName(String name) {
this.outxmlName = name;
}
public void setInJars(List<File> sourceJars) {
this.inJars = sourceJars;
}
public void setInPath(List<File> dirsOrJars) {
inPath = dirsOrJars;
binaryFiles = new ArrayList<BinarySourceFile>();
FileFilter filter = new FileFilter() {
public boolean accept(File pathname) {
return pathname.getPath().endsWith(".class");
}
};
for (Iterator<File> iter = dirsOrJars.iterator(); iter.hasNext();) {
File inpathElement = iter.next();
if (inpathElement.isDirectory()) {
File[] files = FileUtil.listFiles(inpathElement, filter); |
419,279 | Bug 419279 ajc option to change -Xlint level per-message without Xlintfile | The -Xlintfile option is not a great fit for controlling message across multiple build projects, specifically in my case from the pluginManagement section of a maven parent pom. The problem is that you need a local file to configure the per-message output levels (ignore/warning/error) when you really want to specify it in the build script or in a shared file. As an alternative to -Xlintfile, it would be handy to be able to change an Xlint warning level per message using command line options. For example: ajc -Xlint:adviceDidNotMatch=ignore would override the XlintDefault.properties file for the adviceDidNotMatch message. With Regards Rob | resolved fixed | b2cd5fa | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-23T19:44:23Z" | "2013-10-11T19:33:20Z" | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java | for (int i = 0; i < files.length; i++) {
binaryFiles.add(new BinarySourceFile(inpathElement, files[i]));
}
}
}
}
public List<File> getSourceRoots() {
return sourceRoots;
}
public void setSourceRoots(List<File> sourceRootDir) {
this.sourceRoots = sourceRootDir;
}
public File getConfigFile() {
return configFile;
}
public void setConfigFile(File configFile) {
this.configFile = configFile;
}
public void setIncrementalMode(boolean incrementalMode) {
this.incrementalMode = incrementalMode;
}
public boolean isIncrementalMode() {
return incrementalMode;
}
public void setIncrementalFile(File incrementalFile) {
this.incrementalFile = incrementalFile;
}
public boolean isIncrementalFileMode() {
return (null != incrementalFile);
} |
419,279 | Bug 419279 ajc option to change -Xlint level per-message without Xlintfile | The -Xlintfile option is not a great fit for controlling message across multiple build projects, specifically in my case from the pluginManagement section of a maven parent pom. The problem is that you need a local file to configure the per-message output levels (ignore/warning/error) when you really want to specify it in the build script or in a shared file. As an alternative to -Xlintfile, it would be handy to be able to change an Xlint warning level per message using command line options. For example: ajc -Xlint:adviceDidNotMatch=ignore would override the XlintDefault.properties file for the adviceDidNotMatch message. With Regards Rob | resolved fixed | b2cd5fa | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-23T19:44:23Z" | "2013-10-11T19:33:20Z" | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java | /**
* @return List (String) classpath of bootclasspath, injars, inpath, aspectpath entries, specified classpath (extdirs, and
* classpath), and output dir or jar
*/
public List<String> getFullClasspath() {
List<String> full = new ArrayList<String>();
full.addAll(getBootclasspath());
for (Iterator<File> i = inJars.iterator(); i.hasNext();) {
full.add((i.next()).getAbsolutePath());
}
for (Iterator<File> i = inPath.iterator(); i.hasNext();) {
full.add((i.next()).getAbsolutePath());
}
for (Iterator<File> i = aspectpath.iterator(); i.hasNext();) {
full.add((i.next()).getAbsolutePath());
}
full.addAll(getClasspath());
return full;
}
public File getLintSpecFile() {
return lintSpecFile;
}
public void setLintSpecFile(File lintSpecFile) {
this.lintSpecFile = lintSpecFile;
} |
419,279 | Bug 419279 ajc option to change -Xlint level per-message without Xlintfile | The -Xlintfile option is not a great fit for controlling message across multiple build projects, specifically in my case from the pluginManagement section of a maven parent pom. The problem is that you need a local file to configure the per-message output levels (ignore/warning/error) when you really want to specify it in the build script or in a shared file. As an alternative to -Xlintfile, it would be handy to be able to change an Xlint warning level per message using command line options. For example: ajc -Xlint:adviceDidNotMatch=ignore would override the XlintDefault.properties file for the adviceDidNotMatch message. With Regards Rob | resolved fixed | b2cd5fa | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-23T19:44:23Z" | "2013-10-11T19:33:20Z" | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java | public List<File> getAspectpath() {
return aspectpath;
}
public void setAspectpath(List<File> aspectpath) {
this.aspectpath = aspectpath;
}
public boolean hasSources() {
return ((null != configFile) || (0 < sourceRoots.size()) || (0 < files.size()) || (0 < inJars.size()) || (0 < inPath.size()));
}
/**
* Install global values into local config unless values conflict:
* <ul>
* <li>Collections are unioned</li>
* <li>values takes local value unless default and global set</li>
* <li>this only sets one of outputDir and outputJar as needed</li>
* <ul>
* This also configures super if javaOptions change.
* |
419,279 | Bug 419279 ajc option to change -Xlint level per-message without Xlintfile | The -Xlintfile option is not a great fit for controlling message across multiple build projects, specifically in my case from the pluginManagement section of a maven parent pom. The problem is that you need a local file to configure the per-message output levels (ignore/warning/error) when you really want to specify it in the build script or in a shared file. As an alternative to -Xlintfile, it would be handy to be able to change an Xlint warning level per message using command line options. For example: ajc -Xlint:adviceDidNotMatch=ignore would override the XlintDefault.properties file for the adviceDidNotMatch message. With Regards Rob | resolved fixed | b2cd5fa | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-23T19:44:23Z" | "2013-10-11T19:33:20Z" | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java | * @param global the AjBuildConfig to read globals from
*/
public void installGlobals(AjBuildConfig global) {
options.defaultEncoding = global.options.defaultEncoding;
join(aspectpath, global.aspectpath);
join(classpath, global.classpath);
if (null == configFile) {
configFile = global.configFile;
}
if (!isEmacsSymMode() && global.isEmacsSymMode()) {
setEmacsSymMode(true);
}
join(files, global.files);
join(xmlfiles, global.xmlfiles);
if (!isGenerateModelMode() && global.isGenerateModelMode()) {
setGenerateModelMode(true);
}
if (null == incrementalFile) {
incrementalFile = global.incrementalFile;
}
if (!incrementalMode && global.incrementalMode) {
incrementalMode = true;
}
if (isCheckRuntimeVersion() && !global.isCheckRuntimeVersion()) {
setCheckRuntimeVersion(false);
} |
Subsets and Splits