use of org.apache.bcel.classfile.Attribute in project jop by jop-devel.
the class ReplaceAtomicAnnotation method visitJavaClass.
public void visitJavaClass(JavaClass clazz) {
super.visitJavaClass(clazz);
Method[] methods = clazz.getMethods();
for (int i = 0; i < methods.length; i++) {
for (Attribute a : methods[i].getAttributes()) {
if (a instanceof AnnotationAttribute) {
if (((AnnotationAttribute) a).hasAtomicAnnotation()) {
ConstantPoolGen cpoolgen = new ConstantPoolGen(clazz.getConstantPool());
Method nm = transform(methods[i], clazz, cpoolgen);
OldMethodInfo mi = getCli().getMethodInfo(nm.getName() + nm.getSignature());
// set new method also in MethodInfo
mi.setMethod(nm);
methods[i] = nm;
clazz.setConstantPool(cpoolgen.getFinalConstantPool());
System.out.println("RTTM: transformed atomic method " + clazz.getClassName() + "." + nm.getName() + nm.getSignature());
}
}
}
}
}
Aggregations