1 30 package org.objectweb.asm.optimizer; 31 32 import org.objectweb.asm.AnnotationVisitor; 33 import org.objectweb.asm.Label; 34 import org.objectweb.asm.MethodAdapter; 35 import org.objectweb.asm.MethodVisitor; 36 37 43 public class MethodOptimizer extends MethodAdapter { 44 45 private NameMapping mapping; 46 47 public MethodOptimizer(final MethodVisitor mv, final NameMapping mapping) { 48 super(mv); 49 this.mapping = mapping; 50 } 51 52 56 public AnnotationVisitor visitAnnotationDefault() { 57 throw new UnsupportedOperationException (); 58 } 59 60 public AnnotationVisitor visitParameterAnnotation( 61 final int parameter, 62 final String desc, 63 final boolean visible) 64 { 65 throw new UnsupportedOperationException (); 66 } 67 68 public void visitTypeInsn(final int opcode, final String desc) { 69 mv.visitTypeInsn(opcode, desc.startsWith("[") 70 ? mapping.fix(desc) 71 : mapping.map(desc)); 72 } 73 74 public void visitFieldInsn( 75 final int opcode, 76 final String owner, 77 final String name, 78 final String desc) 79 { 80 mv.visitFieldInsn(opcode, mapping.map(owner), mapping.map(owner + "." 81 + name), mapping.fix(desc)); 82 } 83 84 public void visitMethodInsn( 85 final int opcode, 86 final String owner, 87 final String name, 88 final String desc) 89 { 90 mv.visitMethodInsn(opcode, mapping.map(owner), mapping.map(owner + "." 91 + name + desc), mapping.fix(desc)); 92 } 93 94 public void visitLocalVariable( 95 final String name, 96 final String desc, 97 final String signature, 98 final Label start, 99 final Label end, 100 final int index) 101 { 102 } 104 105 public void visitLineNumber(final int line, final Label start) { 106 } 108 } 109 | Popular Tags |