/**
* Makes the given visitor visit this stack map frame.
*
* @param mv a method visitor.
*/
public void accept(final MethodVisitor mv) {
switch (type) {
case Opcodes.F_NEW:
case Opcodes.F_FULL:
mv.visitFrame(type,local.size(),asArray(local),stack.size(),asArray(stack));
break;
case Opcodes.F_APPEND:
mv.visitFrame(type,null);
break;
case Opcodes.F_CHOP:
mv.visitFrame(type,null);
break;
case Opcodes.F_SAME:
mv.visitFrame(type,null,null);
break;
case Opcodes.F_SAME1:
mv.visitFrame(type,1,asArray(stack));
break;
}
}
@Override
public MethodVisitor visitMethod(int access,String name,String desc,String signature,String[] exceptions) {
if ((Opcodes.ACC_PUBLIC & access) == 0 || EXCLUDE_METHODS.contains(name)
|| name.contains("<")) {
return null;
}
if (name.endsWith("0")) {
name = name.substring(0,name.length() - 1);
}
int index = -1;
for (int i = 0; i < name.length(); i++) {
if (Character.isUpperCase(name.charat(i))) {
index = i;
break;
}
}
if (index < 0) {
return new FindEnumVisitor(name,name.toupperCase(),null);
} else {
String cmd = name.substring(0,index).toupperCase();
return new FindEnumVisitor(name,cmd,name.substring(index).toupperCase());
}
}
项目:astor
文件:FrameNode.java
/**
* Makes the given visitor visit this stack map frame.
*
* @param mv a method visitor.
*/
public void accept(final MethodVisitor mv) {
switch (type) {
case Opcodes.F_NEW:
case Opcodes.F_FULL:
mv.visitFrame(type,asArray(stack));
break;
}
}
public LocalVariablesSorter(
final int access,final String desc,final MethodVisitor mv)
{
super(mv);
state = new State();
Type[] args = Type.getArgumentTypes(desc);
state.nextLocal = ((Opcodes.ACC_STATIC & access) != 0) ? 0 : 1;
for (int i = 0; i < args.length; i++) {
state.nextLocal += args[i].getSize();
}
firstLocal = state.nextLocal;
}
public MethodVisitor visitMethod(
final int access,final String name,final String signature,final String[] exceptions)
{
MethodNode mn = new MethodNode(access,name,desc,signature,exceptions);
methods.add(mn);
return mn;
}
public void accept(final MethodVisitor mv) {
int[] keys = new int[this.keys.size()];
for (int i = 0; i < keys.length; ++i) {
keys[i] = ((Integer) this.keys.get(i)).intValue();
}
Label[] labels = new Label[this.labels.size()];
for (int i = 0; i < labels.length; ++i) {
labels[i] = ((LabelNode) this.labels.get(i)).getLabel();
}
mv.visitLookupSwitchInsn(dflt.getLabel(),keys,labels);
}
/**
* Makes the given class visitor visit this method.
*
* @param cv a class visitor.
*/
public void accept(final ClassVisitor cv) {
String[] exceptions = new String[this.exceptions.size()];
this.exceptions.toArray(exceptions);
MethodVisitor mv = cv.visitMethod(access,exceptions);
if (mv != null) {
accept(mv);
}
}
public void accept(final MethodVisitor mv) {
Label[] labels = new Label[this.labels.size()];
for (int i = 0; i < labels.length; ++i) {
labels[i] = ((LabelNode) this.labels.get(i)).getLabel();
}
mv.visitTableSwitchInsn(min,max,dflt.getLabel(),labels);
}
public MethodVisitor visitMethod(
final int access,final String[] exceptions)
{
checkState();
checkAccess(access,Opcodes.ACC_PUBLIC + Opcodes.ACC_PRIVATE
+ Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC
+ Opcodes.ACC_FINAL + Opcodes.ACC_SYNCHRONIZED
+ Opcodes.ACC_BRIDGE + Opcodes.ACC_VaraRGS + Opcodes.ACC_NATIVE
+ Opcodes.ACC_ABSTRACT + Opcodes.ACC_STRICT
+ Opcodes.ACC_SYNTHETIC + Opcodes.ACC_DEPRECATED);
CheckMethodAdapter.checkMethodIdentifier(name,"method name");
CheckMethodAdapter.checkMethodDesc(desc);
if (signature != null) {
CheckMethodAdapter.checkMethodSignature(signature);
}
if (exceptions != null) {
for (int i = 0; i < exceptions.length; ++i) {
CheckMethodAdapter.checkInternalName(exceptions[i],"exception name at index " + i);
}
}
return new CheckMethodAdapter(cv.visitMethod(access,exceptions));
}
public MethodVisitor visitMethod(
final int access,final String[] exceptions)
{
buf.setLength(0);
buf.append("{\n");
buf.append("mv = cw.visitMethod(");
appendAccess(access);
buf.append(",");
appendConstant(name);
buf.append(",");
appendConstant(desc);
buf.append(",");
appendConstant(signature);
buf.append(",");
if (exceptions != null && exceptions.length > 0) {
buf.append("new String[] {");
for (int i = 0; i < exceptions.length; ++i) {
buf.append(i == 0 ? " " : ",");
appendConstant(exceptions[i]);
}
buf.append(" }");
} else {
buf.append("null");
}
buf.append(");\n");
text.add(buf.toString());
ASMifierMethodVisitor acv = createASMifierMethodVisitor();
text.add(acv.getText());
text.add("}\n");
return acv;
}
项目:astor
文件:LocalVariablesSorter.java
public LocalVariablesSorter(
final int access,final MethodVisitor mv)
{
super(mv);
state = new State();
Type[] args = Type.getArgumentTypes(desc);
state.nextLocal = ((Opcodes.ACC_STATIC & access) != 0) ? 0 : 1;
for (int i = 0; i < args.length; i++) {
state.nextLocal += args[i].getSize();
}
firstLocal = state.nextLocal;
}
项目:astor
文件:ClassNode.java
public MethodVisitor visitMethod(
final int access,exceptions);
methods.add(mn);
return mn;
}
项目:astor
文件:LocalVariableNode.java
项目:astor
文件:InsnList.java
项目:astor
文件:LookupSwitchInsnNode.java
public void accept(final MethodVisitor mv) {
int[] keys = new int[this.keys.size()];
for (int i = 0; i < keys.length; ++i) {
keys[i] = ((Integer) this.keys.get(i)).intValue();
}
Label[] labels = new Label[this.labels.size()];
for (int i = 0; i < labels.length; ++i) {
labels[i] = ((LabelNode) this.labels.get(i)).getLabel();
}
mv.visitLookupSwitchInsn(dflt.getLabel(),labels);
}
项目:astor
文件:MethodNode.java
/**
* Makes the given class visitor visit this method.
*
* @param cv a class visitor.
*/
public void accept(final ClassVisitor cv) {
String[] exceptions = new String[this.exceptions.size()];
this.exceptions.toArray(exceptions);
MethodVisitor mv = cv.visitMethod(access,exceptions);
if (mv != null) {
accept(mv);
}
}
项目:astor
文件:TableSwitchInsnNode.java
public void accept(final MethodVisitor mv) {
Label[] labels = new Label[this.labels.size()];
for (int i = 0; i < labels.length; ++i) {
labels[i] = ((LabelNode) this.labels.get(i)).getLabel();
}
mv.visitTableSwitchInsn(min,labels);
}
项目:astor
文件:CheckClassAdapter.java
public MethodVisitor visitMethod(
final int access,exceptions));
}
项目:astor
文件:ASMifierClassVisitor.java
public MethodVisitor visitMethod(
final int access,");
appendConstant(exceptions[i]);
}
buf.append(" }");
} else {
buf.append("null");
}
buf.append(");\n");
text.add(buf.toString());
ASMifierMethodVisitor acv = createASMifierMethodVisitor();
text.add(acv.getText());
text.add("}\n");
return acv;
}
/**
* Makes the given visitor visit this try catch block.
*
* @param mv a method visitor.
*/
public void accept(final MethodVisitor mv) {
mv.visitTryCatchBlock(start.getLabel(),handler == null
? null
: handler.getLabel(),type);
}
public void accept(final MethodVisitor mv) {
mv.visitTypeInsn(opcode,desc);
}
public void accept(final MethodVisitor mv) {
mv.visitMethodInsn(opcode,owner,desc);
}
public void accept(final MethodVisitor mv) {
mv.visitIntInsn(opcode,operand);
}
public void accept(final MethodVisitor cv) {
cv.visitFieldInsn(opcode,desc);
}
public void accept(final MethodVisitor mv) {
mv.visitLdcInsn(cst);
}
public void accept(final MethodVisitor mv) {
mv.visitvarInsn(opcode,var);
}
public void accept(final MethodVisitor mv) {
mv.visitJumpInsn(opcode,label.getLabel());
}
public void accept(final MethodVisitor mv) {
mv.visitIincInsn(var,incr);
}