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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | il.append(InstructionFactory.createReturn(BcelWorld.makeBcelType(method.getReturnType())));
mg.getBody().insert(il);
gen.addMethodGen(mg);
}
protected LazyMethodGen makeMethodGen(LazyClassGen gen, ResolvedMember member) {
try {
Type returnType = BcelWorld.makeBcelType(member.getReturnType());
Type[] parameterTypes = BcelWorld.makeBcelTypes(member.getParameterTypes());
LazyMethodGen ret = new LazyMethodGen(member.getModifiers(), returnType,
member.getName(), parameterTypes, UnresolvedType.getNames(member
.getExceptions()), gen);
return ret;
} catch (ClassFormatException cfe) {
throw new RuntimeException("Problem with makeMethodGen for method "+member.getName()+" in type "+gen.getName()+" ret="+member.getReturnType(),cfe);
}
}
protected FieldGen makeFieldGen(LazyClassGen gen, ResolvedMember member) {
return new FieldGen(member.getModifiers(), BcelWorld.makeBcelType(member.getReturnType()), member.getName(),
gen.getConstantPool());
}
private boolean mungePerObjectInterface(BcelClassWeaver weaver, PerObjectInterfaceTypeMunger munger) {
LazyClassGen gen = weaver.getLazyClassGen();
if (couldMatch(gen.getBcelObjectType(), munger.getTestPointcut())) {
FieldGen fg = makeFieldGen(gen, AjcMemberMaker.perObjectField(gen.getType(), aspectType));
gen.addField(fg, getSourceLocation()); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | Type fieldType = BcelWorld.makeBcelType(aspectType);
LazyMethodGen mg = new LazyMethodGen(Modifier.PUBLIC, fieldType, NameMangler.perObjectInterfaceGet(aspectType),
new Type[0], new String[0], gen);
InstructionList il = new InstructionList();
InstructionFactory fact = gen.getFactory();
il.append(InstructionConstants.ALOAD_0);
il.append(fact.createFieldAccess(gen.getClassName(), fg.getName(), fieldType, Constants.GETFIELD));
il.append(InstructionFactory.createReturn(fieldType));
mg.getBody().insert(il);
gen.addMethodGen(mg);
LazyMethodGen mg1 = new LazyMethodGen(Modifier.PUBLIC, Type.VOID, NameMangler.perObjectInterfaceSet(aspectType),
new Type[] { fieldType, }, new String[0], gen);
InstructionList il1 = new InstructionList();
il1.append(InstructionConstants.ALOAD_0);
il1.append(InstructionFactory.createLoad(fieldType, 1));
il1.append(fact.createFieldAccess(gen.getClassName(), fg.getName(), fieldType, Constants.PUTFIELD));
il1.append(InstructionFactory.createReturn(Type.VOID));
mg1.getBody().insert(il1);
gen.addMethodGen(mg1);
gen.addInterface(munger.getInterfaceType().resolve(weaver.getWorld()), getSourceLocation());
return true;
} else {
return false;
}
}
private boolean mungePerTypeWithinTransformer(BcelClassWeaver weaver) {
LazyClassGen gen = weaver.getLazyClassGen(); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | FieldGen fg = makeFieldGen(gen, AjcMemberMaker.perTypeWithinField(gen.getType(), aspectType));
gen.addField(fg, getSourceLocation());
Type fieldType = BcelWorld.makeBcelType(aspectType);
LazyMethodGen mg = new LazyMethodGen(Modifier.PUBLIC | Modifier.STATIC, fieldType,
NameMangler.perTypeWithinLocalAspectOf(aspectType), new Type[0], new String[0], gen);
InstructionList il = new InstructionList();
InstructionFactory fact = gen.getFactory();
il.append(fact.createFieldAccess(gen.getClassName(), fg.getName(), fieldType, Constants.GETSTATIC));
il.append(InstructionFactory.createReturn(fieldType));
mg.getBody().insert(il);
gen.addMethodGen(mg);
return true;
}
private boolean couldMatch(BcelObjectType bcelObjectType, Pointcut pointcut) {
return !bcelObjectType.isInterface();
}
private boolean mungeNewMemberType(BcelClassWeaver classWeaver, NewMemberClassTypeMunger munger) {
World world = classWeaver.getWorld(); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | ResolvedType onType = world.resolve(munger.getTargetType());
if (onType.isRawType()) {
onType = onType.getGenericType();
}
return onType.equals(classWeaver.getLazyClassGen().getType());
}
private boolean mungeNewMethod(BcelClassWeaver classWeaver, NewMethodTypeMunger munger) {
World world = classWeaver.getWorld();
ResolvedMember unMangledInterMethod = munger.getSignature().resolve(world);
ResolvedMember interMethodBody = munger.getDeclaredInterMethodBody(aspectType, world);
ResolvedMember interMethodDispatcher = munger.getDeclaredInterMethodDispatcher(aspectType, world);
ResolvedMember memberHoldingAnyAnnotations = interMethodDispatcher;
LazyClassGen classGen = classWeaver.getLazyClassGen();
ResolvedType onType = world.resolve(unMangledInterMethod.getDeclaringType(), munger.getSourceLocation());
if (onType.isRawType()) {
onType = onType.getGenericType();
}
if (onType.isAnnotation()) {
signalError(WeaverMessages.ITDM_ON_ANNOTATION_NOT_ALLOWED, classWeaver, onType);
return false;
}
if (onType.isEnum()) {
signalError(WeaverMessages.ITDM_ON_ENUM_NOT_ALLOWED, classWeaver, onType);
return false;
}
boolean mungingInterface = classGen.isInterface();
boolean onInterface = onType.isInterface(); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | if (onInterface
&& classGen.getLazyMethodGen(unMangledInterMethod.getName(), unMangledInterMethod.getSignature(), true) != null) {
return false;
}
if (onType.equals(classGen.getType())) {
ResolvedMember mangledInterMethod = AjcMemberMaker.interMethod(unMangledInterMethod, aspectType, onInterface);
LazyMethodGen newMethod = makeMethodGen(classGen, mangledInterMethod);
if (mungingInterface) {
newMethod.setAccessFlags(Modifier.PUBLIC | Modifier.ABSTRACT);
}
if (classWeaver.getWorld().isInJava5Mode()) {
AnnotationAJ annotationsOnRealMember[] = null;
ResolvedType toLookOn = aspectType;
if (aspectType.isRawType()) {
toLookOn = aspectType.getGenericType();
}
ResolvedMember realMember = getRealMemberForITDFromAspect(toLookOn, memberHoldingAnyAnnotations, false);
if (realMember == null) { |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | } else {
annotationsOnRealMember = realMember.getAnnotations();
}
Set<ResolvedType> addedAnnotations = new HashSet<ResolvedType>();
if (annotationsOnRealMember != null) {
for (AnnotationAJ anno : annotationsOnRealMember) {
AnnotationGen a = ((BcelAnnotation) anno).getBcelAnnotation();
AnnotationGen ag = new AnnotationGen(a, classGen.getConstantPool(), true);
newMethod.addAnnotation(new BcelAnnotation(ag, classWeaver.getWorld()));
addedAnnotations.add(anno.getType());
}
}
if (realMember != null) {
copyOverParameterAnnotations(newMethod, realMember);
}
List<DeclareAnnotation> allDecams = world.getDeclareAnnotationOnMethods();
for (DeclareAnnotation declareAnnotationMC : allDecams) {
if (declareAnnotationMC.matches(unMangledInterMethod, world)) {
AnnotationAJ annotation = declareAnnotationMC.getAnnotation();
if (!addedAnnotations.contains(annotation.getType())) {
newMethod.addAnnotation(annotation);
}
}
} |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | }
if (!onInterface && !Modifier.isAbstract(mangledInterMethod.getModifiers())) {
InstructionList body = newMethod.getBody();
InstructionFactory fact = classGen.getFactory();
int pos = 0;
if (!Modifier.isStatic(unMangledInterMethod.getModifiers())) {
body.append(InstructionFactory.createThis());
pos++;
}
Type[] paramTypes = BcelWorld.makeBcelTypes(mangledInterMethod.getParameterTypes());
for (int i = 0, len = paramTypes.length; i < len; i++) {
Type paramType = paramTypes[i];
body.append(InstructionFactory.createLoad(paramType, pos));
pos += paramType.getSize();
}
body.append(Utility.createInvoke(fact, classWeaver.getWorld(), interMethodBody));
body.append(InstructionFactory.createReturn(BcelWorld.makeBcelType(mangledInterMethod.getReturnType())));
if (classWeaver.getWorld().isInJava5Mode()) {
createAnyBridgeMethodsForCovariance(classWeaver, munger, unMangledInterMethod, onType, classGen, paramTypes);
}
} else {
}
if (world.isInJava5Mode()) {
String basicSignature = mangledInterMethod.getSignature(); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | String genericSignature = ((ResolvedMemberImpl) mangledInterMethod).getSignatureForAttribute();
if (!basicSignature.equals(genericSignature)) {
newMethod.addAttribute(createSignatureAttribute(classGen.getConstantPool(), genericSignature));
}
}
classWeaver.addLazyMethodGen(newMethod);
classWeaver.getLazyClassGen().warnOnAddedMethod(newMethod.getMethod(), getSignature().getSourceLocation());
addNeededSuperCallMethods(classWeaver, onType, munger.getSuperMethodsCalled());
return true;
} else if (onInterface && !Modifier.isAbstract(unMangledInterMethod.getModifiers())) {
if (!classGen.getType().isTopmostImplementor(onType)) {
ResolvedType rtx = classGen.getType().getTopmostImplementor(onType);
if (rtx == null) {
ResolvedType rt = classGen.getType();
if (rt.isInterface()) {
ISourceLocation sloc = munger.getSourceLocation();
classWeaver
.getWorld()
.getMessageHandler()
.handleMessage(
MessageUtil.error(
"ITD target " |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | + rt.getName()
+ " is an interface but has been incorrectly determined to be the topmost implementor of "
+ onType.getName() + ". ITD is " + this.getSignature(), sloc));
}
if (!onType.isAssignableFrom(rt)) {
ISourceLocation sloc = munger.getSourceLocation();
classWeaver
.getWorld()
.getMessageHandler()
.handleMessage(
MessageUtil.error(
"ITD target " + rt.getName() + " doesn't appear to implement " + onType.getName()
+ " why did we consider it the top most implementor? ITD is "
+ this.getSignature(), sloc));
}
} else if (!rtx.isExposedToWeaver()) {
ISourceLocation sLoc = munger.getSourceLocation();
classWeaver
.getWorld()
.getMessageHandler()
.handleMessage(
MessageUtil.error(WeaverMessages.format(WeaverMessages.ITD_NON_EXPOSED_IMPLEMENTOR, rtx,
getAspectType().getName()), (sLoc == null ? getAspectType().getSourceLocation() : sLoc)));
} else {
}
return false; |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | } else {
ResolvedMember mangledInterMethod = AjcMemberMaker.interMethod(unMangledInterMethod, aspectType, false);
LazyMethodGen mg = makeMethodGen(classGen, mangledInterMethod);
if (classWeaver.getWorld().isInJava5Mode()) {
AnnotationAJ annotationsOnRealMember[] = null;
ResolvedType toLookOn = aspectType;
if (aspectType.isRawType()) {
toLookOn = aspectType.getGenericType();
}
ResolvedMember realMember = getRealMemberForITDFromAspect(toLookOn, memberHoldingAnyAnnotations, false);
if (realMember == null) {
throw new BCException("Couldn't find ITD holder member '" + memberHoldingAnyAnnotations + "' on aspect "
+ aspectType);
}
annotationsOnRealMember = realMember.getAnnotations();
if (annotationsOnRealMember != null) {
for (AnnotationAJ annotationX : annotationsOnRealMember) {
AnnotationGen a = ((BcelAnnotation) annotationX).getBcelAnnotation();
AnnotationGen ag = new AnnotationGen(a, classWeaver.getLazyClassGen().getConstantPool(), true);
mg.addAnnotation(new BcelAnnotation(ag, classWeaver.getWorld()));
}
}
copyOverParameterAnnotations(mg, realMember);
}
if (mungingInterface) { |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | mg.setAccessFlags(Modifier.PUBLIC | Modifier.ABSTRACT);
}
Type[] paramTypes = BcelWorld.makeBcelTypes(mangledInterMethod.getParameterTypes());
Type returnType = BcelWorld.makeBcelType(mangledInterMethod.getReturnType());
InstructionList body = mg.getBody();
InstructionFactory fact = classGen.getFactory();
int pos = 0;
if (!Modifier.isStatic(mangledInterMethod.getModifiers())) {
body.append(InstructionFactory.createThis());
pos++;
}
for (int i = 0, len = paramTypes.length; i < len; i++) {
Type paramType = paramTypes[i];
body.append(InstructionFactory.createLoad(paramType, pos));
pos += paramType.getSize();
}
body.append(Utility.createInvoke(fact, classWeaver.getWorld(), interMethodBody));
Type t = BcelWorld.makeBcelType(interMethodBody.getReturnType());
if (!t.equals(returnType)) {
body.append(fact.createCast(t, returnType));
}
body.append(InstructionFactory.createReturn(returnType));
mg.definingType = onType;
if (world.isInJava5Mode()) {
String basicSignature = mangledInterMethod.getSignature();
String genericSignature = ((ResolvedMemberImpl) mangledInterMethod).getSignatureForAttribute();
if (!basicSignature.equals(genericSignature)) {
mg.addAttribute(createSignatureAttribute(classGen.getConstantPool(), genericSignature));
} |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | }
classWeaver.addOrReplaceLazyMethodGen(mg);
addNeededSuperCallMethods(classWeaver, onType, munger.getSuperMethodsCalled());
createBridgeIfNecessary(classWeaver, munger, unMangledInterMethod, classGen);
return true;
}
} else {
return false;
}
}
private void createBridgeIfNecessary(BcelClassWeaver classWeaver, NewMethodTypeMunger munger,
ResolvedMember unMangledInterMethod, LazyClassGen classGen) {
if (munger.getDeclaredSignature() != null) {
boolean needsbridging = false;
ResolvedMember mungerSignature = munger.getSignature();
ResolvedMember toBridgeTo = munger.getDeclaredSignature().parameterizedWith(null,
mungerSignature.getDeclaringType().resolve(getWorld()), false, munger.getTypeVariableAliases());
if (!toBridgeTo.getReturnType().getErasureSignature().equals(mungerSignature.getReturnType().getErasureSignature())) {
needsbridging = true;
}
UnresolvedType[] originalParams = toBridgeTo.getParameterTypes();
UnresolvedType[] newParams = mungerSignature.getParameterTypes();
for (int ii = 0; ii < originalParams.length; ii++) {
if (!originalParams[ii].getErasureSignature().equals(newParams[ii].getErasureSignature())) {
needsbridging = true;
}
}
if (needsbridging) { |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | createBridge(classWeaver, unMangledInterMethod, classGen, toBridgeTo);
}
}
}
private void copyOverParameterAnnotations(LazyMethodGen receiverMethod, ResolvedMember donorMethod) {
AnnotationAJ[][] pAnnos = donorMethod.getParameterAnnotations();
if (pAnnos != null) {
int offset = receiverMethod.isStatic() ? 0 : 1;
int param = 0;
for (int i = offset; i < pAnnos.length; i++) {
AnnotationAJ[] annosOnParam = pAnnos[i];
if (annosOnParam != null) {
for (AnnotationAJ anno : annosOnParam) {
receiverMethod.addParameterAnnotation(param, anno);
}
}
param++;
}
}
}
private void createBridge(BcelClassWeaver weaver, ResolvedMember unMangledInterMethod, LazyClassGen classGen,
ResolvedMember toBridgeTo) {
Type[] paramTypes;
Type returnType;
InstructionList body;
InstructionFactory fact;
int pos;
ResolvedMember bridgerMethod = AjcMemberMaker.bridgerToInterMethod(unMangledInterMethod, classGen.getType());
ResolvedMember bridgingSetter = AjcMemberMaker.interMethodBridger(toBridgeTo, aspectType, false);
LazyMethodGen bridgeMethod = makeMethodGen(classGen, bridgingSetter); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | paramTypes = BcelWorld.makeBcelTypes(bridgingSetter.getParameterTypes());
Type[] bridgingToParms = BcelWorld.makeBcelTypes(unMangledInterMethod.getParameterTypes());
returnType = BcelWorld.makeBcelType(bridgingSetter.getReturnType());
body = bridgeMethod.getBody();
fact = classGen.getFactory();
pos = 0;
if (!Modifier.isStatic(bridgingSetter.getModifiers())) {
body.append(InstructionFactory.createThis());
pos++;
}
for (int i = 0, len = paramTypes.length; i < len; i++) {
Type paramType = paramTypes[i];
body.append(InstructionFactory.createLoad(paramType, pos));
if (!bridgingSetter.getParameterTypes()[i].getErasureSignature().equals(
unMangledInterMethod.getParameterTypes()[i].getErasureSignature())) {
body.append(fact.createCast(paramType, bridgingToParms[i]));
}
pos += paramType.getSize();
}
body.append(Utility.createInvoke(fact, weaver.getWorld(), bridgerMethod));
body.append(InstructionFactory.createReturn(returnType));
classGen.addMethodGen(bridgeMethod);
}
/**
* Helper method to create a signature attribute based on a string signature: e.g. "Ljava/lang/Object;LI<Ljava/lang/Double;>;"
*/
private Signature createSignatureAttribute(ConstantPool cp, String signature) { |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | int nameIndex = cp.addUtf8("Signature");
int sigIndex = cp.addUtf8(signature);
return new Signature(nameIndex, 2, sigIndex, cp);
}
/**
* Create any bridge method required because of covariant returns being used. This method is used in the case where an ITD is
* applied to some type and it may be in an override relationship with a method from the supertype - but due to covariance there
* is a mismatch in return values. Example of when required: Super defines: Object m(String s) Sub defines: String m(String s)
* then we need a bridge method in Sub called 'Object m(String s)' that forwards to 'String m(String s)'
*/
private void createAnyBridgeMethodsForCovariance(BcelClassWeaver weaver, NewMethodTypeMunger munger,
ResolvedMember unMangledInterMethod, ResolvedType onType, LazyClassGen gen, Type[] paramTypes) {
boolean quitRightNow = false;
String localMethodName = unMangledInterMethod.getName();
String erasedSig = unMangledInterMethod.getSignatureErased();
String localParameterSig = erasedSig.substring(0,erasedSig.lastIndexOf(')')+1);
String localReturnTypeESig = unMangledInterMethod.getReturnType().getErasureSignature();
boolean alreadyDone = false;
ResolvedMember[] localMethods = onType.getDeclaredMethods(); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | for (int i = 0; i < localMethods.length; i++) {
ResolvedMember member = localMethods[i];
if (member.getName().equals(localMethodName)) {
if (member.getParameterSignature().equals(localParameterSig)) {
alreadyDone = true;
}
}
}
if (!alreadyDone) {
ResolvedType supertype = onType.getSuperclass();
if (supertype != null) {
for (Iterator<ResolvedMember> iter = supertype.getMethods(true, true); iter.hasNext() && !quitRightNow;) {
ResolvedMember aMethod = iter.next();
if (aMethod.getName().equals(localMethodName) && aMethod.getParameterSignature().equals(localParameterSig)) {
if (!aMethod.getReturnType().getErasureSignature().equals(localReturnTypeESig)
&& !Modifier.isPrivate(aMethod.getModifiers())) {
createBridgeMethod(weaver.getWorld(), munger, unMangledInterMethod, gen, paramTypes, aMethod);
quitRightNow = true;
}
}
}
}
}
} |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | /**
* Create a bridge method for a particular munger.
*
* @param world
* @param munger
* @param unMangledInterMethod the method to bridge 'to' that we have already created in the 'subtype'
* @param clazz the class in which to put the bridge method
* @param paramTypes Parameter types for the bridge method, passed in as an optimization since the caller is likely to have
* already created them.
* @param theBridgeMethod
*/
private void createBridgeMethod(BcelWorld world, NewMethodTypeMunger munger, ResolvedMember unMangledInterMethod,
LazyClassGen clazz, Type[] paramTypes, ResolvedMember theBridgeMethod) {
InstructionList body;
InstructionFactory fact;
int pos = 0;
LazyMethodGen bridgeMethod = makeMethodGen(clazz, theBridgeMethod);
bridgeMethod.setAccessFlags(bridgeMethod.getAccessFlags() | 0x00000040 );
Type returnType = BcelWorld.makeBcelType(theBridgeMethod.getReturnType());
body = bridgeMethod.getBody();
fact = clazz.getFactory();
if (!Modifier.isStatic(unMangledInterMethod.getModifiers())) {
body.append(InstructionFactory.createThis());
pos++;
}
for (int i = 0, len = paramTypes.length; i < len; i++) {
Type paramType = paramTypes[i];
body.append(InstructionFactory.createLoad(paramType, pos)); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | pos += paramType.getSize();
}
body.append(Utility.createInvoke(fact, world, unMangledInterMethod));
body.append(InstructionFactory.createReturn(returnType));
clazz.addMethodGen(bridgeMethod);
}
private String stringifyMember(ResolvedMember member) {
StringBuffer buf = new StringBuffer();
buf.append(member.getReturnType().getName());
buf.append(' ');
buf.append(member.getName());
if (member.getKind() != Member.FIELD) {
buf.append("(");
UnresolvedType[] params = member.getParameterTypes();
if (params.length != 0) {
buf.append(params[0]);
for (int i = 1, len = params.length; i < len; i++) {
buf.append(", ");
buf.append(params[i].getName());
}
} |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | buf.append(")");
}
return buf.toString();
}
private boolean mungeMethodDelegate(BcelClassWeaver weaver, MethodDelegateTypeMunger munger) {
World world = weaver.getWorld();
LazyClassGen gen = weaver.getLazyClassGen();
if (gen.getType().isAnnotation() || gen.getType().isEnum()) {
return false;
}
ResolvedMember introduced = munger.getSignature();
ResolvedType fromType = world.resolve(introduced.getDeclaringType(), munger.getSourceLocation());
if (fromType.isRawType()) {
fromType = fromType.getGenericType();
}
boolean shouldApply = munger.matches(weaver.getLazyClassGen().getType(), aspectType);
if (shouldApply) {
Type bcelReturnType = BcelWorld.makeBcelType(introduced.getReturnType());
if (munger.getImplClassName() == null && !munger.specifiesDelegateFactoryMethod()) {
boolean isOK = false;
List<LazyMethodGen> existingMethods = gen.getMethodGens();
for (LazyMethodGen m : existingMethods) {
if (m.getName().equals(introduced.getName())
&& m.getParameterSignature().equals(introduced.getParameterSignature())
&& m.getReturnType().equals(bcelReturnType)) {
isOK = true; |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | }
}
if (!isOK) {
IMessage msg = new Message("@DeclareParents: No defaultImpl was specified but the type '" + gen.getName()
+ "' does not implement the method '" + stringifyMember(introduced) + "' defined on the interface '"
+ introduced.getDeclaringType() + "'", weaver.getLazyClassGen().getType().getSourceLocation(), true,
new ISourceLocation[] { munger.getSourceLocation() });
weaver.getWorld().getMessageHandler().handleMessage(msg);
return false;
}
return true;
}
LazyMethodGen mg = new LazyMethodGen(introduced.getModifiers() - Modifier.ABSTRACT, bcelReturnType,
introduced.getName(), BcelWorld.makeBcelTypes(introduced.getParameterTypes()),
BcelWorld.makeBcelTypesAsClassNames(introduced.getExceptions()), gen);
if (weaver.getWorld().isInJava5Mode()) {
AnnotationAJ annotationsOnRealMember[] = null;
ResolvedType toLookOn = weaver.getWorld().lookupOrCreateName(introduced.getDeclaringType());
if (fromType.isRawType()) {
toLookOn = fromType.getGenericType();
}
ResolvedMember[] ms = toLookOn.getDeclaredJavaMethods();
for (ResolvedMember m : ms) {
if (introduced.getName().equals(m.getName()) && introduced.getSignature().equals(m.getSignature())) {
annotationsOnRealMember = m.getAnnotations();
break; |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | }
}
if (annotationsOnRealMember != null) {
for (AnnotationAJ anno : annotationsOnRealMember) {
AnnotationGen a = ((BcelAnnotation) anno).getBcelAnnotation();
AnnotationGen ag = new AnnotationGen(a, weaver.getLazyClassGen().getConstantPool(), true);
mg.addAnnotation(new BcelAnnotation(ag, weaver.getWorld()));
}
}
}
InstructionList body = new InstructionList();
InstructionFactory fact = gen.getFactory();
body.append(InstructionConstants.ALOAD_0);
body.append(Utility.createGet(fact, munger.getDelegate(weaver.getLazyClassGen().getType())));
InstructionBranch ifNonNull = InstructionFactory.createBranchInstruction(Constants.IFNONNULL, null);
body.append(ifNonNull);
body.append(InstructionConstants.ALOAD_0);
if (munger.specifiesDelegateFactoryMethod()) {
ResolvedMember rm = munger.getDelegateFactoryMethod(weaver.getWorld());
if (rm.getArity() != 0) {
ResolvedType parameterType = rm.getParameterTypes()[0].resolve(weaver.getWorld());
if (!parameterType.isAssignableFrom(weaver.getLazyClassGen().getType())) {
signalError("For mixin factory method '" + rm + "': Instance type '" + weaver.getLazyClassGen().getType()
+ "' is not compatible with factory parameter type '" + parameterType + "'", weaver); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | return false;
}
}
if (Modifier.isStatic(rm.getModifiers())) {
if (rm.getArity() != 0) {
body.append(InstructionConstants.ALOAD_0);
}
body.append(fact.createInvoke(rm.getDeclaringType().getName(), rm.getName(), rm.getSignature(),
Constants.INVOKESTATIC));
body.append(Utility.createSet(fact, munger.getDelegate(weaver.getLazyClassGen().getType())));
} else {
UnresolvedType theAspect = munger.getAspect();
body.append(fact.createInvoke(theAspect.getName(), "aspectOf", "()" + theAspect.getSignature(),
Constants.INVOKESTATIC));
if (rm.getArity() != 0) {
body.append(InstructionConstants.ALOAD_0);
}
body.append(fact.createInvoke(rm.getDeclaringType().getName(), rm.getName(), rm.getSignature(),
Constants.INVOKEVIRTUAL));
body.append(Utility.createSet(fact, munger.getDelegate(weaver.getLazyClassGen().getType())));
}
} else {
body.append(fact.createNew(munger.getImplClassName()));
body.append(InstructionConstants.DUP);
body.append(fact.createInvoke(munger.getImplClassName(), "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
body.append(Utility.createSet(fact, munger.getDelegate(weaver.getLazyClassGen().getType())));
}
InstructionHandle ifNonNullElse = body.append(InstructionConstants.ALOAD_0); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | ifNonNull.setTarget(ifNonNullElse);
body.append(Utility.createGet(fact, munger.getDelegate(weaver.getLazyClassGen().getType())));
int pos = 0;
if (!Modifier.isStatic(introduced.getModifiers())) {
pos++;
}
Type[] paramTypes = BcelWorld.makeBcelTypes(introduced.getParameterTypes());
for (int i = 0, len = paramTypes.length; i < len; i++) {
Type paramType = paramTypes[i];
body.append(InstructionFactory.createLoad(paramType, pos));
pos += paramType.getSize();
}
body.append(Utility.createInvoke(fact, Constants.INVOKEINTERFACE, introduced));
body.append(InstructionFactory.createReturn(bcelReturnType));
mg.getBody().append(body);
weaver.addLazyMethodGen(mg);
weaver.getLazyClassGen().warnOnAddedMethod(mg.getMethod(), getSignature().getSourceLocation());
return true;
}
return false;
}
private boolean mungeFieldHost(BcelClassWeaver weaver, MethodDelegateTypeMunger.FieldHostTypeMunger munger) {
LazyClassGen gen = weaver.getLazyClassGen();
if (gen.getType().isAnnotation() || gen.getType().isEnum()) {
return false; |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | }
munger.matches(weaver.getLazyClassGen().getType(), aspectType);
ResolvedMember host = AjcMemberMaker.itdAtDeclareParentsField(weaver.getLazyClassGen().getType(), munger.getSignature()
.getType(), aspectType);
FieldGen field = makeFieldGen(weaver.getLazyClassGen(), host);
field.setModifiers(field.getModifiers() | BcelField.AccSynthetic);
weaver.getLazyClassGen().addField(field, null);
return true;
}
private ResolvedMember getRealMemberForITDFromAspect(ResolvedType aspectType, ResolvedMember lookingFor, boolean isCtorRelated) {
World world = aspectType.getWorld();
boolean debug = false;
if (debug) {
System.err.println("Searching for a member on type: " + aspectType);
System.err.println("Member we are looking for: " + lookingFor);
}
ResolvedMember aspectMethods[] = aspectType.getDeclaredMethods();
UnresolvedType[] lookingForParams = lookingFor.getParameterTypes();
ResolvedMember realMember = null;
for (int i = 0; realMember == null && i < aspectMethods.length; i++) {
ResolvedMember member = aspectMethods[i];
if (member.getName().equals(lookingFor.getName())) {
UnresolvedType[] memberParams = member.getGenericParameterTypes();
if (memberParams.length == lookingForParams.length) {
if (debug) {
System.err.println("Reviewing potential candidates: " + member);
} |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | boolean matchOK = true;
if (isCtorRelated) {
for (int j = 0; j < memberParams.length && matchOK; j++) {
ResolvedType pMember = memberParams[j].resolve(world);
ResolvedType pLookingFor = lookingForParams[j].resolve(world);
if (pMember.isTypeVariableReference()) {
pMember = ((TypeVariableReference) pMember).getTypeVariable().getFirstBound().resolve(world);
}
if (pMember.isParameterizedType() || pMember.isGenericType()) {
pMember = pMember.getRawType().resolve(aspectType.getWorld());
}
if (pLookingFor.isTypeVariableReference()) {
pLookingFor = ((TypeVariableReference) pLookingFor).getTypeVariable().getFirstBound()
.resolve(world);
}
if (pLookingFor.isParameterizedType() || pLookingFor.isGenericType()) {
pLookingFor = pLookingFor.getRawType().resolve(world);
}
if (debug) {
System.err.println("Comparing parameter " + j + " member=" + pMember + " lookingFor="
+ pLookingFor);
}
if (!pMember.equals(pLookingFor)) {
matchOK = false;
} |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | }
}
if (matchOK) {
realMember = member;
}
}
}
}
if (debug && realMember == null) {
System.err.println("Didn't find a match");
}
return realMember;
}
private void addNeededSuperCallMethods(BcelClassWeaver weaver, ResolvedType onType, Set<ResolvedMember> neededSuperCalls) {
LazyClassGen gen = weaver.getLazyClassGen();
for (Iterator<ResolvedMember> iter = neededSuperCalls.iterator(); iter.hasNext();) {
ResolvedMember superMethod = iter.next();
if (weaver.addDispatchTarget(superMethod)) {
boolean isSuper = !superMethod.getDeclaringType().equals(gen.getType());
String dispatchName;
if (isSuper) {
dispatchName = NameMangler.superDispatchMethod(onType, superMethod.getName());
} else {
dispatchName = NameMangler.protectedDispatchMethod(onType, superMethod.getName());
}
superMethod = superMethod.resolve(weaver.getWorld());
LazyMethodGen dispatcher = makeDispatcher(gen, dispatchName, superMethod, weaver.getWorld(), isSuper);
weaver.addLazyMethodGen(dispatcher); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | }
}
}
private void signalError(String msgid, BcelClassWeaver weaver, UnresolvedType onType) {
IMessage msg = MessageUtil.error(WeaverMessages.format(msgid, onType.getName()), getSourceLocation());
weaver.getWorld().getMessageHandler().handleMessage(msg);
}
private void signalError(String msgString, BcelClassWeaver weaver) {
IMessage msg = MessageUtil.error(msgString, getSourceLocation());
weaver.getWorld().getMessageHandler().handleMessage(msg);
}
private boolean mungeNewConstructor(BcelClassWeaver weaver, NewConstructorTypeMunger newConstructorTypeMunger) {
final LazyClassGen currentClass = weaver.getLazyClassGen();
final InstructionFactory fact = currentClass.getFactory();
ResolvedMember newConstructorMember = newConstructorTypeMunger.getSyntheticConstructor();
ResolvedType onType = newConstructorMember.getDeclaringType().resolve(weaver.getWorld());
if (onType.isRawType()) {
onType = onType.getGenericType();
}
if (onType.isAnnotation()) {
signalError(WeaverMessages.ITDC_ON_ANNOTATION_NOT_ALLOWED, weaver, onType);
return false;
}
if (onType.isEnum()) {
signalError(WeaverMessages.ITDC_ON_ENUM_NOT_ALLOWED, weaver, onType);
return false; |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | }
if (!onType.equals(currentClass.getType())) {
return false;
}
ResolvedMember explicitConstructor = newConstructorTypeMunger.getExplicitConstructor();
LazyMethodGen mg = makeMethodGen(currentClass, newConstructorMember);
mg.setEffectiveSignature(newConstructorTypeMunger.getSignature(), Shadow.ConstructorExecution, true);
if (weaver.getWorld().isInJava5Mode()) {
ResolvedMember interMethodDispatcher = AjcMemberMaker.postIntroducedConstructor(aspectType, onType,
newConstructorTypeMunger.getSignature().getParameterTypes());
AnnotationAJ annotationsOnRealMember[] = null;
ResolvedMember realMember = getRealMemberForITDFromAspect(aspectType, interMethodDispatcher, true);
if (realMember == null) {
} else {
annotationsOnRealMember = realMember.getAnnotations();
}
if (annotationsOnRealMember != null) {
for (int i = 0; i < annotationsOnRealMember.length; i++) {
AnnotationAJ annotationX = annotationsOnRealMember[i];
AnnotationGen a = ((BcelAnnotation) annotationX).getBcelAnnotation();
AnnotationGen ag = new AnnotationGen(a, weaver.getLazyClassGen().getConstantPool(), true); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | mg.addAnnotation(new BcelAnnotation(ag, weaver.getWorld()));
}
}
List<DeclareAnnotation> allDecams = weaver.getWorld().getDeclareAnnotationOnMethods();
for (Iterator<DeclareAnnotation> i = allDecams.iterator(); i.hasNext();) {
DeclareAnnotation decaMC = i.next();
if (decaMC.matches(explicitConstructor, weaver.getWorld()) && mg.getEnclosingClass().getType() == aspectType) {
mg.addAnnotation(decaMC.getAnnotation());
}
}
}
if (mg.getArgumentTypes().length == 0) {
LazyMethodGen toRemove = null;
for (LazyMethodGen object : currentClass.getMethodGens()) {
if (object.getName().equals("<init>") && object.getArgumentTypes().length == 0) {
toRemove = object;
}
}
if (toRemove != null) {
currentClass.removeMethodGen(toRemove);
}
}
currentClass.addMethodGen(mg);
InstructionList body = mg.getBody(); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | UnresolvedType[] declaredParams = newConstructorTypeMunger.getSignature().getParameterTypes();
Type[] paramTypes = mg.getArgumentTypes();
int frameIndex = 1;
for (int i = 0, len = declaredParams.length; i < len; i++) {
body.append(InstructionFactory.createLoad(paramTypes[i], frameIndex));
frameIndex += paramTypes[i].getSize();
}
Member preMethod = AjcMemberMaker.preIntroducedConstructor(aspectType, onType, declaredParams);
body.append(Utility.createInvoke(fact, null, preMethod));
int arraySlot = mg.allocateLocal(1);
body.append(InstructionFactory.createStore(Type.OBJECT, arraySlot));
body.append(InstructionConstants.ALOAD_0);
UnresolvedType[] superParamTypes = explicitConstructor.getParameterTypes();
for (int i = 0, len = superParamTypes.length; i < len; i++) {
body.append(InstructionFactory.createLoad(Type.OBJECT, arraySlot));
body.append(Utility.createConstant(fact, i));
body.append(InstructionFactory.createArrayLoad(Type.OBJECT));
body.append(Utility.createConversion(fact, Type.OBJECT, BcelWorld.makeBcelType(superParamTypes[i])));
}
body.append(Utility.createInvoke(fact, null, explicitConstructor));
body.append(InstructionConstants.ALOAD_0); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | Member postMethod = AjcMemberMaker.postIntroducedConstructor(aspectType, onType, declaredParams);
UnresolvedType[] postParamTypes = postMethod.getParameterTypes();
for (int i = 1, len = postParamTypes.length; i < len; i++) {
body.append(InstructionFactory.createLoad(Type.OBJECT, arraySlot));
body.append(Utility.createConstant(fact, superParamTypes.length + i - 1));
body.append(InstructionFactory.createArrayLoad(Type.OBJECT));
body.append(Utility.createConversion(fact, Type.OBJECT, BcelWorld.makeBcelType(postParamTypes[i])));
}
body.append(Utility.createInvoke(fact, null, postMethod));
body.append(InstructionConstants.RETURN);
return true;
}
private static LazyMethodGen makeDispatcher(LazyClassGen onGen, String dispatchName, ResolvedMember superMethod,
BcelWorld world, boolean isSuper) {
Type[] paramTypes = BcelWorld.makeBcelTypes(superMethod.getParameterTypes());
Type returnType = BcelWorld.makeBcelType(superMethod.getReturnType());
int modifiers = Modifier.PUBLIC;
if (onGen.isInterface()) {
modifiers |= Modifier.ABSTRACT;
}
LazyMethodGen mg = new LazyMethodGen(modifiers, returnType, dispatchName, paramTypes, UnresolvedType.getNames(superMethod
.getExceptions()), onGen);
InstructionList body = mg.getBody();
if (onGen.isInterface()) {
return mg;
} |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | InstructionFactory fact = onGen.getFactory();
int pos = 0;
body.append(InstructionFactory.createThis());
pos++;
for (int i = 0, len = paramTypes.length; i < len; i++) {
Type paramType = paramTypes[i];
body.append(InstructionFactory.createLoad(paramType, pos));
pos += paramType.getSize();
}
if (isSuper) {
body.append(Utility.createSuperInvoke(fact, world, superMethod));
} else {
body.append(Utility.createInvoke(fact, world, superMethod));
}
body.append(InstructionFactory.createReturn(returnType));
return mg;
}
private boolean mungeNewField(BcelClassWeaver weaver, NewFieldTypeMunger munger) {
munger.getInitMethod(aspectType);
LazyClassGen gen = weaver.getLazyClassGen();
ResolvedMember field = munger.getSignature();
ResolvedType onType = weaver.getWorld().resolve(field.getDeclaringType(), munger.getSourceLocation());
if (onType.isRawType()) {
onType = onType.getGenericType();
}
boolean onInterface = onType.isInterface();
if (onType.isAnnotation()) {
signalError(WeaverMessages.ITDF_ON_ANNOTATION_NOT_ALLOWED, weaver, onType);
return false;
} |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | if (onType.isEnum()) {
signalError(WeaverMessages.ITDF_ON_ENUM_NOT_ALLOWED, weaver, onType);
return false;
}
ResolvedMember interMethodBody = munger.getInitMethod(aspectType);
AnnotationAJ annotationsOnRealMember[] = null;
if (weaver.getWorld().isInJava5Mode()) {
ResolvedType toLookOn = aspectType;
if (aspectType.isRawType()) {
toLookOn = aspectType.getGenericType();
}
ResolvedMember realMember = getRealMemberForITDFromAspect(toLookOn, interMethodBody, false);
if (realMember == null) {
} else {
annotationsOnRealMember = realMember.getAnnotations();
}
}
if (onType.equals(gen.getType())) {
if (onInterface) {
ResolvedMember itdfieldGetter = AjcMemberMaker.interFieldInterfaceGetter(field, onType, aspectType);
LazyMethodGen mg = makeMethodGen(gen, itdfieldGetter);
gen.addMethodGen(mg); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | LazyMethodGen mg1 = makeMethodGen(gen, AjcMemberMaker.interFieldInterfaceSetter(field, onType, aspectType));
gen.addMethodGen(mg1);
} else {
weaver.addInitializer(this);
ResolvedMember newField = AjcMemberMaker.interFieldClassField(field, aspectType,
munger.version == NewFieldTypeMunger.VersionTwo);
FieldGen fg = makeFieldGen(gen, newField);
if (annotationsOnRealMember != null) {
for (int i = 0; i < annotationsOnRealMember.length; i++) {
AnnotationAJ annotationX = annotationsOnRealMember[i];
AnnotationGen a = ((BcelAnnotation) annotationX).getBcelAnnotation();
AnnotationGen ag = new AnnotationGen(a, weaver.getLazyClassGen().getConstantPool(), true);
fg.addAnnotation(ag);
}
}
if (weaver.getWorld().isInJava5Mode()) {
String basicSignature = field.getSignature();
String genericSignature = field.getReturnType().resolve(weaver.getWorld()).getSignatureForAttribute();
if (!basicSignature.equals(genericSignature)) {
fg.addAttribute(createSignatureAttribute(gen.getConstantPool(), genericSignature));
}
}
gen.addField(fg, getSourceLocation());
}
return true;
} else if (onInterface && gen.getType().isTopmostImplementor(onType)) { |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | if (Modifier.isStatic(field.getModifiers())) {
throw new RuntimeException("unimplemented");
}
boolean alreadyExists = false;
if (munger.version==NewFieldTypeMunger.VersionTwo) {
for (BcelField fieldgen: gen.getFieldGens()) {
if (fieldgen.getName().equals(field.getName())) {
alreadyExists=true;
break;
}
}
}
ResolvedMember newField = AjcMemberMaker.interFieldInterfaceField(field, onType, aspectType, munger.version == NewFieldTypeMunger.VersionTwo);
String fieldName = newField.getName();
Type fieldType = BcelWorld.makeBcelType(field.getType());
if (!alreadyExists) {
weaver.addInitializer(this);
FieldGen fg = makeFieldGen(gen,newField);
if (annotationsOnRealMember != null) {
for (int i = 0; i < annotationsOnRealMember.length; i++) {
AnnotationAJ annotationX = annotationsOnRealMember[i];
AnnotationGen a = ((BcelAnnotation) annotationX).getBcelAnnotation();
AnnotationGen ag = new AnnotationGen(a, weaver.getLazyClassGen().getConstantPool(), true);
fg.addAnnotation(ag);
} |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | }
if (weaver.getWorld().isInJava5Mode()) {
String basicSignature = field.getSignature();
String genericSignature = field.getReturnType().resolve(weaver.getWorld()).getSignatureForAttribute();
if (!basicSignature.equals(genericSignature)) {
fg.addAttribute(createSignatureAttribute(gen.getConstantPool(), genericSignature));
}
}
gen.addField(fg, getSourceLocation());
}
ResolvedMember itdfieldGetter = AjcMemberMaker.interFieldInterfaceGetter(field, gen.getType(), aspectType);
LazyMethodGen mg = makeMethodGen(gen, itdfieldGetter);
InstructionList il = new InstructionList();
InstructionFactory fact = gen.getFactory();
if (Modifier.isStatic(field.getModifiers())) {
il.append(fact.createFieldAccess(gen.getClassName(), fieldName, fieldType, Constants.GETSTATIC));
} else {
il.append(InstructionConstants.ALOAD_0);
il.append(fact.createFieldAccess(gen.getClassName(), fieldName, fieldType, Constants.GETFIELD));
}
il.append(InstructionFactory.createReturn(fieldType));
mg.getBody().insert(il);
gen.addMethodGen(mg); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | if (munger.getDeclaredSignature() != null) {
ResolvedMember toBridgeTo = munger.getDeclaredSignature().parameterizedWith(null,
munger.getSignature().getDeclaringType().resolve(getWorld()), false, munger.getTypeVariableAliases());
boolean needsbridging = false;
if (!toBridgeTo.getReturnType().getErasureSignature()
.equals(munger.getSignature().getReturnType().getErasureSignature())) {
needsbridging = true;
}
if (needsbridging) {
ResolvedMember bridgingGetter = AjcMemberMaker.interFieldInterfaceGetter(toBridgeTo, gen.getType(), aspectType);
createBridgeMethodForITDF(weaver, gen, itdfieldGetter, bridgingGetter);
}
}
ResolvedMember itdfieldSetter = AjcMemberMaker.interFieldInterfaceSetter(field, gen.getType(), aspectType);
LazyMethodGen mg1 = makeMethodGen(gen, itdfieldSetter);
InstructionList il1 = new InstructionList();
if (Modifier.isStatic(field.getModifiers())) {
il1.append(InstructionFactory.createLoad(fieldType, 0));
il1.append(fact.createFieldAccess(gen.getClassName(), fieldName, fieldType, Constants.PUTSTATIC));
} else {
il1.append(InstructionConstants.ALOAD_0);
il1.append(InstructionFactory.createLoad(fieldType, 1));
il1.append(fact.createFieldAccess(gen.getClassName(), fieldName, fieldType, Constants.PUTFIELD));
}
il1.append(InstructionFactory.createReturn(Type.VOID));
mg1.getBody().insert(il1);
gen.addMethodGen(mg1); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | if (munger.getDeclaredSignature() != null) {
ResolvedMember toBridgeTo = munger.getDeclaredSignature().parameterizedWith(null,
munger.getSignature().getDeclaringType().resolve(getWorld()), false, munger.getTypeVariableAliases());
boolean needsbridging = false;
if (!toBridgeTo.getReturnType().getErasureSignature()
.equals(munger.getSignature().getReturnType().getErasureSignature())) {
needsbridging = true;
}
if (needsbridging) {
ResolvedMember bridgingSetter = AjcMemberMaker.interFieldInterfaceSetter(toBridgeTo, gen.getType(), aspectType);
createBridgeMethodForITDF(weaver, gen, itdfieldSetter, bridgingSetter);
}
}
return true;
} else {
return false;
}
}
private void createBridgeMethodForITDF(BcelClassWeaver weaver, LazyClassGen gen, ResolvedMember itdfieldSetter,
ResolvedMember bridgingSetter) {
InstructionFactory fact;
LazyMethodGen bridgeMethod = makeMethodGen(gen, bridgingSetter);
bridgeMethod.setAccessFlags(bridgeMethod.getAccessFlags() | 0x00000040);
Type[] paramTypes = BcelWorld.makeBcelTypes(bridgingSetter.getParameterTypes());
Type[] bridgingToParms = BcelWorld.makeBcelTypes(itdfieldSetter.getParameterTypes());
Type returnType = BcelWorld.makeBcelType(bridgingSetter.getReturnType());
InstructionList body = bridgeMethod.getBody();
fact = gen.getFactory(); |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | int pos = 0;
if (!Modifier.isStatic(bridgingSetter.getModifiers())) {
body.append(InstructionFactory.createThis());
pos++;
}
for (int i = 0, len = paramTypes.length; i < len; i++) {
Type paramType = paramTypes[i];
body.append(InstructionFactory.createLoad(paramType, pos));
if (!bridgingSetter.getParameterTypes()[i].getErasureSignature().equals(
itdfieldSetter.getParameterTypes()[i].getErasureSignature())) {
body.append(fact.createCast(paramType, bridgingToParms[i]));
}
pos += paramType.getSize();
}
body.append(Utility.createInvoke(fact, weaver.getWorld(), itdfieldSetter));
body.append(InstructionFactory.createReturn(returnType));
gen.addMethodGen(bridgeMethod);
}
@Override
public ConcreteTypeMunger parameterizedFor(ResolvedType target) {
return new BcelTypeMunger(munger.parameterizedFor(target), aspectType);
}
@Override
public ConcreteTypeMunger parameterizeWith(Map<String, UnresolvedType> m, World w) {
return new BcelTypeMunger(munger.parameterizeWith(m, w), aspectType);
}
/**
* Returns a list of type variable aliases used in this munger. For example, if the ITD is 'int I<A,B>.m(List<A> las,List<B>
* lbs) {}' then this returns a list containing the strings "A" and "B".
*/ |
413,378 | Bug 413378 A constructor added by ITD cannot invoke the method of its super class | AspectJ Development Tools 2.2.0.e37x-RELEASE-20120704-0900 It seems *super.someMethod()* can not be correctly resolved in the constructor added by ITD It can be compiled with no problem, but* at runtime, exception is raised.* The class which I'll add a new constructor to: public class Child extends Parent{ public String mParent = "John"; public Child(String parent) { this.mParent = parent; } public String getParent() { return this.mParent; } } As we can see, *Child * extends *Parent* class Parent has a method getAge() public class Parent { private String mName = "John"; private int mAge = 50; public int getAge(){ return mAge; } } If I add a new constructor for the *Child * in my aspect. public aspect MyTest { public Child.new(String parent, int age) { this(parent); System.out.println("Get Age:" + super.getAge()); System.out.println("Child Name:" + this.mParent); } } The above aspect code will trigger an exception. Exception in thread "main" java.lang.NoSuchMethodError: com.test.Child.ajc$superDispatch$com_test_Child$getAge()I at MyTest.ajc$postInterConstructor$MyTest$com_test_Child(MyTest.aj:13) at com.test.Child.<init>(Child.java:1) at MainProgram.main(MainProgram.java:14) Is this a limitation of AspectJ? Is this the only way to resolve this issue? I also attach the src & compiled binary files | resolved fixed | 302c14e | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-22T21:50:14Z" | "2013-07-20T06:00:00Z" | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | public List<String> getTypeVariableAliases() {
return munger.getTypeVariableAliases();
}
@Override
public boolean equals(Object other) {
if (!(other instanceof BcelTypeMunger)) {
return false;
}
BcelTypeMunger o = (BcelTypeMunger) other;
return ((o.getMunger() == null) ? (getMunger() == null) : o.getMunger().equals(getMunger()))
&& ((o.getAspectType() == null) ? (getAspectType() == null) : o.getAspectType().equals(getAspectType()));
}
private volatile int hashCode = 0;
@Override
public int hashCode() {
if (hashCode == 0) {
int result = 17;
result = 37 * result + ((getMunger() == null) ? 0 : getMunger().hashCode());
result = 37 * result + ((getAspectType() == null) ? 0 : getAspectType().hashCode());
hashCode = result;
}
return hashCode;
}
} |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13: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 |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | * 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.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
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;
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 { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | 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
*/
public void initialize() {
}
private final static String deleLoader = "sun.reflect.DelegatingClassLoader";
/**
* Weave
* |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | * @param className
* @param bytes
* @param loader
* @return weaved 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 (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) {
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 { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | 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);
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 |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | * 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;
}
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;
} |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | }
/**
* 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();) {
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 { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | 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;
}
/**
* @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) { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Aj.java | Object o = adaptorQueue.poll();
while (o != null) {
AdaptorKey wo = (AdaptorKey) o;
WeaverContainer.weavingAdaptors.remove(wo);
o = adaptorQueue.poll();
}
}
}
static {
new ExplicitlyInitializedClassLoaderWeavingAdaptor(new ClassLoaderWeavingAdaptor());
}
/**
* 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); |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13: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) { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13: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();
}
} |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.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
* David Knibb weaving context enhancments
* John Kew (vmware) caching hook
*******************************************************************************/
package org.aspectj.weaver.loadtime;
import java.io.*;
import java.lang.reflect.InvocationTargetException; |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.ProtectionDomain;
import java.util.*;
import org.aspectj.bridge.AbortException;
import org.aspectj.bridge.Constants;
import org.aspectj.util.LangUtil;
import org.aspectj.weaver.Lint;
import org.aspectj.weaver.Lint.Kind;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.World;
import org.aspectj.weaver.bcel.BcelWeakClassLoaderReference;
import org.aspectj.weaver.bcel.BcelWeaver;
import org.aspectj.weaver.bcel.BcelWorld;
import org.aspectj.weaver.bcel.Utility;
import org.aspectj.weaver.loadtime.definition.Definition;
import org.aspectj.weaver.loadtime.definition.DocumentParser;
import org.aspectj.weaver.ltw.LTWWorld;
import org.aspectj.weaver.patterns.PatternParser;
import org.aspectj.weaver.patterns.TypePattern;
import org.aspectj.weaver.tools.*;
import org.aspectj.weaver.tools.cache.WeavedClassCache;
/**
* @author Alexandre Vasseur
* @author Andy Clement
* @author Abraham Nevado
*/
public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | private final static String AOP_XML = Constants.AOP_USER_XML + ";" + Constants.AOP_AJC_XML + ";" + Constants.AOP_OSGI_XML;
private boolean initialized;
private List m_dumpTypePattern = new ArrayList();
private boolean m_dumpBefore = false;
private boolean dumpDirPerClassloader = false;
private boolean hasExcludes = false;
private List<TypePattern> excludeTypePattern = new ArrayList<TypePattern>();
private List<String> excludeStartsWith = new ArrayList<String>();
private List<String> excludeStarDotDotStar = new ArrayList<String>();
private List<String> excludeExactName = new ArrayList<String>();
private List<String> excludeEndsWith = new ArrayList<String>();
private List<String[]> excludeSpecial = new ArrayList<String[]>();
private boolean hasIncludes = false;
private List<TypePattern> includeTypePattern = new ArrayList<TypePattern>();
private List<String> m_includeStartsWith = new ArrayList<String>();
private List<String> includeExactName = new ArrayList<String>();
private boolean includeStar = false;
private List<TypePattern> m_aspectExcludeTypePattern = new ArrayList<TypePattern>();
private List<String> m_aspectExcludeStartsWith = new ArrayList<String>();
private List<TypePattern> m_aspectIncludeTypePattern = new ArrayList<TypePattern>();
private List<String> m_aspectIncludeStartsWith = new ArrayList<String>();
private StringBuffer namespace;
private IWeavingContext weavingContext;
private List<ConcreteAspectCodeGen> concreteAspects = new ArrayList<ConcreteAspectCodeGen>();
private static Trace trace = TraceFactory.getTraceFactory().getTrace(ClassLoaderWeavingAdaptor.class);
public ClassLoaderWeavingAdaptor() {
super();
if (trace.isTraceEnabled()) {
trace.enter("<init>", this);
} |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | if (trace.isTraceEnabled()) {
trace.exit("<init>");
}
}
/**
* We don't need a reference to the class loader and using it during construction can cause problems with recursion. It also
* makes sense to supply the weaving context during initialization to.
*
* @deprecated
*/
public ClassLoaderWeavingAdaptor(final ClassLoader deprecatedLoader, final IWeavingContext deprecatedContext) {
super();
if (trace.isTraceEnabled()) {
trace.enter("<init>", this, new Object[] { deprecatedLoader, deprecatedContext });
}
if (trace.isTraceEnabled()) {
trace.exit("<init>");
}
}
class SimpleGeneratedClassHandler implements GeneratedClassHandler {
private BcelWeakClassLoaderReference loaderRef;
SimpleGeneratedClassHandler(ClassLoader loader) {
loaderRef = new BcelWeakClassLoaderReference(loader);
}
/**
* Callback when we need to define a Closure in the JVM
*
*/
public void acceptClass (String name, byte[] originalBytes, byte[] wovenBytes) {
try { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | if (shouldDump(name.replace('/', '.'), false)) {
dump(name, wovenBytes, false);
}
} catch (Throwable throwable) {
throwable.printStackTrace();
}
if (activeProtectionDomain != null) {
defineClass(loaderRef.getClassLoader(), name, wovenBytes, activeProtectionDomain);
} else {
defineClass(loaderRef.getClassLoader(), name, wovenBytes);
}
}
}
public void initialize(final ClassLoader classLoader, IWeavingContext context) {
if (initialized) {
return;
}
boolean success = true;
this.weavingContext = context;
if (weavingContext == null) {
weavingContext = new DefaultWeavingContext(classLoader);
}
createMessageHandler();
this.generatedClassHandler = new SimpleGeneratedClassHandler(classLoader);
List definitions = weavingContext.getDefinitions(classLoader, this);
if (definitions.isEmpty()) {
disable();
if (trace.isTraceEnabled()) {
trace.exit("initialize", definitions);
} |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | return;
}
bcelWorld = new LTWWorld(classLoader, weavingContext, getMessageHandler(), null);
weaver = new BcelWeaver(bcelWorld);
success = registerDefinitions(weaver, classLoader, definitions);
if (success) {
weaver.prepareForWeave();
enable();
success = weaveAndDefineConceteAspects();
}
if (success) {
enable();
} else {
disable();
bcelWorld = null;
weaver = null;
}
if (WeavedClassCache.isEnabled()) {
initializeCache(classLoader, getAspectClassNames(definitions), generatedClassHandler, getMessageHandler());
}
initialized = true;
if (trace.isTraceEnabled()) {
trace.exit("initialize", isEnabled());
}
}
/**
* Get the list of all aspects from the defintion list |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | * @param definitions
* @return
*/
List<String> getAspectClassNames(List<Definition> definitions) {
List<String> aspects = new LinkedList<String>();
for (Iterator<Definition> it = definitions.iterator(); it.hasNext(); ) {
Definition def = it.next();
List<String> defAspects = def.getAspectClassNames();
if (defAspects != null) {
aspects.addAll(defAspects);
}
}
return aspects;
}
/**
* Load and cache the aop.xml/properties according to the classloader visibility rules
*
* @param loader
*/
List<Definition> parseDefinitions(final ClassLoader loader) {
if (trace.isTraceEnabled()) {
trace.enter("parseDefinitions", this);
}
List<Definition> definitions = new ArrayList<Definition>();
try {
info("register classloader " + getClassLoaderName(loader));
if (loader.equals(ClassLoader.getSystemClassLoader())) {
String file = System.getProperty("aj5.def", null); |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | if (file != null) {
info("using (-Daj5.def) " + file);
definitions.add(DocumentParser.parse((new File(file)).toURL()));
}
}
String resourcePath = System.getProperty("org.aspectj.weaver.loadtime.configuration", AOP_XML);
if (trace.isTraceEnabled()) {
trace.event("parseDefinitions", this, resourcePath);
}
StringTokenizer st = new StringTokenizer(resourcePath, ";");
while (st.hasMoreTokens()) {
String nextDefinition = st.nextToken();
if (nextDefinition.startsWith("file:")) {
try {
String fpath = new URL(nextDefinition).getFile();
File configFile = new File(fpath);
if (!configFile.exists()) {
warn("configuration does not exist: " + nextDefinition);
} else {
definitions.add(DocumentParser.parse(configFile.toURL()));
}
} catch (MalformedURLException mue) {
error("malformed definition url: " + nextDefinition);
}
} else {
Enumeration<URL> xmls = weavingContext.getResources(nextDefinition);
Set<URL> seenBefore = new HashSet<URL>();
while (xmls.hasMoreElements()) {
URL xml = xmls.nextElement(); |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | if (trace.isTraceEnabled()) {
trace.event("parseDefinitions", this, xml);
}
if (!seenBefore.contains(xml)) {
info("using configuration " + weavingContext.getFile(xml));
definitions.add(DocumentParser.parse(xml));
seenBefore.add(xml);
} else {
debug("ignoring duplicate definition: " + xml);
}
}
}
}
if (definitions.isEmpty()) {
info("no configuration found. Disabling weaver for class loader " + getClassLoaderName(loader));
}
} catch (Exception e) {
definitions.clear();
warn("parse definitions failed", e);
}
if (trace.isTraceEnabled()) {
trace.exit("parseDefinitions", definitions);
}
return definitions;
}
private boolean registerDefinitions(final BcelWeaver weaver, final ClassLoader loader, List<Definition> definitions) {
if (trace.isTraceEnabled()) {
trace.enter("registerDefinitions", this, definitions);
}
boolean success = true; |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | try {
registerOptions(weaver, loader, definitions);
registerAspectExclude(weaver, loader, definitions);
registerAspectInclude(weaver, loader, definitions);
success = registerAspects(weaver, loader, definitions);
registerIncludeExclude(weaver, loader, definitions);
registerDump(weaver, loader, definitions);
} catch (Exception ex) {
trace.error("register definition failed", ex);
success = false;
warn("register definition failed", (ex instanceof AbortException) ? null : ex);
}
if (trace.isTraceEnabled()) {
trace.exit("registerDefinitions", success);
}
return success;
}
private String getClassLoaderName(ClassLoader loader) {
return weavingContext.getClassLoaderName();
}
/**
* Configure the weaver according to the option directives TODO av - don't know if it is that good to reuse, since we only allow
* a small subset of options in LTW
*
* @param weaver
* @param loader
* @param definitions
*/
private void registerOptions(final BcelWeaver weaver, final ClassLoader loader, final List<Definition> definitions) {
StringBuffer allOptions = new StringBuffer(); |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | for (Definition definition : definitions) {
allOptions.append(definition.getWeaverOptions()).append(' ');
}
Options.WeaverOption weaverOption = Options.parse(allOptions.toString(), loader, getMessageHandler());
World world = weaver.getWorld();
setMessageHandler(weaverOption.messageHandler);
world.setXlazyTjp(weaverOption.lazyTjp);
world.setXHasMemberSupportEnabled(weaverOption.hasMember);
world.setTiming(weaverOption.timers, true);
world.setOptionalJoinpoints(weaverOption.optionalJoinpoints);
world.setPinpointMode(weaverOption.pinpoint);
weaver.setReweavableMode(weaverOption.notReWeavable);
world.performExtraConfiguration(weaverOption.xSet);
world.setXnoInline(weaverOption.noInline);
world.setBehaveInJava5Way(LangUtil.is15VMOrGreater());
world.setAddSerialVerUID(weaverOption.addSerialVersionUID);
bcelWorld.getLint().loadDefaultProperties();
bcelWorld.getLint().adviceDidNotMatch.setKind(null);
if (weaverOption.lintFile != null) {
InputStream resource = null;
try {
resource = loader.getResourceAsStream(weaverOption.lintFile);
Exception failure = null;
if (resource != null) { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | try {
Properties properties = new Properties();
properties.load(resource);
world.getLint().setFromProperties(properties);
} catch (IOException e) {
failure = e;
}
}
if (failure != null || resource == null) {
warn("Cannot access resource for -Xlintfile:" + weaverOption.lintFile, failure);
}
} finally {
try {
resource.close();
} catch (Throwable t) {
}
}
}
if (weaverOption.lint != null) {
if (weaverOption.lint.equals("default")) {
bcelWorld.getLint().loadDefaultProperties();
} else {
bcelWorld.getLint().setAll(weaverOption.lint);
if (weaverOption.lint.equals("ignore")) { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | bcelWorld.setAllLintIgnored();
}
}
}
}
private void registerAspectExclude(final BcelWeaver weaver, final ClassLoader loader, final List<Definition> definitions) {
String fastMatchInfo = null;
for (Definition definition : definitions) {
for (String exclude : definition.getAspectExcludePatterns()) {
TypePattern excludePattern = new PatternParser(exclude).parseTypePattern();
m_aspectExcludeTypePattern.add(excludePattern);
fastMatchInfo = looksLikeStartsWith(exclude);
if (fastMatchInfo != null) {
m_aspectExcludeStartsWith.add(fastMatchInfo);
}
}
}
}
private void registerAspectInclude(final BcelWeaver weaver, final ClassLoader loader, final List<Definition> definitions) {
String fastMatchInfo = null;
for (Definition definition : definitions) {
for (String include : definition.getAspectIncludePatterns()) {
TypePattern includePattern = new PatternParser(include).parseTypePattern();
m_aspectIncludeTypePattern.add(includePattern);
fastMatchInfo = looksLikeStartsWith(include);
if (fastMatchInfo != null) {
m_aspectIncludeStartsWith.add(fastMatchInfo);
}
} |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | }
}
protected void lint(String name, String[] infos) {
Lint lint = bcelWorld.getLint();
Kind kind = lint.getLintKind(name);
kind.signal(infos, null, null);
}
@Override
public String getContextId() {
return weavingContext.getId();
}
/**
* Register the aspect, following include / exclude rules
*
* @param weaver
* @param loader
* @param definitions
*/
private boolean registerAspects(final BcelWeaver weaver, final ClassLoader loader, final List<Definition> definitions) {
if (trace.isTraceEnabled()) {
trace.enter("registerAspects", this, new Object[] { weaver, loader, definitions });
}
boolean success = true;
for (Definition definition : definitions) {
for (String aspectClassName : definition.getAspectClassNames()) {
if (acceptAspect(aspectClassName)) { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | info("register aspect " + aspectClassName);
String requiredType = definition.getAspectRequires(aspectClassName);
if (requiredType != null) {
((BcelWorld) weaver.getWorld()).addAspectRequires(aspectClassName, requiredType);
}
String definedScope = definition.getScopeForAspect(aspectClassName);
if (definedScope != null) {
((BcelWorld) weaver.getWorld()).addScopedAspect(aspectClassName, definedScope);
}
weaver.addLibraryAspect(aspectClassName);
if (namespace == null) {
namespace = new StringBuffer(aspectClassName);
} else {
namespace = namespace.append(";").append(aspectClassName);
}
} else {
lint("aspectExcludedByConfiguration", new String[] { aspectClassName, getClassLoaderName(loader) });
}
}
}
for (Definition definition : definitions) {
for (Definition.ConcreteAspect concreteAspect : definition.getConcreteAspects()) { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | if (acceptAspect(concreteAspect.name)) {
info("define aspect " + concreteAspect.name);
ConcreteAspectCodeGen gen = new ConcreteAspectCodeGen(concreteAspect, weaver.getWorld());
if (!gen.validate()) {
error("Concrete-aspect '" + concreteAspect.name + "' could not be registered");
success = false;
break;
}
((BcelWorld) weaver.getWorld()).addSourceObjectType(Utility.makeJavaClass(concreteAspect.name, gen.getBytes()),
true);
concreteAspects.add(gen);
weaver.addLibraryAspect(concreteAspect.name);
if (namespace == null) {
namespace = new StringBuffer(concreteAspect.name);
} else {
namespace = namespace.append(";" + concreteAspect.name);
}
}
}
}
if (!success) {
warn("failure(s) registering aspects. Disabling weaver for class loader " + getClassLoaderName(loader));
}
else if (namespace == null) {
success = false;
info("no aspects registered. Disabling weaver for class loader " + getClassLoaderName(loader));
} |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | if (trace.isTraceEnabled()) {
trace.exit("registerAspects", success);
}
return success;
}
private boolean weaveAndDefineConceteAspects() {
if (trace.isTraceEnabled()) {
trace.enter("weaveAndDefineConceteAspects", this, concreteAspects);
}
boolean success = true;
for (ConcreteAspectCodeGen gen : concreteAspects) {
String name = gen.getClassName();
byte[] bytes = gen.getBytes();
try {
byte[] newBytes = weaveClass(name, bytes, true);
this.generatedClassHandler.acceptClass(name, bytes, newBytes);
} catch (IOException ex) {
trace.error("weaveAndDefineConceteAspects", ex);
error("exception weaving aspect '" + name + "'", ex);
}
}
if (trace.isTraceEnabled()) {
trace.exit("weaveAndDefineConceteAspects", success);
}
return success;
}
/**
* Register the include / exclude filters. We duplicate simple patterns in startWith filters that will allow faster matching
* without ResolvedType
* |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | * @param weaver
* @param loader
* @param definitions
*/
private void registerIncludeExclude(final BcelWeaver weaver, final ClassLoader loader, final List<Definition> definitions) {
String fastMatchInfo = null;
for (Definition definition : definitions) {
for (Iterator<String> iterator1 = definition.getIncludePatterns().iterator(); iterator1.hasNext();) {
hasIncludes = true;
String include = iterator1.next();
fastMatchInfo = looksLikeStartsWith(include);
if (fastMatchInfo != null) {
m_includeStartsWith.add(fastMatchInfo);
} else if (include.equals("*")) {
includeStar = true;
} else if ((fastMatchInfo = looksLikeExactName(include)) != null) {
includeExactName.add(fastMatchInfo);
} else {
TypePattern includePattern = new PatternParser(include).parseTypePattern();
includeTypePattern.add(includePattern);
}
}
for (Iterator<String> iterator1 = definition.getExcludePatterns().iterator(); iterator1.hasNext();) {
hasExcludes = true;
String exclude = iterator1.next();
fastMatchInfo = looksLikeStartsWith(exclude);
if (fastMatchInfo != null) {
excludeStartsWith.add(fastMatchInfo);
} else if ((fastMatchInfo = looksLikeStarDotDotStarExclude(exclude)) != null) {
excludeStarDotDotStar.add(fastMatchInfo); |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | } else if ((fastMatchInfo = looksLikeExactName(exclude)) != null) {
excludeExactName.add(exclude);
} else if ((fastMatchInfo = looksLikeEndsWith(exclude)) != null) {
excludeEndsWith.add(fastMatchInfo);
} else if (exclude
.equals("org.codehaus.groovy..* && !org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController*")) {
excludeSpecial.add(new String[] { "org.codehaus.groovy.",
"org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController" });
} else {
TypePattern excludePattern = new PatternParser(exclude).parseTypePattern();
excludeTypePattern.add(excludePattern);
}
}
}
}
/**
* Checks if the pattern looks like "*..*XXXX*" and if so returns XXXX. This will enable fast name matching of CGLIB exclusion
*
*/
private String looksLikeStarDotDotStarExclude(String typePattern) {
if (!typePattern.startsWith("*..*")) {
return null;
}
if (!typePattern.endsWith("*")) {
return null;
} |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | String subPattern = typePattern.substring(4, typePattern.length() - 1);
if (hasStarDot(subPattern, 0)) {
return null;
}
return subPattern.replace('$', '.');
}
/**
* Checks if the pattern looks like "com.foo.Bar" - an exact name
*/
private String looksLikeExactName(String typePattern) {
if (hasSpaceAnnotationPlus(typePattern, 0) || typePattern.indexOf("*") != -1) {
return null;
}
return typePattern.replace('$', '.');
}
/**
* Checks if the pattern looks like "*Exception"
*/
private String looksLikeEndsWith(String typePattern) {
if (typePattern.charAt(0) != '*') {
return null;
}
if (hasSpaceAnnotationPlus(typePattern, 1) || hasStarDot(typePattern, 1)) {
return null;
}
return typePattern.substring(1).replace('$', '.');
}
/**
* Determine if something in the string is going to affect our ability to optimize. Checks for: ' ' '@' '+'
*/ |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | private boolean hasSpaceAnnotationPlus(String string, int pos) {
for (int i = pos, max = string.length(); i < max; i++) {
char ch = string.charAt(i);
if (ch == ' ' || ch == '@' || ch == '+') {
return true;
}
}
return false;
}
/**
* Determine if something in the string is going to affect our ability to optimize. Checks for: '*' '.'
*/
private boolean hasStarDot(String string, int pos) {
for (int i = pos, max = string.length(); i < max; i++) {
char ch = string.charAt(i);
if (ch == '*' || ch == '.') {
return true;
}
}
return false;
}
/**
* Checks if the type pattern looks like "com.foo..*"
*/
private String looksLikeStartsWith(String typePattern) {
if (hasSpaceAnnotationPlus(typePattern, 0) || typePattern.charAt(typePattern.length() - 1) != '*') {
return null;
} |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | int length = typePattern.length();
if (typePattern.endsWith("..*") && length > 3) {
if (typePattern.indexOf("..") == length - 3
&& typePattern.indexOf('*') == length - 1) {
return typePattern.substring(0, length - 2).replace('$', '.');
}
}
return null;
}
/**
* Register the dump filter
*
* @param weaver
* @param loader
* @param definitions
*/
private void registerDump(final BcelWeaver weaver, final ClassLoader loader, final List<Definition> definitions) {
for (Definition definition : definitions) {
for (Iterator<String> iterator1 = definition.getDumpPatterns().iterator(); iterator1.hasNext();) {
String dump = iterator1.next();
TypePattern pattern = new PatternParser(dump).parseTypePattern();
m_dumpTypePattern.add(pattern);
}
if (definition.shouldDumpBefore()) {
m_dumpBefore = true;
}
if (definition.createDumpDirPerClassloader()) {
dumpDirPerClassloader = true;
} |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | }
}
/**
* Determine whether a type should be accepted for weaving, by checking it against any includes/excludes.
*
* @param className the name of the type to possibly accept
* @param bytes the bytecode for the type (in case we need to look inside, eg. annotations)
* @return true if it should be accepted for weaving
*/
@Override
protected boolean accept(String className, byte[] bytes) {
if (!hasExcludes && !hasIncludes) {
return true;
}
String fastClassName = className.replace('/', '.');
for (String excludeStartsWithString : excludeStartsWith) {
if (fastClassName.startsWith(excludeStartsWithString)) {
return false;
}
}
if (!excludeStarDotDotStar.isEmpty()) {
for (String namePiece : excludeStarDotDotStar) {
int index = fastClassName.lastIndexOf('.');
if (fastClassName.indexOf(namePiece, index + 1) != -1) {
return false;
}
}
} |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | fastClassName = fastClassName.replace('$', '.');
if (!excludeEndsWith.isEmpty()) {
for (String lastPiece : excludeEndsWith) {
if (fastClassName.endsWith(lastPiece)) {
return false;
}
}
}
if (!excludeExactName.isEmpty()) {
for (String name : excludeExactName) {
if (fastClassName.equals(name)) {
return false;
}
}
}
if (!excludeSpecial.isEmpty()) {
for (String[] entry : excludeSpecial) {
String excludeThese = entry[0];
String exceptThese = entry[1];
if (fastClassName.startsWith(excludeThese) && !fastClassName.startsWith(exceptThese)) {
return false;
}
}
}
/*
* Bug 120363 If we have an exclude pattern that cannot be matched using "starts with" then we cannot fast accept
*/
boolean didSomeIncludeMatching = false;
if (excludeTypePattern.isEmpty()) { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | if (includeStar) {
return true;
}
if (!includeExactName.isEmpty()) {
didSomeIncludeMatching = true;
for (String exactname : includeExactName) {
if (fastClassName.equals(exactname)) {
return true;
}
}
}
boolean fastAccept = false;
for (int i = 0; i < m_includeStartsWith.size(); i++) {
didSomeIncludeMatching = true;
fastAccept = fastClassName.startsWith(m_includeStartsWith.get(i));
if (fastAccept) {
return true;
}
}
if (includeTypePattern.isEmpty()) {
return !didSomeIncludeMatching;
}
}
boolean accept;
try {
ensureDelegateInitialized(className, bytes);
ResolvedType classInfo = delegateForCurrentClass.getResolvedTypeX();
for (TypePattern typePattern : excludeTypePattern) { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | if (typePattern.matchesStatically(classInfo)) {
return false;
}
}
if (includeStar) {
return true;
}
if (!includeExactName.isEmpty()) {
didSomeIncludeMatching = true;
for (String exactname : includeExactName) {
if (fastClassName.equals(exactname)) {
return true;
}
}
}
for (int i = 0; i < m_includeStartsWith.size(); i++) {
didSomeIncludeMatching = true;
boolean fastaccept = fastClassName.startsWith(m_includeStartsWith.get(i));
if (fastaccept) {
return true;
}
}
accept = !didSomeIncludeMatching;
for (TypePattern typePattern : includeTypePattern) {
accept = typePattern.matchesStatically(classInfo);
if (accept) {
break;
} |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | }
} finally {
this.bcelWorld.demote();
}
return accept;
}
private boolean acceptAspect(String aspectClassName) {
if (m_aspectExcludeTypePattern.isEmpty() && m_aspectIncludeTypePattern.isEmpty()) {
return true;
}
String fastClassName = aspectClassName.replace('/', '.').replace('.', '$');
for (int i = 0; i < m_aspectExcludeStartsWith.size(); i++) {
if (fastClassName.startsWith(m_aspectExcludeStartsWith.get(i))) {
return false;
}
}
for (int i = 0; i < m_aspectIncludeStartsWith.size(); i++) {
if (fastClassName.startsWith(m_aspectIncludeStartsWith.get(i))) {
return true;
}
}
ResolvedType classInfo = weaver.getWorld().resolve(UnresolvedType.forName(aspectClassName), true); |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | for (Iterator iterator = m_aspectExcludeTypePattern.iterator(); iterator.hasNext();) {
TypePattern typePattern = (TypePattern) iterator.next();
if (typePattern.matchesStatically(classInfo)) {
return false;
}
}
boolean accept = true;
for (Iterator iterator = m_aspectIncludeTypePattern.iterator(); iterator.hasNext();) {
TypePattern typePattern = (TypePattern) iterator.next();
accept = typePattern.matchesStatically(classInfo);
if (accept) {
break;
}
}
return accept;
}
@Override
protected boolean shouldDump(String className, boolean before) {
if (before && !m_dumpBefore) {
return false;
}
if (m_dumpTypePattern.isEmpty()) {
return false;
} |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | ResolvedType classInfo = weaver.getWorld().resolve(UnresolvedType.forName(className), true);
for (Iterator iterator = m_dumpTypePattern.iterator(); iterator.hasNext();) {
TypePattern typePattern = (TypePattern) iterator.next();
if (typePattern.matchesStatically(classInfo)) {
return true;
}
}
return false;
}
@Override
protected String getDumpDir() {
if (dumpDirPerClassloader) {
StringBuffer dir = new StringBuffer();
dir.append("_ajdump").append(File.separator).append(weavingContext.getId());
return dir.toString();
} else {
return super.getDumpDir();
}
}
/*
* shared classes methods
*/
/**
* @return Returns the key.
*/
public String getNamespace() { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | if (namespace == null) {
return "";
} else {
return new String(namespace);
}
}
/**
* Check to see if any classes are stored in the generated classes cache. Then flush the cache if it is not empty
*
* @param className TODO
* @return true if a class has been generated and is stored in the cache
*/
public boolean generatedClassesExistFor(String className) {
if (className == null) {
return !generatedClasses.isEmpty();
} else {
return generatedClasses.containsKey(className);
}
}
/**
* Flush the generated classes cache
*/
public void flushGeneratedClasses() {
generatedClasses = new HashMap();
}
private Method defineClassMethod; |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | private Method defineClassWithProtectionDomainMethod;
private void defineClass(ClassLoader loader, String name, byte[] bytes) {
if (trace.isTraceEnabled()) {
trace.enter("defineClass", this, new Object[] { loader, name, bytes });
}
Object clazz = null;
debug("generating class '" + name + "'");
try {
if (defineClassMethod == null) {
defineClassMethod = ClassLoader.class.getDeclaredMethod("defineClass", new Class[] { String.class,
bytes.getClass(), int.class, int.class });
}
defineClassMethod.setAccessible(true);
clazz = defineClassMethod.invoke(loader, new Object[] { name, bytes, new Integer(0), new Integer(bytes.length) });
} catch (InvocationTargetException e) {
if (e.getTargetException() instanceof LinkageError) {
warn("define generated class failed", e.getTargetException());
} else {
warn("define generated class failed", e.getTargetException());
}
} catch (Exception e) {
warn("define generated class failed", e);
}
if (trace.isTraceEnabled()) {
trace.exit("defineClass", clazz);
}
}
private void defineClass(ClassLoader loader, String name, byte[] bytes, ProtectionDomain protectionDomain) { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | if (trace.isTraceEnabled()) {
trace.enter("defineClass", this, new Object[] { loader, name, bytes, protectionDomain });
}
Object clazz = null;
debug("generating class '" + name + "'");
try {
if (defineClassWithProtectionDomainMethod == null) {
defineClassWithProtectionDomainMethod = ClassLoader.class.getDeclaredMethod("defineClass", new Class[] {
String.class, bytes.getClass(), int.class, int.class, ProtectionDomain.class });
}
defineClassWithProtectionDomainMethod.setAccessible(true);
clazz = defineClassWithProtectionDomainMethod.invoke(loader, new Object[] { name, bytes, Integer.valueOf(0),
new Integer(bytes.length), protectionDomain });
} catch (InvocationTargetException e) {
if (e.getTargetException() instanceof LinkageError) {
warn("define generated class failed", e.getTargetException());
} else {
warn("define generated class failed", e.getTargetException());
}
} catch (Exception e) {
warn("define generated class failed", e);
}
if (trace.isTraceEnabled()) {
trace.exit("defineClass", clazz);
}
}
} |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Options.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.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.Message;
import org.aspectj.util.LangUtil;
/**
* A class that hanldes LTW options. Note: AV - I choosed to not reuse AjCompilerOptions and alike since those implies too many
* dependancies on jdt and ajdt modules.
*
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
*/
public class Options { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Options.java | private final static String OPTION_15 = "-1.5";
private final static String OPTION_lazyTjp = "-XlazyTjp";
private final static String OPTION_noWarn = "-nowarn";
private final static String OPTION_noWarnNone = "-warn:none";
private final static String OPTION_proceedOnError = "-proceedOnError";
private final static String OPTION_verbose = "-verbose";
private final static String OPTION_debug = "-debug";
private final static String OPTION_reweavable = "-Xreweavable";
private final static String OPTION_noinline = "-Xnoinline";
private final static String OPTION_addSerialVersionUID = "-XaddSerialVersionUID";
private final static String OPTION_hasMember = "-XhasMember";
private final static String OPTION_pinpoint = "-Xdev:pinpoint";
private final static String OPTION_showWeaveInfo = "-showWeaveInfo";
private final static String OPTIONVALUED_messageHandler = "-XmessageHandlerClass:";
private static final String OPTIONVALUED_Xlintfile = "-Xlintfile:";
private static final String OPTIONVALUED_Xlint = "-Xlint:";
private static final String OPTIONVALUED_joinpoints = "-Xjoinpoints:";
private static final String OPTIONVALUED_Xset = "-Xset:";
private static final String OPTION_timers = "-timers";
public static WeaverOption parse(String options, ClassLoader laoder, IMessageHandler imh) {
WeaverOption weaverOption = new WeaverOption(imh); |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Options.java | if (LangUtil.isEmpty(options)) {
return weaverOption;
}
List flags = LangUtil.anySplit(options, " ");
Collections.reverse(flags);
for (Iterator iterator = flags.iterator(); iterator.hasNext();) {
String arg = (String) iterator.next();
if (arg.startsWith(OPTIONVALUED_messageHandler)) {
if (arg.length() > OPTIONVALUED_messageHandler.length()) {
String handlerClass = arg.substring(OPTIONVALUED_messageHandler.length()).trim();
try {
Class handler = Class.forName(handlerClass, false, laoder);
weaverOption.messageHandler = ((IMessageHandler) handler.newInstance());
} catch (Throwable t) {
weaverOption.messageHandler.handleMessage(new Message("Cannot instantiate message handler " + handlerClass,
IMessage.ERROR, t, null));
}
}
}
}
for (Iterator iterator = flags.iterator(); iterator.hasNext();) {
String arg = (String) iterator.next();
if (arg.equals(OPTION_15)) {
weaverOption.java5 = true;
} else if (arg.equalsIgnoreCase(OPTION_lazyTjp)) {
weaverOption.lazyTjp = true;
} else if (arg.equalsIgnoreCase(OPTION_noinline)) { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Options.java | weaverOption.noInline = true;
} else if (arg.equalsIgnoreCase(OPTION_addSerialVersionUID)) {
weaverOption.addSerialVersionUID = true;
} else if (arg.equalsIgnoreCase(OPTION_noWarn) || arg.equalsIgnoreCase(OPTION_noWarnNone)) {
weaverOption.noWarn = true;
} else if (arg.equalsIgnoreCase(OPTION_proceedOnError)) {
weaverOption.proceedOnError = true;
} else if (arg.equalsIgnoreCase(OPTION_reweavable)) {
weaverOption.notReWeavable = false;
} else if (arg.equalsIgnoreCase(OPTION_showWeaveInfo)) {
weaverOption.showWeaveInfo = true;
} else if (arg.equalsIgnoreCase(OPTION_hasMember)) {
weaverOption.hasMember = true;
} else if (arg.startsWith(OPTIONVALUED_joinpoints)) {
if (arg.length() > OPTIONVALUED_joinpoints.length()) {
weaverOption.optionalJoinpoints = arg.substring(OPTIONVALUED_joinpoints.length()).trim();
}
} else if (arg.equalsIgnoreCase(OPTION_verbose)) {
weaverOption.verbose = true;
} else if (arg.equalsIgnoreCase(OPTION_debug)) {
weaverOption.debug = true;
} else if (arg.equalsIgnoreCase(OPTION_pinpoint)) {
weaverOption.pinpoint = true;
} else if (arg.startsWith(OPTIONVALUED_messageHandler)) {
} else if (arg.startsWith(OPTIONVALUED_Xlintfile)) {
if (arg.length() > OPTIONVALUED_Xlintfile.length()) {
weaverOption.lintFile = arg.substring(OPTIONVALUED_Xlintfile.length()).trim();
}
} else if (arg.startsWith(OPTIONVALUED_Xlint)) { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Options.java | if (arg.length() > OPTIONVALUED_Xlint.length()) {
weaverOption.lint = arg.substring(OPTIONVALUED_Xlint.length()).trim();
}
} else if (arg.startsWith(OPTIONVALUED_Xset)) {
if (arg.length() > OPTIONVALUED_Xlint.length()) {
weaverOption.xSet = arg.substring(OPTIONVALUED_Xset.length()).trim();
}
} else if (arg.equalsIgnoreCase(OPTION_timers)) {
weaverOption.timers = true;
} else {
weaverOption.messageHandler.handleMessage(new Message("Cannot configure weaver with option '" + arg
+ "': unknown option", IMessage.WARNING, null, null));
}
}
if (weaverOption.noWarn) {
weaverOption.messageHandler.ignore(IMessage.WARNING);
}
if (weaverOption.verbose) {
weaverOption.messageHandler.dontIgnore(IMessage.INFO);
}
if (weaverOption.debug) {
weaverOption.messageHandler.dontIgnore(IMessage.DEBUG);
}
if (weaverOption.showWeaveInfo) {
weaverOption.messageHandler.dontIgnore(IMessage.WEAVEINFO);
}
return weaverOption;
}
public static class WeaverOption { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | loadtime/src/org/aspectj/weaver/loadtime/Options.java | boolean java5;
boolean lazyTjp;
boolean hasMember;
boolean timers = false;
String optionalJoinpoints;
boolean noWarn;
boolean proceedOnError;
boolean verbose;
boolean debug;
boolean notReWeavable = true;
boolean noInline;
boolean addSerialVersionUID;
boolean showWeaveInfo;
boolean pinpoint;
IMessageHandler messageHandler;
String lint;
String lintFile;
String xSet;
public WeaverOption(IMessageHandler imh) {
this.messageHandler = imh;
}
}
} |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java | /*******************************************************************************
* Copyright (c) 2013 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://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andy Clement - initial API and implementation
*******************************************************************************/
package org.aspectj.systemtest.ajc174;
import java.io.File;
import junit.framework.Test;
import org.aspectj.testing.XMLBasedAjcTestCase;
/**
* @author Andy Clement
*/
public class Ajc174Tests extends org.aspectj.testing.XMLBasedAjcTestCase { |
368,046 | Bug 368046 configure a set of classloader for which weavers should not be created in an LTW scenario | Prototyped and tested for JspClassLoaders (see the thread 'aspectj and jsp load' on the mailing list). That was done through a system property but it would be easier via aop.xml. However, this would be the first time we have an aop.xml setting that affects global operation of loadtime weaving. When any classloader actually got far enough to load the aop.xmls it would discover this setting and from that point on it would be set. In our JspClassLoader case this would mean that either some non-JspClassLoader is run early enough to discover this setting and turn it off for all JspClassLoaders or the first JspClassLoader will discover the setting and turn it off for all other JspClassLoaders. I think we can live with that mode of operation. | resolved fixed | 0c0adc5 | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-07-30T05:25:23Z" | "2012-01-06T17:13:20Z" | tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java | public void testSuperItdCtor_413378() throws Exception {
runTest("super itd ctor");
}
public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(Ajc174Tests.class);
}
@Override
protected File getSpecFile() {
return new File("../tests/src/org/aspectj/systemtest/ajc174/ajc174.xml");
}
} |
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" | tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java | /*******************************************************************************
* Copyright (c) 2013 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://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andy Clement - initial API and implementation
*******************************************************************************/
package org.aspectj.systemtest.ajc174;
import java.io.File;
import junit.framework.Test;
import org.aspectj.testing.XMLBasedAjcTestCase;
/**
* @author Andy Clement
*/
public class Ajc174Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
public void testSuperItdCtor_413378() throws Exception {
runTest("super itd ctor");
}
public void testCLExclusion_pr368046_1_noskippedloaders() {
runTest("classloader exclusion - 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" | tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java | public void testCLExclusion_pr368046_1_syspropset() {
try {
System.setProperty("aj.weaving.loadersToSkip", "foo");
runTest("classloader exclusion - 2");
} finally {
System.setProperty("aj.weaving.loadersToSkip", "");
}
}
public void testCLExclusion_pr368046_1_again_noskippedloaders() {
runTest("classloader exclusion - 3");
}
public void testCLExclusion_pr368046_2_usingaopxml() {
runTest("classloader exclusion - 4");
}
public void testCLExclusion_pr368046_2_usingaopxmlReal() {
runTest("classloader exclusion - 5");
}
public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(Ajc174Tests.class);
}
@Override
protected File getSpecFile() {
return new File("../tests/src/org/aspectj/systemtest/ajc174/ajc174.xml");
}
} |
418,129 | Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect | null | resolved fixed | 2393bef | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:00:14Z" | "2013-09-26T18:26:40Z" | weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java | /* *******************************************************************
* 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.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.aspectj.apache.bcel.Constants;
import org.aspectj.apache.bcel.classfile.ConstantPool;
import org.aspectj.apache.bcel.classfile.Method; |
418,129 | Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect | null | resolved fixed | 2393bef | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:00:14Z" | "2013-09-26T18:26:40Z" | weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java | import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen;
import org.aspectj.apache.bcel.generic.FieldGen;
import org.aspectj.apache.bcel.generic.FieldInstruction;
import org.aspectj.apache.bcel.generic.Instruction;
import org.aspectj.apache.bcel.generic.InstructionBranch;
import org.aspectj.apache.bcel.generic.InstructionCP;
import org.aspectj.apache.bcel.generic.InstructionConstants;
import org.aspectj.apache.bcel.generic.InstructionFactory;
import org.aspectj.apache.bcel.generic.InstructionHandle;
import org.aspectj.apache.bcel.generic.InstructionLV;
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.InvokeInstruction;
import org.aspectj.apache.bcel.generic.LineNumberTag;
import org.aspectj.apache.bcel.generic.LocalVariableTag;
import org.aspectj.apache.bcel.generic.MULTIANEWARRAY;
import org.aspectj.apache.bcel.generic.MethodGen;
import org.aspectj.apache.bcel.generic.ObjectType;
import org.aspectj.apache.bcel.generic.RET;
import org.aspectj.apache.bcel.generic.Tag;
import org.aspectj.apache.bcel.generic.Type;
import org.aspectj.asm.AsmManager;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.bridge.Message;
import org.aspectj.bridge.MessageUtil;
import org.aspectj.bridge.WeaveMessage;
import org.aspectj.bridge.context.CompilationAndWeavingContext;
import org.aspectj.bridge.context.ContextToken; |
418,129 | Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect | null | resolved fixed | 2393bef | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:00:14Z" | "2013-09-26T18:26:40Z" | weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java | import org.aspectj.util.PartialOrder;
import org.aspectj.weaver.AjAttribute;
import org.aspectj.weaver.AjcMemberMaker;
import org.aspectj.weaver.AnnotationAJ;
import org.aspectj.weaver.BCException;
import org.aspectj.weaver.ConcreteTypeMunger;
import org.aspectj.weaver.IClassWeaver;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.Member;
import org.aspectj.weaver.MissingResolvedTypeWithKnownSignature;
import org.aspectj.weaver.NameMangler;
import org.aspectj.weaver.NewConstructorTypeMunger;
import org.aspectj.weaver.NewFieldTypeMunger;
import org.aspectj.weaver.NewMethodTypeMunger;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedMemberImpl;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.ResolvedTypeMunger;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.UnresolvedTypeVariableReferenceType;
import org.aspectj.weaver.WeaverStateInfo;
import org.aspectj.weaver.World;
import org.aspectj.weaver.model.AsmRelationshipProvider;
import org.aspectj.weaver.patterns.DeclareAnnotation;
import org.aspectj.weaver.patterns.ExactTypePattern;
import org.aspectj.weaver.tools.Trace;
import org.aspectj.weaver.tools.TraceFactory;
class BcelClassWeaver implements IClassWeaver { |
418,129 | Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect | null | resolved fixed | 2393bef | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:00:14Z" | "2013-09-26T18:26:40Z" | weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java | private static Trace trace = TraceFactory.getTraceFactory().getTrace(BcelClassWeaver.class);
public static boolean weave(BcelWorld world, LazyClassGen clazz, List<ShadowMunger> shadowMungers,
List<ConcreteTypeMunger> typeMungers, List<ConcreteTypeMunger> lateTypeMungers, boolean inReweavableMode) {
BcelClassWeaver classWeaver = new BcelClassWeaver(world, clazz, shadowMungers, typeMungers, lateTypeMungers);
classWeaver.setReweavableMode(inReweavableMode);
boolean b = classWeaver.weave();
return b;
}
private final LazyClassGen clazz;
private final List<ShadowMunger> shadowMungers;
private final List<ConcreteTypeMunger> typeMungers;
private final List<ConcreteTypeMunger> lateTypeMungers;
private List<ShadowMunger>[] indexedShadowMungers;
private boolean canMatchBodyShadows = false;
private final BcelObjectType ty;
private final BcelWorld world;
private final ConstantPool cpg;
private final InstructionFactory fact;
private final List<LazyMethodGen> addedLazyMethodGens = new ArrayList<LazyMethodGen>();
private final Set<ResolvedMember> addedDispatchTargets = new HashSet<ResolvedMember>();
private boolean inReweavableMode = false;
private List<IfaceInitList> addedSuperInitializersAsList = null;
private final Map<ResolvedType, IfaceInitList> addedSuperInitializers = new HashMap<ResolvedType, IfaceInitList>();
private final List<ConcreteTypeMunger> addedThisInitializers = new ArrayList<ConcreteTypeMunger>();
private final List<ConcreteTypeMunger> addedClassInitializers = new ArrayList<ConcreteTypeMunger>();
private final Map<ResolvedMember, ResolvedMember> mapToAnnotationHolder = new HashMap<ResolvedMember, ResolvedMember>();
/** |
418,129 | Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect | null | resolved fixed | 2393bef | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:00:14Z" | "2013-09-26T18:26:40Z" | weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java | * This holds the initialization and pre-initialization shadows for this class that were actually matched by mungers (if no
* match, then we don't even create the shadows really).
*/
private final List<BcelShadow> initializationShadows = new ArrayList<BcelShadow>();
private BcelClassWeaver(BcelWorld world, LazyClassGen clazz, List<ShadowMunger> shadowMungers,
List<ConcreteTypeMunger> typeMungers, List<ConcreteTypeMunger> lateTypeMungers) {
super();
this.world = world;
this.clazz = clazz;
this.shadowMungers = shadowMungers;
this.typeMungers = typeMungers;
this.lateTypeMungers = lateTypeMungers;
this.ty = clazz.getBcelObjectType();
this.cpg = clazz.getConstantPool();
this.fact = clazz.getFactory();
indexShadowMungers();
initializeSuperInitializerMap(ty.getResolvedTypeX());
if (!checkedXsetForLowLevelContextCapturing) {
Properties p = world.getExtraConfiguration();
if (p != null) {
String s = p.getProperty(World.xsetCAPTURE_ALL_CONTEXT, "false");
captureLowLevelContext = s.equalsIgnoreCase("true");
if (captureLowLevelContext) {
world.getMessageHandler().handleMessage(
MessageUtil.info("[" + World.xsetCAPTURE_ALL_CONTEXT
+ "=true] Enabling collection of low level context for debug/crash messages"));
}
}
checkedXsetForLowLevelContextCapturing = true;
} |
418,129 | Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect | null | resolved fixed | 2393bef | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:00:14Z" | "2013-09-26T18:26:40Z" | weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java | }
private boolean canMatch(Shadow.Kind kind) {
return indexedShadowMungers[kind.getKey()] != null;
}
private void initializeSuperInitializerMap(ResolvedType child) {
ResolvedType[] superInterfaces = child.getDeclaredInterfaces();
for (int i = 0, len = superInterfaces.length; i < len; i++) {
if (ty.getResolvedTypeX().isTopmostImplementor(superInterfaces[i])) {
if (addSuperInitializer(superInterfaces[i])) {
initializeSuperInitializerMap(superInterfaces[i]);
}
}
}
}
/**
* Process the shadow mungers into array 'buckets', each bucket represents a shadow kind and contains a list of shadowmungers
* that could potentially apply at that shadow kind.
*/
private void indexShadowMungers() { |
418,129 | Bug 418129 Can't introduce annotation onto introduced method from trait-patterned aspect | null | resolved fixed | 2393bef | AspectJ | https://github.com/eclipse/org.aspectj | eclipse/org.aspectj | java | null | null | null | "2013-10-01T17:00:14Z" | "2013-09-26T18:26:40Z" | weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java | indexedShadowMungers = new List[Shadow.MAX_SHADOW_KIND + 1];
for (ShadowMunger shadowMunger : shadowMungers) {
int couldMatchKinds = shadowMunger.getPointcut().couldMatchKinds();
for (Shadow.Kind kind : Shadow.SHADOW_KINDS) {
if (kind.isSet(couldMatchKinds)) {
byte k = kind.getKey();
if (indexedShadowMungers[k] == null) {
indexedShadowMungers[k] = new ArrayList<ShadowMunger>();
if (!kind.isEnclosingKind()) {
canMatchBodyShadows = true;
}
}
indexedShadowMungers[k].add(shadowMunger);
}
}
}
}
private boolean addSuperInitializer(ResolvedType onType) {
if (onType.isRawType() || onType.isParameterizedType()) {
onType = onType.getGenericType();
}
IfaceInitList l = addedSuperInitializers.get(onType);
if (l != null) {
return false;
}
l = new IfaceInitList(onType);
addedSuperInitializers.put(onType, l);
return true;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.