case CodeVisitor.INVOKESPECIAL:
int index = visitor.getShortArg();
JavaClass jClass = visitor.getJavaClass();
ConstantPool cp = jClass.getConstantPool();
MethodRefConstant ref;
ref = cp.getMethodRef(index);
if (ref.getName().endsWith("__super")) {
return;
}
else if (ref.getName().equals("<init>")
&& (! ref.getClassName().equals(jClass.getSuperClassName())
|| ! _method.getName().equals("<init>"))) {
return;
}
else if (! ref.getName().equals("<init>")) {
// private methods are called with invokespecial, but shouldn't
// be modified
JMethod method = findMethod(jClass,
ref.getName(),
ref.getType());
if (method != null && method.isPrivate())
return;
}
String superName;
if (ref.getName().equals("<init>"))
superName = "__init__super";
else
superName = ref.getName() + "__super";
MethodRefConstant newRef;
newRef = cp.addMethodRef(ref.getClassName(),
superName,
ref.getType());
visitor.setShortArg(1, newRef.getIndex());
_isEnhanced = true;
break;
}
}