Collection mungers =
onType.getWeaverState().getTypeMungers(onType);
- //System.out.println("mungers: " + mungers);
+ //System.out.println(onType + " mungers: " + mungers);
for (Iterator i = mungers.iterator(); i.hasNext(); ) {
ConcreteTypeMunger m = (ConcreteTypeMunger)i.next();
EclipseTypeMunger munger = factory.makeEclipseTypeMunger(m);
if (!newParents.isEmpty()) {
for (Iterator i = newParents.iterator(); i.hasNext(); ) {
ResolvedTypeX parent = (ResolvedTypeX)i.next();
+ if (dangerousInterfaces.containsKey(parent)) {
+ ResolvedTypeX onType = factory.fromEclipse(sourceType);
+ factory.showMessage(IMessage.ERROR,
+ onType + ": " + dangerousInterfaces.get(parent),
+ onType.getSourceLocation(), null);
+ }
addParent(sourceType, parent);
}
}
</compile>
</ajc-test>
+
+ <ajc-test dir="bugs/moreInterfaceLibrary"
+ pr="41123"
+ title="Weaving failure when using injars (no jars)">
+ <compile
+ files="lib/ExecutionMonitor.aj,model/BusObj.java,model/MonitorBusObj.java">
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs/moreInterfaceLibrary"
+ pr="41123"
+ title="Weaving failure when using injars (on aspectpath)">
+ <compile
+ files="model/BusObj.java,model/MonitorBusObj.java"
+ aspectpath="lib.jar">
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs/moreInterfaceLibrary"
+ pr="41123"
+ title="Weaving failure when using injars (on classpath)">
+ <compile
+ files="model/BusObj.java,model/MonitorBusObj.java"
+ classpath="lib.jar">
+ <message kind="error" line="3"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs/moreInterfaceLibrary"
+ pr="41123"
+ title="Weaving failure when using injars (actual injars)">
+ <compile
+ files="model/BusObj.java,model/MonitorBusObj.java,lib.jar">
+ <message kind="error" line="3"/>
+ </compile>
+ </ajc-test>
</suite>
--- /dev/null
+package lib;\r
+\r
+public aspect ExecutionMonitor {\r
+ public interface MonitoredItem {}\r
+ private void MonitoredItem.record(String eventType, String eventName) {}\r
+}
\ No newline at end of file
--- /dev/null
+package model;
+
+public class BusObj {
+
+}
--- /dev/null
+package model;
+
+import lib.ExecutionMonitor;
+
+public aspect MonitorBusObj {
+ declare parents: BusObj implements ExecutionMonitor.MonitoredItem;
+}
\ No newline at end of file
private LazyMethodGen makeMethodGen(LazyClassGen gen, ResolvedMember member) {
- return new LazyMethodGen(
+ LazyMethodGen ret = new LazyMethodGen(
member.getModifiers(),
BcelWorld.makeBcelType(member.getReturnType()),
member.getName(),
BcelWorld.makeBcelTypes(member.getParameterTypes()),
TypeX.getNames(member.getExceptions()),
gen);
+ ret.makeSynthetic();
+ return ret;
}
import org.apache.bcel.classfile.Attribute;
import org.apache.bcel.classfile.ConstantPool;
import org.apache.bcel.classfile.Method;
+import org.apache.bcel.classfile.Synthetic;
import org.apache.bcel.generic.BranchHandle;
import org.apache.bcel.generic.BranchInstruction;
import org.apache.bcel.generic.CPInstruction;
import org.apache.bcel.generic.ClassGenException;
import org.apache.bcel.generic.CodeExceptionGen;
+import org.apache.bcel.generic.ConstantPoolGen;
import org.apache.bcel.generic.Instruction;
import org.apache.bcel.generic.InstructionHandle;
import org.apache.bcel.generic.InstructionList;
private boolean canInline = true;
private boolean hasExceptionHandlers;
+ private boolean isSynthetic = false;
+
/**
* only used by {@link BcelClassWeaver}
*/
for (int i = 0, len = attributes.length; i < len; i++) {
gen.addAttribute(attributes[i]);
}
+
+ if (isSynthetic) {
+ ConstantPoolGen cpg = gen.getConstantPool();
+ int index = cpg.addUtf8("Synthetic");
+ gen.addAttribute(new Synthetic(index, 0, new byte[0], cpg.getConstantPool()));
+ }
+
if (hasBody()) {
packBody(gen);
gen.setMaxLocals();
}
return gen;
}
+
+ public void makeSynthetic() {
+ isSynthetic = true;
+ }
/** fill the newly created method gen with our body,
* inspired by InstructionList.copy()