Hi all:
I'm reading gae java sourcecode recently,and can't understand
the following codes:
com\google\appengine\tools\development\agent\impl
\ReflectionVisitor.java
@Override
public void visitMethodInsn(int opcode, String owner, String name,
String desc) {
Set<String> methods = interceptedMethods.get(owner);
if (methods == null || !methods.contains(name)) {
super.visitMethodInsn(opcode, owner, name, desc);
return;
}
String newDesc = desc;
if (opcode == Opcodes.INVOKEVIRTUAL) {
final Type[] argTypes = Type.getArgumentTypes(desc);
final Type[] newArgTypes = new Type[argTypes.length + 1];
newArgTypes[0] = Type.getType("L" + owner + ";");
System.arraycopy(argTypes, 0, newArgTypes, 1,
argTypes.length);
newDesc = Type.getMethodDescriptor(Type.getReturnType(desc),
newArgTypes);
}
super.visitMethodInsn(Opcodes.INVOKESTATIC,
AgentImpl.AGENT_RUNTIME, name, newDesc);
}
My question is this: if (opcode == Opcodes.INVOKEVIRTUAL)
I think this judgement is always setup,so it is redundant。
Or is there some other reasons?
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.