本文整理汇总了Java中org.objectweb.asm.util.AbstractVisitor类的典型用法代码示例。如果您正苦于以下问题:Java AbstractVisitor类的具体用法?Java AbstractVisitor怎么用?Java AbstractVisitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractVisitor类属于org.objectweb.asm.util包,在下文中一共展示了AbstractVisitor类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitTableSwitchInsn
import org.objectweb.asm.util.AbstractVisitor; //导入依赖的package包/类
public final void visitTableSwitchInsn(
int min,
int max,
Label dflt,
Label[] labels)
{
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "min", "min", "", Integer.toString(min));
attrs.addAttribute("", "max", "max", "", Integer.toString(max));
attrs.addAttribute("", "dflt", "dflt", "", getLabel(dflt));
String o = AbstractVisitor.OPCODES[Opcodes.TABLESWITCH];
addStart(o, attrs);
for (int i = 0; i < labels.length; i++) {
AttributesImpl att2 = new AttributesImpl();
att2.addAttribute("", "name", "name", "", getLabel(labels[i]));
addElement("label", att2);
}
addEnd(o);
}
示例2: visitLookupSwitchInsn
import org.objectweb.asm.util.AbstractVisitor; //导入依赖的package包/类
public final void visitLookupSwitchInsn(
Label dflt,
int[] keys,
Label[] labels)
{
AttributesImpl att = new AttributesImpl();
att.addAttribute("", "dflt", "dflt", "", getLabel(dflt));
String o = AbstractVisitor.OPCODES[Opcodes.LOOKUPSWITCH];
addStart(o, att);
for (int i = 0; i < labels.length; i++) {
AttributesImpl att2 = new AttributesImpl();
att2.addAttribute("", "name", "name", "", getLabel(labels[i]));
att2.addAttribute("", "key", "key", "", Integer.toString(keys[i]));
addElement("label", att2);
}
addEnd(o);
}
示例3: visitInvokeDynamicInsn
import org.objectweb.asm.util.AbstractVisitor; //导入依赖的package包/类
@Override
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm,
Object... bsmArgs) {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "name", "name", "", name);
attrs.addAttribute("", "desc", "desc", "", desc);
attrs.addAttribute("", "bsm", "bsm", "",
SAXClassAdapter.encode(bsm.toString()));
String o = AbstractVisitor.OPCODES[Opcodes.INVOKEDYNAMIC];
addStart(o, attrs);
for (int i = 0; i < bsmArgs.length; i++) {
AttributesImpl cattrs = new AttributesImpl();
cattrs.addAttribute("", "cst", "cst", "",
SAXClassAdapter.encode(bsmArgs[i].toString()));
cattrs.addAttribute("", "desc", "desc", "",
Type.getDescriptor(bsmArgs[i].getClass()));
addElement("bsmArg", cattrs);
}
addEnd(o);
}
示例4: visitFieldInsn
import org.objectweb.asm.util.AbstractVisitor; //导入依赖的package包/类
public final void visitFieldInsn(
int opcode,
String owner,
String name,
String desc)
{
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "owner", "owner", "", owner);
attrs.addAttribute("", "name", "name", "", name);
attrs.addAttribute("", "desc", "desc", "", desc);
addElement(AbstractVisitor.OPCODES[opcode], attrs);
}
示例5: visitMethodInsn
import org.objectweb.asm.util.AbstractVisitor; //导入依赖的package包/类
public final void visitMethodInsn(
int opcode,
String owner,
String name,
String desc)
{
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "owner", "owner", "", owner);
attrs.addAttribute("", "name", "name", "", name);
attrs.addAttribute("", "desc", "desc", "", desc);
addElement(AbstractVisitor.OPCODES[opcode], attrs);
}
示例6: visitLdcInsn
import org.objectweb.asm.util.AbstractVisitor; //导入依赖的package包/类
public final void visitLdcInsn(Object cst) {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("",
"cst",
"cst",
"",
SAXClassAdapter.encode(cst.toString()));
attrs.addAttribute("",
"desc",
"desc",
"",
Type.getDescriptor(cst.getClass()));
addElement(AbstractVisitor.OPCODES[Opcodes.LDC], attrs);
}
示例7: test
import org.objectweb.asm.util.AbstractVisitor; //导入依赖的package包/类
public void test() throws Exception {
String n = "org.objectweb.asm.attrs.StackMapTableSample";
InputStream is = StackMapTableAttributeTest.class.getResourceAsStream(StackMapTableAttributeTest.TEST_CLASS);
ClassReader cr = new ClassReader(is);
StringWriter sw = new StringWriter();
ASMifierClassVisitor cv = new ASMifierClassVisitor(new PrintWriter(sw));
cr.accept(cv, AbstractVisitor.getDefaultAttributes(), false);
String generated = sw.toString();
byte[] generatorClassData;
try {
generatorClassData = ASMifierTest.COMPILER.compile(n, generated);
System.err.println(generated);
} catch (Exception ex) {
System.err.println(generated);
System.err.println("------------------");
throw ex;
}
Class c = ASMifierTest.LOADER.defineClass("asm." + n + "Dump",
generatorClassData);
Method m = c.getMethod("dump", new Class[0]);
byte[] b = (byte[]) m.invoke(null, new Object[0]);
assertEquals(cr, new ClassReader(b));
}
示例8: visitInsn
import org.objectweb.asm.util.AbstractVisitor; //导入依赖的package包/类
public final void visitInsn(int opcode) {
addElement(AbstractVisitor.OPCODES[opcode], new AttributesImpl());
}
示例9: visitIntInsn
import org.objectweb.asm.util.AbstractVisitor; //导入依赖的package包/类
public final void visitIntInsn(int opcode, int operand) {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "value", "value", "", Integer.toString(operand));
addElement(AbstractVisitor.OPCODES[opcode], attrs);
}
示例10: visitVarInsn
import org.objectweb.asm.util.AbstractVisitor; //导入依赖的package包/类
public final void visitVarInsn(int opcode, int var) {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "var", "var", "", Integer.toString(var));
addElement(AbstractVisitor.OPCODES[opcode], attrs);
}
示例11: visitTypeInsn
import org.objectweb.asm.util.AbstractVisitor; //导入依赖的package包/类
public final void visitTypeInsn(int opcode, String desc) {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "desc", "desc", "", desc);
addElement(AbstractVisitor.OPCODES[opcode], attrs);
}
示例12: visitJumpInsn
import org.objectweb.asm.util.AbstractVisitor; //导入依赖的package包/类
public final void visitJumpInsn(int opcode, Label label) {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "label", "label", "", getLabel(label));
addElement(AbstractVisitor.OPCODES[opcode], attrs);
}
示例13: visitIincInsn
import org.objectweb.asm.util.AbstractVisitor; //导入依赖的package包/类
public final void visitIincInsn(int var, int increment) {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "var", "var", "", Integer.toString(var));
attrs.addAttribute("", "inc", "inc", "", Integer.toString(increment));
addElement(AbstractVisitor.OPCODES[Opcodes.IINC], attrs);
}
示例14: visitMultiANewArrayInsn
import org.objectweb.asm.util.AbstractVisitor; //导入依赖的package包/类
public final void visitMultiANewArrayInsn(String desc, int dims) {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "desc", "desc", "", desc);
attrs.addAttribute("", "dims", "dims", "", Integer.toString(dims));
addElement(AbstractVisitor.OPCODES[Opcodes.MULTIANEWARRAY], attrs);
}