Manipulating Java Class Files with ASM 4 – Part One : Hello World!
The current stable version of ASM is 3.3. However version 4.0 RC2 is out. So, I am going to discuss that version here.
Event based processing vs in memory processing: ASM supports both event driven and in memory processing. Event driven processing is lightweight, but is a little limiting. On the other hand, in memory processing is more flexible and easy to use, but it is more heavy weight. The in memory processor internally uses the event driven processor, just like the DOM XML parser internally uses the SAX XML parser.
The following program demonstrates listening to class processing events.
ASMHelloWorld.java
package com.geekyarticles.asm; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.Attribute; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class ASMHelloWorld { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { ClassVisitor cl=new ClassVisitor(Opcodes.ASM4) { /** * Called when a class is visited. This is the method called first */ @Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { System.out.println("Visiting class: "+name); System.out.println("Class Major Version: "+version); System.out.println("Super class: "+superName); super.visit(version, access, name, signature, superName, interfaces); } /** * Invoked only when the class being visited is an inner class */ @Override public void visitOuterClass(String owner, String name, String desc) { System.out.println("Outer class: "+owner); super.visitOuterClass(owner, name, desc); } /** *Invoked when a class level annotation is encountered */ @Override public AnnotationVisitor visitAnnotation(String desc, boolean visible) { System.out.println("Annotation: "+desc); return super.visitAnnotation(desc, visible); } /** * When a class attribute is encountered */ @Override public void visitAttribute(Attribute attr) { System.out.println("Class Attribute: "+attr.type); super.visitAttribute(attr); } /** *When an inner class is encountered */ @Override public void visitInnerClass(String name, String outerName, String innerName, int access) { System.out.println("Inner Class: "+ innerName+" defined in "+outerName); super.visitInnerClass(name, outerName, innerName, access); } /** * When a field is encountered */ @Override public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { System.out.println("Field: "+name+" "+desc+" value:"+value); return super.visitField(access, name, desc, signature, value); } @Override public void visitEnd() { System.out.println("Method ends here"); super.visitEnd(); } /** * When a method is encountered */ @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { System.out.println("Method: "+name+" "+desc); return super.visitMethod(access, name, desc, signature, exceptions); } /** * When the optional source is encountered */ @Override public void visitSource(String source, String debug) { System.out.println("Source: "+source); super.visitSource(source, debug); } }; InputStream in=ASMHelloWorld.class.getResourceAsStream("/java/lang/String.class"); ClassReader classReader=new ClassReader(in); classReader.accept(cl, 0); } }
The above program does not do anything except printing what event is reached when. At this time, we are visiting the class java.lang.String. Note that in a java class, there is an order in which things appear. For example, methods always appear after the field. The events also occur in the same order. For more information, go through the class file format discussed in here.
The code itself is very straight forward, and does not need a lot of explanation. We first extend the class ClassVisitor and override the necessary methods. Then we set up a ClassReader and call its accept method passing the object of the ClassVisitor as a parameter.
New in version 4: Upto version 3.3, ClassVisitor was an interface, so we had to implement all the methods. To relieve the developer from this mess, there was ClassAdapter which had no op implementations of all methods, which the developer could extend. In version 4, ClassVisitor has become a class and ClassAdapter is no longer there.
Notice that some visitor methods return objects of other methods. The methods of those Visitor objects are called when the particular kind of object is traversed. The following example shows how to use a MethodVisitor to step through the method’s code.
DemoClassIntructionViewer.java
package com.geekyarticles.asm; import java.io.InputStream; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.commons.InstructionAdapter; public class DemoClassInstructionViewer { public static class MethodPrinterVisitor extends ClassVisitor{ public MethodPrinterVisitor(int api, ClassVisitor cv) { super(api, cv); } public MethodPrinterVisitor(int api) { super(api); } @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { System.out.println("\n"+name+desc); MethodVisitor oriMv= new MethodVisitor(4) { }; //An instructionAdapter is a special MethodVisitor that //lets us process instructions easily InstructionAdapter instMv=new InstructionAdapter(oriMv){ @Override public void visitInsn(int opcode) { System.out.println(opcode); super.visitInsn(opcode); } }; return instMv; } } public static void main(String[] args) throws Exception{ InputStream in=ASMHelloWorld.class.getResourceAsStream("/com/geekyarticles/asm/ASMHelloWorld.class"); ClassReader classReader=new ClassReader(in); classReader.accept(new MethodPrinterVisitor(4), 0); } }
The following is the output in this case.
<init>()V 177 main([Ljava/lang/String;)V 89 89 3 177
Note that the instructions are direct opcodes.
Generating Class: Before discussing the details of generating a class, I will talk about a real cool thing that is available in ASM. Its called ASMifier. Its a class that prints the code requred to generate a given class. The following example shows how to use ASMifier. The class has got a main method and hence can be used from the command prompt.
java -cp asm-all-4.0_RC2.jar org.objectweb.asm.util.ASMifier java.lang.String>>StringDump.java
And the following is the output.
StringDump.java
package asm.java.lang; import java.util.*; import org.objectweb.asm.*; import org.objectweb.asm.attrs.*; public class StringDump implements Opcodes { public static byte[] dump () throws Exception { ClassWriter cw = new ClassWriter(0); FieldVisitor fv; MethodVisitor mv; AnnotationVisitor av0; cw.visit(V1_5, ACC_PUBLIC + ACC_FINAL + ACC_SUPER, "java/lang/String", "Ljava/lang/Object;Ljava/io/Serializable;Ljava/lang/Comparable<Ljava/lang/String;>;Ljava/lang/CharSequence;", "java/lang/Object", new String[] { "java/io/Serializable", "java/lang/Comparable", "java/lang/CharSequence" }); cw.visitInnerClass("java/lang/String$1", "java/lang/String", null, ACC_STATIC + ACC_SYNTHETIC); cw.visitInnerClass("java/lang/String$CaseInsensitiveComparator", "java/lang/String", "CaseInsensitiveComparator", ACC_PRIVATE + ACC_STATIC); { fv = cw.visitField(ACC_PRIVATE + ACC_FINAL, "value", "[C", null, null); fv.visitEnd(); } { fv = cw.visitField(ACC_PRIVATE + ACC_FINAL, "offset", "I", null, null); fv.visitEnd(); } { fv = cw.visitField(ACC_PRIVATE + ACC_FINAL, "count", "I", null, null); fv.visitEnd(); } { fv = cw.visitField(ACC_PRIVATE, "hash", "I", null, null); fv.visitEnd(); } { fv = cw.visitField(ACC_PRIVATE + ACC_FINAL + ACC_STATIC, "serialVersionUID", "J", null, new Long(-6849794470754667710L)); fv.visitEnd(); } { fv = cw.visitField(ACC_PRIVATE + ACC_FINAL + ACC_STATIC, "serialPersistentFields", "[Ljava/io/ObjectStreamField;", null, null); fv.visitEnd(); } { fv = cw.visitField(ACC_PUBLIC + ACC_FINAL + ACC_STATIC, "CASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;", "Ljava/util/Comparator<Ljava/lang/String;>;", null); fv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitIntInsn(NEWARRAY, T_CHAR); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "value", "[C"); mv.visitInsn(RETURN); mv.visitMaxs(2, 1); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(Ljava/lang/String;)V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ISTORE, 2); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 3); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(ARRAYLENGTH); mv.visitVarInsn(ILOAD, 2); Label l0 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l0); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ISTORE, 5); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 5); mv.visitVarInsn(ILOAD, 5); mv.visitVarInsn(ILOAD, 2); mv.visitInsn(IADD); mv.visitMethodInsn(INVOKESTATIC, "java/util/Arrays", "copyOfRange", "([CII)[C"); mv.visitVarInsn(ASTORE, 4); Label l1 = new Label(); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ASTORE, 4); mv.visitLabel(l1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 2); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 4); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "value", "[C"); mv.visitInsn(RETURN); mv.visitMaxs(4, 6); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "([C)V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ARRAYLENGTH); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKESTATIC, "java/lang/StringValue", "from", "([C)[C"); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "value", "[C"); mv.visitInsn(RETURN); mv.visitMaxs(2, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "([CII)V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitVarInsn(ILOAD, 2); Label l0 = new Label(); mv.visitJumpInsn(IFGE, l0); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l0); mv.visitVarInsn(ILOAD, 3); Label l1 = new Label(); mv.visitJumpInsn(IFGE, l1); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 3); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ARRAYLENGTH); mv.visitVarInsn(ILOAD, 3); mv.visitInsn(ISUB); Label l2 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l2); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 3); mv.visitInsn(IADD); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l2); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 3); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 3); mv.visitInsn(IADD); mv.visitMethodInsn(INVOKESTATIC, "java/util/Arrays", "copyOfRange", "([CII)[C"); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "value", "[C"); mv.visitInsn(RETURN); mv.visitMaxs(5, 4); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "([III)V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitVarInsn(ILOAD, 2); Label l0 = new Label(); mv.visitJumpInsn(IFGE, l0); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l0); mv.visitVarInsn(ILOAD, 3); Label l1 = new Label(); mv.visitJumpInsn(IFGE, l1); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 3); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ARRAYLENGTH); mv.visitVarInsn(ILOAD, 3); mv.visitInsn(ISUB); Label l2 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l2); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 3); mv.visitInsn(IADD); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l2); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 4); mv.visitInsn(ICONST_1); mv.visitVarInsn(ISTORE, 5); mv.visitVarInsn(ILOAD, 3); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(IADD); mv.visitIntInsn(NEWARRAY, T_CHAR); mv.visitVarInsn(ASTORE, 6); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ISTORE, 7); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 8); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 9); Label l3 = new Label(); mv.visitLabel(l3); mv.visitVarInsn(ILOAD, 9); mv.visitVarInsn(ILOAD, 3); Label l4 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l4); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 7); mv.visitIincInsn(7, 1); mv.visitInsn(IALOAD); mv.visitVarInsn(ISTORE, 10); mv.visitVarInsn(ILOAD, 10); Label l5 = new Label(); mv.visitJumpInsn(IFGE, l5); mv.visitTypeInsn(NEW, "java/lang/IllegalArgumentException"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/IllegalArgumentException", "<init>", "()V"); mv.visitInsn(ATHROW); mv.visitLabel(l5); mv.visitVarInsn(ILOAD, 5); Label l6 = new Label(); mv.visitJumpInsn(IFGT, l6); mv.visitVarInsn(ILOAD, 8); mv.visitInsn(ICONST_1); mv.visitInsn(IADD); mv.visitVarInsn(ALOAD, 6); mv.visitInsn(ARRAYLENGTH); mv.visitJumpInsn(IF_ICMPLT, l6); mv.visitVarInsn(ILOAD, 4); Label l7 = new Label(); mv.visitJumpInsn(IFNE, l7); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(INEG); mv.visitInsn(ICONST_1); mv.visitInsn(IADD); mv.visitVarInsn(ILOAD, 3); mv.visitInsn(IMUL); mv.visitIntInsn(BIPUSH, 10); mv.visitInsn(ISHL); mv.visitVarInsn(ILOAD, 9); mv.visitInsn(IDIV); mv.visitVarInsn(ISTORE, 4); mv.visitVarInsn(ILOAD, 4); mv.visitIntInsn(BIPUSH, 10); mv.visitInsn(ISHR); mv.visitVarInsn(ISTORE, 4); mv.visitVarInsn(ILOAD, 4); Label l8 = new Label(); mv.visitJumpInsn(IFGT, l8); mv.visitInsn(ICONST_1); mv.visitVarInsn(ISTORE, 4); mv.visitJumpInsn(GOTO, l8); mv.visitLabel(l7); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(ICONST_2); mv.visitInsn(IMUL); mv.visitVarInsn(ISTORE, 4); mv.visitLabel(l8); mv.visitVarInsn(ALOAD, 6); mv.visitInsn(ARRAYLENGTH); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(IADD); mv.visitVarInsn(ILOAD, 3); mv.visitInsn(ICONST_2); mv.visitInsn(IMUL); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Math", "min", "(II)I"); mv.visitVarInsn(ISTORE, 11); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ALOAD, 6); mv.visitInsn(ARRAYLENGTH); mv.visitInsn(ISUB); mv.visitVarInsn(ILOAD, 3); mv.visitVarInsn(ILOAD, 9); mv.visitInsn(ISUB); mv.visitInsn(ISUB); mv.visitVarInsn(ISTORE, 5); mv.visitVarInsn(ALOAD, 6); mv.visitVarInsn(ILOAD, 11); mv.visitMethodInsn(INVOKESTATIC, "java/util/Arrays", "copyOf", "([CI)[C"); mv.visitVarInsn(ASTORE, 6); mv.visitLabel(l6); mv.visitVarInsn(ILOAD, 10); mv.visitLdcInsn(new Integer(65536)); Label l9 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l9); mv.visitVarInsn(ALOAD, 6); mv.visitVarInsn(ILOAD, 8); mv.visitIincInsn(8, 1); mv.visitVarInsn(ILOAD, 10); mv.visitInsn(I2C); mv.visitInsn(CASTORE); Label l10 = new Label(); mv.visitJumpInsn(GOTO, l10); mv.visitLabel(l9); mv.visitVarInsn(ILOAD, 10); mv.visitLdcInsn(new Integer(1114111)); Label l11 = new Label(); mv.visitJumpInsn(IF_ICMPGT, l11); mv.visitVarInsn(ILOAD, 10); mv.visitVarInsn(ALOAD, 6); mv.visitVarInsn(ILOAD, 8); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toSurrogates", "(I[CI)V"); mv.visitIincInsn(8, 2); mv.visitIincInsn(5, -1); mv.visitJumpInsn(GOTO, l10); mv.visitLabel(l11); mv.visitTypeInsn(NEW, "java/lang/IllegalArgumentException"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/IllegalArgumentException", "<init>", "()V"); mv.visitInsn(ATHROW); mv.visitLabel(l10); mv.visitIincInsn(9, 1); mv.visitJumpInsn(GOTO, l3); mv.visitLabel(l4); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 6); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 8); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "count", "I"); mv.visitInsn(RETURN); mv.visitMaxs(4, 12); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_DEPRECATED, "<init>", "([BIII)V", null, null); { av0 = mv.visitAnnotation("Ljava/lang/Deprecated;", true); av0.visitEnd(); } mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 3); mv.visitVarInsn(ILOAD, 4); mv.visitMethodInsn(INVOKESTATIC, "java/lang/String", "checkBounds", "([BII)V"); mv.visitVarInsn(ILOAD, 4); mv.visitIntInsn(NEWARRAY, T_CHAR); mv.visitVarInsn(ASTORE, 5); mv.visitVarInsn(ILOAD, 2); Label l0 = new Label(); mv.visitJumpInsn(IFNE, l0); mv.visitVarInsn(ILOAD, 4); mv.visitVarInsn(ISTORE, 6); Label l1 = new Label(); mv.visitLabel(l1); mv.visitVarInsn(ILOAD, 6); mv.visitIincInsn(6, -1); Label l2 = new Label(); mv.visitJumpInsn(IFLE, l2); mv.visitVarInsn(ALOAD, 5); mv.visitVarInsn(ILOAD, 6); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 6); mv.visitVarInsn(ILOAD, 3); mv.visitInsn(IADD); mv.visitInsn(BALOAD); mv.visitIntInsn(SIPUSH, 255); mv.visitInsn(IAND); mv.visitInsn(I2C); mv.visitInsn(CASTORE); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l2); Label l3 = new Label(); mv.visitJumpInsn(GOTO, l3); mv.visitLabel(l0); mv.visitVarInsn(ILOAD, 2); mv.visitIntInsn(BIPUSH, 8); mv.visitInsn(ISHL); mv.visitVarInsn(ISTORE, 2); mv.visitVarInsn(ILOAD, 4); mv.visitVarInsn(ISTORE, 6); Label l4 = new Label(); mv.visitLabel(l4); mv.visitVarInsn(ILOAD, 6); mv.visitIincInsn(6, -1); mv.visitJumpInsn(IFLE, l3); mv.visitVarInsn(ALOAD, 5); mv.visitVarInsn(ILOAD, 6); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 6); mv.visitVarInsn(ILOAD, 3); mv.visitInsn(IADD); mv.visitInsn(BALOAD); mv.visitIntInsn(SIPUSH, 255); mv.visitInsn(IAND); mv.visitInsn(IOR); mv.visitInsn(I2C); mv.visitInsn(CASTORE); mv.visitJumpInsn(GOTO, l4); mv.visitLabel(l3); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 4); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 5); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "value", "[C"); mv.visitInsn(RETURN); mv.visitMaxs(6, 7); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_DEPRECATED, "<init>", "([BI)V", null, null); { av0 = mv.visitAnnotation("Ljava/lang/Deprecated;", true); av0.visitEnd(); } mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ARRAYLENGTH); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/String", "<init>", "([BIII)V"); mv.visitInsn(RETURN); mv.visitMaxs(5, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC, "checkBounds", "([BII)V", null, null); mv.visitCode(); mv.visitVarInsn(ILOAD, 2); Label l0 = new Label(); mv.visitJumpInsn(IFGE, l0); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l0); mv.visitVarInsn(ILOAD, 1); Label l1 = new Label(); mv.visitJumpInsn(IFGE, l1); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 1); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l1); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ARRAYLENGTH); mv.visitVarInsn(ILOAD, 2); mv.visitInsn(ISUB); Label l2 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l2); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitInsn(IADD); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l2); mv.visitInsn(RETURN); mv.visitMaxs(4, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "([BIILjava/lang/String;)V", null, new String[] { "java/io/UnsupportedEncodingException" }); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitVarInsn(ALOAD, 4); Label l0 = new Label(); mv.visitJumpInsn(IFNONNULL, l0); mv.visitTypeInsn(NEW, "java/lang/NullPointerException"); mv.visitInsn(DUP); mv.visitLdcInsn("charsetName"); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NullPointerException", "<init>", "(Ljava/lang/String;)V"); mv.visitInsn(ATHROW); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 3); mv.visitMethodInsn(INVOKESTATIC, "java/lang/String", "checkBounds", "([BII)V"); mv.visitVarInsn(ALOAD, 4); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 3); mv.visitMethodInsn(INVOKESTATIC, "java/lang/StringCoding", "decode", "(Ljava/lang/String;[BII)[C"); mv.visitVarInsn(ASTORE, 5); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 5); mv.visitInsn(ARRAYLENGTH); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 5); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "value", "[C"); mv.visitInsn(RETURN); mv.visitMaxs(4, 6); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "([BIILjava/nio/charset/Charset;)V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitVarInsn(ALOAD, 4); Label l0 = new Label(); mv.visitJumpInsn(IFNONNULL, l0); mv.visitTypeInsn(NEW, "java/lang/NullPointerException"); mv.visitInsn(DUP); mv.visitLdcInsn("charset"); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NullPointerException", "<init>", "(Ljava/lang/String;)V"); mv.visitInsn(ATHROW); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 3); mv.visitMethodInsn(INVOKESTATIC, "java/lang/String", "checkBounds", "([BII)V"); mv.visitVarInsn(ALOAD, 4); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 3); mv.visitMethodInsn(INVOKESTATIC, "java/lang/StringCoding", "decode", "(Ljava/nio/charset/Charset;[BII)[C"); mv.visitVarInsn(ASTORE, 5); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 5); mv.visitInsn(ARRAYLENGTH); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 5); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "value", "[C"); mv.visitInsn(RETURN); mv.visitMaxs(4, 6); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "([BLjava/lang/String;)V", null, new String[] { "java/io/UnsupportedEncodingException" }); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ARRAYLENGTH); mv.visitVarInsn(ALOAD, 2); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/String", "<init>", "([BIILjava/lang/String;)V"); mv.visitInsn(RETURN); mv.visitMaxs(5, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "([BLjava/nio/charset/Charset;)V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ARRAYLENGTH); mv.visitVarInsn(ALOAD, 2); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/String", "<init>", "([BIILjava/nio/charset/Charset;)V"); mv.visitInsn(RETURN); mv.visitMaxs(5, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "([BII)V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 3); mv.visitMethodInsn(INVOKESTATIC, "java/lang/String", "checkBounds", "([BII)V"); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 3); mv.visitMethodInsn(INVOKESTATIC, "java/lang/StringCoding", "decode", "([BII)[C"); mv.visitVarInsn(ASTORE, 4); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 4); mv.visitInsn(ARRAYLENGTH); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 4); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "value", "[C"); mv.visitInsn(RETURN); mv.visitMaxs(3, 5); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "([B)V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ARRAYLENGTH); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/String", "<init>", "([BII)V"); mv.visitInsn(RETURN); mv.visitMaxs(4, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(Ljava/lang/StringBuffer;)V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuffer", "toString", "()Ljava/lang/String;"); mv.visitVarInsn(ASTORE, 2); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 2); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 2); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 2); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "offset", "I"); mv.visitInsn(RETURN); mv.visitMaxs(2, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(Ljava/lang/StringBuilder;)V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "toString", "()Ljava/lang/String;"); mv.visitVarInsn(ASTORE, 2); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 2); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 2); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 2); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "offset", "I"); mv.visitInsn(RETURN); mv.visitMaxs(2, 3); mv.visitEnd(); } { mv = cw.visitMethod(0, "<init>", "(II[C)V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 3); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 1); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 2); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "count", "I"); mv.visitInsn(RETURN); mv.visitMaxs(2, 4); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "length", "()I", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitInsn(IRETURN); mv.visitMaxs(1, 1); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "isEmpty", "()Z", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); Label l0 = new Label(); mv.visitJumpInsn(IFNE, l0); mv.visitInsn(ICONST_1); Label l1 = new Label(); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l0); mv.visitInsn(ICONST_0); mv.visitLabel(l1); mv.visitInsn(IRETURN); mv.visitMaxs(1, 1); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "charAt", "(I)C", null, null); mv.visitCode(); mv.visitVarInsn(ILOAD, 1); Label l0 = new Label(); mv.visitJumpInsn(IFLT, l0); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); Label l1 = new Label(); mv.visitJumpInsn(IF_ICMPLT, l1); mv.visitLabel(l0); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 1); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitInsn(IADD); mv.visitInsn(CALOAD); mv.visitInsn(IRETURN); mv.visitMaxs(3, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "codePointAt", "(I)I", null, null); mv.visitCode(); mv.visitVarInsn(ILOAD, 1); Label l0 = new Label(); mv.visitJumpInsn(IFLT, l0); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); Label l1 = new Label(); mv.visitJumpInsn(IF_ICMPLT, l1); mv.visitLabel(l0); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 1); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(IADD); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitInsn(IADD); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "codePointAtImpl", "([CII)I"); mv.visitInsn(IRETURN); mv.visitMaxs(4, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "codePointBefore", "(I)I", null, null); mv.visitCode(); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(ICONST_1); mv.visitInsn(ISUB); mv.visitVarInsn(ISTORE, 2); mv.visitVarInsn(ILOAD, 2); Label l0 = new Label(); mv.visitJumpInsn(IFLT, l0); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); Label l1 = new Label(); mv.visitJumpInsn(IF_ICMPLT, l1); mv.visitLabel(l0); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 1); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(IADD); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "codePointBeforeImpl", "([CII)I"); mv.visitInsn(IRETURN); mv.visitMaxs(3, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "codePointCount", "(II)I", null, null); mv.visitCode(); mv.visitVarInsn(ILOAD, 1); Label l0 = new Label(); mv.visitJumpInsn(IFLT, l0); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitJumpInsn(IF_ICMPGT, l0); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ILOAD, 2); Label l1 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l1); mv.visitLabel(l0); mv.visitTypeInsn(NEW, "java/lang/IndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/IndexOutOfBoundsException", "<init>", "()V"); mv.visitInsn(ATHROW); mv.visitLabel(l1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(IADD); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(ISUB); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "codePointCountImpl", "([CII)I"); mv.visitInsn(IRETURN); mv.visitMaxs(4, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "offsetByCodePoints", "(II)I", null, null); mv.visitCode(); mv.visitVarInsn(ILOAD, 1); Label l0 = new Label(); mv.visitJumpInsn(IFLT, l0); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); Label l1 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l1); mv.visitLabel(l0); mv.visitTypeInsn(NEW, "java/lang/IndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/IndexOutOfBoundsException", "<init>", "()V"); mv.visitInsn(ATHROW); mv.visitLabel(l1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(IADD); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "offsetByCodePointsImpl", "([CIIII)I"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitInsn(ISUB); mv.visitInsn(IRETURN); mv.visitMaxs(5, 3); mv.visitEnd(); } { mv = cw.visitMethod(0, "getChars", "([CI)V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitMethodInsn(INVOKESTATIC, "java/lang/System", "arraycopy", "(Ljava/lang/Object;ILjava/lang/Object;II)V"); mv.visitInsn(RETURN); mv.visitMaxs(5, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "getChars", "(II[CI)V", null, null); mv.visitCode(); mv.visitVarInsn(ILOAD, 1); Label l0 = new Label(); mv.visitJumpInsn(IFGE, l0); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 1); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l0); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); Label l1 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l1); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l1); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ILOAD, 2); Label l2 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l2); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(ISUB); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(IADD); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 4); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(ISUB); mv.visitMethodInsn(INVOKESTATIC, "java/lang/System", "arraycopy", "(Ljava/lang/Object;ILjava/lang/Object;II)V"); mv.visitInsn(RETURN); mv.visitMaxs(6, 5); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_DEPRECATED, "getBytes", "(II[BI)V", null, null); { av0 = mv.visitAnnotation("Ljava/lang/Deprecated;", true); av0.visitEnd(); } mv.visitCode(); mv.visitVarInsn(ILOAD, 1); Label l0 = new Label(); mv.visitJumpInsn(IFGE, l0); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 1); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l0); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); Label l1 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l1); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l1); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ILOAD, 2); Label l2 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l2); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(ISUB); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l2); mv.visitVarInsn(ILOAD, 4); mv.visitVarInsn(ISTORE, 5); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 2); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 6); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 7); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 8); Label l3 = new Label(); mv.visitLabel(l3); mv.visitVarInsn(ILOAD, 7); mv.visitVarInsn(ILOAD, 6); Label l4 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l4); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 5); mv.visitIincInsn(5, 1); mv.visitVarInsn(ALOAD, 8); mv.visitVarInsn(ILOAD, 7); mv.visitIincInsn(7, 1); mv.visitInsn(CALOAD); mv.visitInsn(I2B); mv.visitInsn(BASTORE); mv.visitJumpInsn(GOTO, l3); mv.visitLabel(l4); mv.visitInsn(RETURN); mv.visitMaxs(4, 9); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "getBytes", "(Ljava/lang/String;)[B", null, new String[] { "java/io/UnsupportedEncodingException" }); mv.visitCode(); mv.visitVarInsn(ALOAD, 1); Label l0 = new Label(); mv.visitJumpInsn(IFNONNULL, l0); mv.visitTypeInsn(NEW, "java/lang/NullPointerException"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NullPointerException", "<init>", "()V"); mv.visitInsn(ATHROW); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitMethodInsn(INVOKESTATIC, "java/lang/StringCoding", "encode", "(Ljava/lang/String;[CII)[B"); mv.visitInsn(ARETURN); mv.visitMaxs(4, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "getBytes", "(Ljava/nio/charset/Charset;)[B", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 1); Label l0 = new Label(); mv.visitJumpInsn(IFNONNULL, l0); mv.visitTypeInsn(NEW, "java/lang/NullPointerException"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NullPointerException", "<init>", "()V"); mv.visitInsn(ATHROW); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitMethodInsn(INVOKESTATIC, "java/lang/StringCoding", "encode", "(Ljava/nio/charset/Charset;[CII)[B"); mv.visitInsn(ARETURN); mv.visitMaxs(4, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "getBytes", "()[B", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitMethodInsn(INVOKESTATIC, "java/lang/StringCoding", "encode", "([CII)[B"); mv.visitInsn(ARETURN); mv.visitMaxs(3, 1); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "equals", "(Ljava/lang/Object;)Z", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); Label l0 = new Label(); mv.visitJumpInsn(IF_ACMPNE, l0); mv.visitInsn(ICONST_1); mv.visitInsn(IRETURN); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, 1); mv.visitTypeInsn(INSTANCEOF, "java/lang/String"); Label l1 = new Label(); mv.visitJumpInsn(IFEQ, l1); mv.visitVarInsn(ALOAD, 1); mv.visitTypeInsn(CHECKCAST, "java/lang/String"); mv.visitVarInsn(ASTORE, 2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ISTORE, 3); mv.visitVarInsn(ILOAD, 3); mv.visitVarInsn(ALOAD, 2); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitJumpInsn(IF_ICMPNE, l1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 4); mv.visitVarInsn(ALOAD, 2); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 5); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ISTORE, 6); mv.visitVarInsn(ALOAD, 2); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ISTORE, 7); Label l2 = new Label(); mv.visitLabel(l2); mv.visitVarInsn(ILOAD, 3); mv.visitIincInsn(3, -1); Label l3 = new Label(); mv.visitJumpInsn(IFEQ, l3); mv.visitVarInsn(ALOAD, 4); mv.visitVarInsn(ILOAD, 6); mv.visitIincInsn(6, 1); mv.visitInsn(CALOAD); mv.visitVarInsn(ALOAD, 5); mv.visitVarInsn(ILOAD, 7); mv.visitIincInsn(7, 1); mv.visitInsn(CALOAD); mv.visitJumpInsn(IF_ICMPEQ, l2); mv.visitInsn(ICONST_0); mv.visitInsn(IRETURN); mv.visitLabel(l3); mv.visitInsn(ICONST_1); mv.visitInsn(IRETURN); mv.visitLabel(l1); mv.visitInsn(ICONST_0); mv.visitInsn(IRETURN); mv.visitMaxs(3, 8); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "contentEquals", "(Ljava/lang/StringBuffer;)Z", null, null); mv.visitCode(); Label l0 = new Label(); Label l1 = new Label(); Label l2 = new Label(); mv.visitTryCatchBlock(l0, l1, l2, null); Label l3 = new Label(); mv.visitTryCatchBlock(l2, l3, l2, null); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(DUP); mv.visitVarInsn(ASTORE, 2); mv.visitInsn(MONITORENTER); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "contentEquals", "(Ljava/lang/CharSequence;)Z"); mv.visitVarInsn(ALOAD, 2); mv.visitInsn(MONITOREXIT); mv.visitLabel(l1); mv.visitInsn(IRETURN); mv.visitLabel(l2); mv.visitVarInsn(ASTORE, 3); mv.visitVarInsn(ALOAD, 2); mv.visitInsn(MONITOREXIT); mv.visitLabel(l3); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(ATHROW); mv.visitMaxs(2, 4); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "contentEquals", "(Ljava/lang/CharSequence;)Z", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEINTERFACE, "java/lang/CharSequence", "length", "()I"); Label l0 = new Label(); mv.visitJumpInsn(IF_ICMPEQ, l0); mv.visitInsn(ICONST_0); mv.visitInsn(IRETURN); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, 1); mv.visitTypeInsn(INSTANCEOF, "java/lang/AbstractStringBuilder"); Label l1 = new Label(); mv.visitJumpInsn(IFEQ, l1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 2); mv.visitVarInsn(ALOAD, 1); mv.visitTypeInsn(CHECKCAST, "java/lang/AbstractStringBuilder"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/AbstractStringBuilder", "getValue", "()[C"); mv.visitVarInsn(ASTORE, 3); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ISTORE, 4); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 5); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ISTORE, 6); Label l2 = new Label(); mv.visitLabel(l2); mv.visitVarInsn(ILOAD, 6); mv.visitIincInsn(6, -1); mv.visitJumpInsn(IFEQ, l1); mv.visitVarInsn(ALOAD, 2); mv.visitVarInsn(ILOAD, 4); mv.visitIincInsn(4, 1); mv.visitInsn(CALOAD); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 5); mv.visitIincInsn(5, 1); mv.visitInsn(CALOAD); mv.visitJumpInsn(IF_ICMPEQ, l2); mv.visitInsn(ICONST_0); mv.visitInsn(IRETURN); mv.visitLabel(l1); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "equals", "(Ljava/lang/Object;)Z"); Label l3 = new Label(); mv.visitJumpInsn(IFEQ, l3); mv.visitInsn(ICONST_1); mv.visitInsn(IRETURN); mv.visitLabel(l3); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ISTORE, 3); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 4); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ISTORE, 5); Label l4 = new Label(); mv.visitLabel(l4); mv.visitVarInsn(ILOAD, 5); mv.visitIincInsn(5, -1); Label l5 = new Label(); mv.visitJumpInsn(IFEQ, l5); mv.visitVarInsn(ALOAD, 2); mv.visitVarInsn(ILOAD, 3); mv.visitIincInsn(3, 1); mv.visitInsn(CALOAD); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 4); mv.visitIincInsn(4, 1); mv.visitMethodInsn(INVOKEINTERFACE, "java/lang/CharSequence", "charAt", "(I)C"); mv.visitJumpInsn(IF_ICMPEQ, l4); mv.visitInsn(ICONST_0); mv.visitInsn(IRETURN); mv.visitLabel(l5); mv.visitInsn(ICONST_1); mv.visitInsn(IRETURN); mv.visitMaxs(3, 7); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "equalsIgnoreCase", "(Ljava/lang/String;)Z", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); Label l0 = new Label(); mv.visitJumpInsn(IF_ACMPNE, l0); mv.visitInsn(ICONST_1); Label l1 = new Label(); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, 1); Label l2 = new Label(); mv.visitJumpInsn(IFNULL, l2); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitJumpInsn(IF_ICMPNE, l2); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_1); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "regionMatches", "(ZILjava/lang/String;II)Z"); mv.visitJumpInsn(IFEQ, l2); mv.visitInsn(ICONST_1); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l2); mv.visitInsn(ICONST_0); mv.visitLabel(l1); mv.visitInsn(IRETURN); mv.visitMaxs(6, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "compareTo", "(Ljava/lang/String;)I", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ISTORE, 2); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ISTORE, 3); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 3); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Math", "min", "(II)I"); mv.visitVarInsn(ISTORE, 4); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 5); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 6); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ISTORE, 7); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ISTORE, 8); mv.visitVarInsn(ILOAD, 7); mv.visitVarInsn(ILOAD, 8); Label l0 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l0); mv.visitVarInsn(ILOAD, 7); mv.visitVarInsn(ISTORE, 9); mv.visitVarInsn(ILOAD, 4); mv.visitVarInsn(ILOAD, 7); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 10); Label l1 = new Label(); mv.visitLabel(l1); mv.visitVarInsn(ILOAD, 9); mv.visitVarInsn(ILOAD, 10); Label l2 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l2); mv.visitVarInsn(ALOAD, 5); mv.visitVarInsn(ILOAD, 9); mv.visitInsn(CALOAD); mv.visitVarInsn(ISTORE, 11); mv.visitVarInsn(ALOAD, 6); mv.visitVarInsn(ILOAD, 9); mv.visitInsn(CALOAD); mv.visitVarInsn(ISTORE, 12); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ILOAD, 12); Label l3 = new Label(); mv.visitJumpInsn(IF_ICMPEQ, l3); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ILOAD, 12); mv.visitInsn(ISUB); mv.visitInsn(IRETURN); mv.visitLabel(l3); mv.visitIincInsn(9, 1); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l2); Label l4 = new Label(); mv.visitJumpInsn(GOTO, l4); mv.visitLabel(l0); mv.visitVarInsn(ILOAD, 4); mv.visitIincInsn(4, -1); mv.visitJumpInsn(IFEQ, l4); mv.visitVarInsn(ALOAD, 5); mv.visitVarInsn(ILOAD, 7); mv.visitIincInsn(7, 1); mv.visitInsn(CALOAD); mv.visitVarInsn(ISTORE, 9); mv.visitVarInsn(ALOAD, 6); mv.visitVarInsn(ILOAD, 8); mv.visitIincInsn(8, 1); mv.visitInsn(CALOAD); mv.visitVarInsn(ISTORE, 10); mv.visitVarInsn(ILOAD, 9); mv.visitVarInsn(ILOAD, 10); Label l5 = new Label(); mv.visitJumpInsn(IF_ICMPEQ, l5); mv.visitVarInsn(ILOAD, 9); mv.visitVarInsn(ILOAD, 10); mv.visitInsn(ISUB); mv.visitInsn(IRETURN); mv.visitLabel(l5); mv.visitJumpInsn(GOTO, l0); mv.visitLabel(l4); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 3); mv.visitInsn(ISUB); mv.visitInsn(IRETURN); mv.visitMaxs(2, 13); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "compareToIgnoreCase", "(Ljava/lang/String;)I", null, null); mv.visitCode(); mv.visitFieldInsn(GETSTATIC, "java/lang/String", "CASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Comparator", "compare", "(Ljava/lang/Object;Ljava/lang/Object;)I"); mv.visitInsn(IRETURN); mv.visitMaxs(3, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "regionMatches", "(ILjava/lang/String;II)Z", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 5); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 6); mv.visitVarInsn(ALOAD, 2); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 7); mv.visitVarInsn(ALOAD, 2); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 3); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 8); mv.visitVarInsn(ILOAD, 3); Label l0 = new Label(); mv.visitJumpInsn(IFLT, l0); mv.visitVarInsn(ILOAD, 1); mv.visitJumpInsn(IFLT, l0); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(I2L); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitInsn(I2L); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(I2L); mv.visitInsn(LSUB); mv.visitInsn(LCMP); mv.visitJumpInsn(IFGT, l0); mv.visitVarInsn(ILOAD, 3); mv.visitInsn(I2L); mv.visitVarInsn(ALOAD, 2); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitInsn(I2L); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(I2L); mv.visitInsn(LSUB); mv.visitInsn(LCMP); Label l1 = new Label(); mv.visitJumpInsn(IFLE, l1); mv.visitLabel(l0); mv.visitInsn(ICONST_0); mv.visitInsn(IRETURN); mv.visitLabel(l1); mv.visitVarInsn(ILOAD, 4); mv.visitIincInsn(4, -1); Label l2 = new Label(); mv.visitJumpInsn(IFLE, l2); mv.visitVarInsn(ALOAD, 5); mv.visitVarInsn(ILOAD, 6); mv.visitIincInsn(6, 1); mv.visitInsn(CALOAD); mv.visitVarInsn(ALOAD, 7); mv.visitVarInsn(ILOAD, 8); mv.visitIincInsn(8, 1); mv.visitInsn(CALOAD); mv.visitJumpInsn(IF_ICMPEQ, l1); mv.visitInsn(ICONST_0); mv.visitInsn(IRETURN); mv.visitLabel(l2); mv.visitInsn(ICONST_1); mv.visitInsn(IRETURN); mv.visitMaxs(6, 9); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "regionMatches", "(ZILjava/lang/String;II)Z", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 6); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 2); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 7); mv.visitVarInsn(ALOAD, 3); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 8); mv.visitVarInsn(ALOAD, 3); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 9); mv.visitVarInsn(ILOAD, 4); Label l0 = new Label(); mv.visitJumpInsn(IFLT, l0); mv.visitVarInsn(ILOAD, 2); mv.visitJumpInsn(IFLT, l0); mv.visitVarInsn(ILOAD, 2); mv.visitInsn(I2L); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitInsn(I2L); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(I2L); mv.visitInsn(LSUB); mv.visitInsn(LCMP); mv.visitJumpInsn(IFGT, l0); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(I2L); mv.visitVarInsn(ALOAD, 3); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitInsn(I2L); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(I2L); mv.visitInsn(LSUB); mv.visitInsn(LCMP); Label l1 = new Label(); mv.visitJumpInsn(IFLE, l1); mv.visitLabel(l0); mv.visitInsn(ICONST_0); mv.visitInsn(IRETURN); mv.visitLabel(l1); mv.visitVarInsn(ILOAD, 5); mv.visitIincInsn(5, -1); Label l2 = new Label(); mv.visitJumpInsn(IFLE, l2); mv.visitVarInsn(ALOAD, 6); mv.visitVarInsn(ILOAD, 7); mv.visitIincInsn(7, 1); mv.visitInsn(CALOAD); mv.visitVarInsn(ISTORE, 10); mv.visitVarInsn(ALOAD, 8); mv.visitVarInsn(ILOAD, 9); mv.visitIincInsn(9, 1); mv.visitInsn(CALOAD); mv.visitVarInsn(ISTORE, 11); mv.visitVarInsn(ILOAD, 10); mv.visitVarInsn(ILOAD, 11); Label l3 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l3); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l3); mv.visitVarInsn(ILOAD, 1); Label l4 = new Label(); mv.visitJumpInsn(IFEQ, l4); mv.visitVarInsn(ILOAD, 10); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toUpperCase", "(C)C"); mv.visitVarInsn(ISTORE, 12); mv.visitVarInsn(ILOAD, 11); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toUpperCase", "(C)C"); mv.visitVarInsn(ISTORE, 13); mv.visitVarInsn(ILOAD, 12); mv.visitVarInsn(ILOAD, 13); Label l5 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l5); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l5); mv.visitVarInsn(ILOAD, 12); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toLowerCase", "(C)C"); mv.visitVarInsn(ILOAD, 13); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toLowerCase", "(C)C"); mv.visitJumpInsn(IF_ICMPNE, l4); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l4); mv.visitInsn(ICONST_0); mv.visitInsn(IRETURN); mv.visitLabel(l2); mv.visitInsn(ICONST_1); mv.visitInsn(IRETURN); mv.visitMaxs(6, 14); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "startsWith", "(Ljava/lang/String;I)Z", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 3); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 2); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 4); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 5); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ISTORE, 6); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ISTORE, 7); mv.visitVarInsn(ILOAD, 2); Label l0 = new Label(); mv.visitJumpInsn(IFLT, l0); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ILOAD, 7); mv.visitInsn(ISUB); Label l1 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l1); mv.visitLabel(l0); mv.visitInsn(ICONST_0); mv.visitInsn(IRETURN); mv.visitLabel(l1); mv.visitIincInsn(7, -1); mv.visitVarInsn(ILOAD, 7); Label l2 = new Label(); mv.visitJumpInsn(IFLT, l2); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 4); mv.visitIincInsn(4, 1); mv.visitInsn(CALOAD); mv.visitVarInsn(ALOAD, 5); mv.visitVarInsn(ILOAD, 6); mv.visitIincInsn(6, 1); mv.visitInsn(CALOAD); mv.visitJumpInsn(IF_ICMPEQ, l1); mv.visitInsn(ICONST_0); mv.visitInsn(IRETURN); mv.visitLabel(l2); mv.visitInsn(ICONST_1); mv.visitInsn(IRETURN); mv.visitMaxs(3, 8); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "startsWith", "(Ljava/lang/String;)Z", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ICONST_0); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "startsWith", "(Ljava/lang/String;I)Z"); mv.visitInsn(IRETURN); mv.visitMaxs(3, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "endsWith", "(Ljava/lang/String;)Z", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitInsn(ISUB); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "startsWith", "(Ljava/lang/String;I)Z"); mv.visitInsn(IRETURN); mv.visitMaxs(4, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "hashCode", "()I", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "hash", "I"); mv.visitVarInsn(ISTORE, 1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ISTORE, 2); mv.visitVarInsn(ILOAD, 1); Label l0 = new Label(); mv.visitJumpInsn(IFNE, l0); mv.visitVarInsn(ILOAD, 2); mv.visitJumpInsn(IFLE, l0); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ISTORE, 3); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 4); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 5); Label l1 = new Label(); mv.visitLabel(l1); mv.visitVarInsn(ILOAD, 5); mv.visitVarInsn(ILOAD, 2); Label l2 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l2); mv.visitIntInsn(BIPUSH, 31); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(IMUL); mv.visitVarInsn(ALOAD, 4); mv.visitVarInsn(ILOAD, 3); mv.visitIincInsn(3, 1); mv.visitInsn(CALOAD); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 1); mv.visitIincInsn(5, 1); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l2); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 1); mv.visitFieldInsn(PUTFIELD, "java/lang/String", "hash", "I"); mv.visitLabel(l0); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(IRETURN); mv.visitMaxs(3, 6); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "indexOf", "(I)I", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(ICONST_0); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "indexOf", "(II)I"); mv.visitInsn(IRETURN); mv.visitMaxs(3, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "indexOf", "(II)I", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 3); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 4); mv.visitVarInsn(ILOAD, 2); Label l0 = new Label(); mv.visitJumpInsn(IFGE, l0); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 2); Label l1 = new Label(); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l0); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitJumpInsn(IF_ICMPLT, l1); mv.visitInsn(ICONST_M1); mv.visitInsn(IRETURN); mv.visitLabel(l1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 2); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 5); mv.visitVarInsn(ILOAD, 1); mv.visitLdcInsn(new Integer(65536)); Label l2 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l2); Label l3 = new Label(); mv.visitLabel(l3); mv.visitVarInsn(ILOAD, 5); mv.visitVarInsn(ILOAD, 3); Label l4 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l4); mv.visitVarInsn(ALOAD, 4); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(CALOAD); mv.visitVarInsn(ILOAD, 1); Label l5 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l5); mv.visitVarInsn(ILOAD, 5); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitInsn(ISUB); mv.visitInsn(IRETURN); mv.visitLabel(l5); mv.visitIincInsn(5, 1); mv.visitJumpInsn(GOTO, l3); mv.visitLabel(l4); mv.visitInsn(ICONST_M1); mv.visitInsn(IRETURN); mv.visitLabel(l2); mv.visitVarInsn(ILOAD, 1); mv.visitLdcInsn(new Integer(1114111)); Label l6 = new Label(); mv.visitJumpInsn(IF_ICMPGT, l6); mv.visitVarInsn(ILOAD, 1); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toChars", "(I)[C"); mv.visitVarInsn(ASTORE, 6); Label l7 = new Label(); mv.visitLabel(l7); mv.visitVarInsn(ILOAD, 5); mv.visitVarInsn(ILOAD, 3); mv.visitJumpInsn(IF_ICMPGE, l6); mv.visitVarInsn(ALOAD, 4); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(CALOAD); mv.visitVarInsn(ALOAD, 6); mv.visitInsn(ICONST_0); mv.visitInsn(CALOAD); Label l8 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l8); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(ICONST_1); mv.visitInsn(IADD); mv.visitVarInsn(ILOAD, 3); Label l9 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l9); mv.visitJumpInsn(GOTO, l6); mv.visitLabel(l9); mv.visitVarInsn(ALOAD, 4); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(ICONST_1); mv.visitInsn(IADD); mv.visitInsn(CALOAD); mv.visitVarInsn(ALOAD, 6); mv.visitInsn(ICONST_1); mv.visitInsn(CALOAD); mv.visitJumpInsn(IF_ICMPNE, l8); mv.visitVarInsn(ILOAD, 5); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitInsn(ISUB); mv.visitInsn(IRETURN); mv.visitLabel(l8); mv.visitIincInsn(5, 1); mv.visitJumpInsn(GOTO, l7); mv.visitLabel(l6); mv.visitInsn(ICONST_M1); mv.visitInsn(IRETURN); mv.visitMaxs(3, 7); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "lastIndexOf", "(I)I", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitInsn(ICONST_1); mv.visitInsn(ISUB); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "lastIndexOf", "(II)I"); mv.visitInsn(IRETURN); mv.visitMaxs(4, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "lastIndexOf", "(II)I", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ISTORE, 3); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 4); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); Label l0 = new Label(); mv.visitJumpInsn(IF_ICMPLT, l0); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitInsn(ICONST_1); mv.visitInsn(ISUB); Label l1 = new Label(); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l0); mv.visitVarInsn(ILOAD, 2); mv.visitLabel(l1); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 5); mv.visitVarInsn(ILOAD, 1); mv.visitLdcInsn(new Integer(65536)); Label l2 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l2); Label l3 = new Label(); mv.visitLabel(l3); mv.visitVarInsn(ILOAD, 5); mv.visitVarInsn(ILOAD, 3); Label l4 = new Label(); mv.visitJumpInsn(IF_ICMPLT, l4); mv.visitVarInsn(ALOAD, 4); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(CALOAD); mv.visitVarInsn(ILOAD, 1); Label l5 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l5); mv.visitVarInsn(ILOAD, 5); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitInsn(ISUB); mv.visitInsn(IRETURN); mv.visitLabel(l5); mv.visitIincInsn(5, -1); mv.visitJumpInsn(GOTO, l3); mv.visitLabel(l4); mv.visitInsn(ICONST_M1); mv.visitInsn(IRETURN); mv.visitLabel(l2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 6); mv.visitVarInsn(ILOAD, 1); mv.visitLdcInsn(new Integer(1114111)); Label l6 = new Label(); mv.visitJumpInsn(IF_ICMPGT, l6); mv.visitVarInsn(ILOAD, 1); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toChars", "(I)[C"); mv.visitVarInsn(ASTORE, 7); Label l7 = new Label(); mv.visitLabel(l7); mv.visitVarInsn(ILOAD, 5); mv.visitVarInsn(ILOAD, 3); mv.visitJumpInsn(IF_ICMPLT, l6); mv.visitVarInsn(ALOAD, 4); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(CALOAD); mv.visitVarInsn(ALOAD, 7); mv.visitInsn(ICONST_0); mv.visitInsn(CALOAD); Label l8 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l8); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(ICONST_1); mv.visitInsn(IADD); mv.visitVarInsn(ILOAD, 6); Label l9 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l9); mv.visitJumpInsn(GOTO, l6); mv.visitLabel(l9); mv.visitVarInsn(ALOAD, 4); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(ICONST_1); mv.visitInsn(IADD); mv.visitInsn(CALOAD); mv.visitVarInsn(ALOAD, 7); mv.visitInsn(ICONST_1); mv.visitInsn(CALOAD); mv.visitJumpInsn(IF_ICMPNE, l8); mv.visitVarInsn(ILOAD, 5); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitInsn(ISUB); mv.visitInsn(IRETURN); mv.visitLabel(l8); mv.visitIincInsn(5, -1); mv.visitJumpInsn(GOTO, l7); mv.visitLabel(l6); mv.visitInsn(ICONST_M1); mv.visitInsn(IRETURN); mv.visitMaxs(3, 8); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "indexOf", "(Ljava/lang/String;)I", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ICONST_0); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "indexOf", "(Ljava/lang/String;I)I"); mv.visitInsn(IRETURN); mv.visitMaxs(3, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "indexOf", "(Ljava/lang/String;I)I", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKESTATIC, "java/lang/String", "indexOf", "([CII[CIII)I"); mv.visitInsn(IRETURN); mv.visitMaxs(7, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_STATIC, "indexOf", "([CII[CIII)I", null, null); mv.visitCode(); mv.visitVarInsn(ILOAD, 6); mv.visitVarInsn(ILOAD, 2); Label l0 = new Label(); mv.visitJumpInsn(IF_ICMPLT, l0); mv.visitVarInsn(ILOAD, 5); Label l1 = new Label(); mv.visitJumpInsn(IFNE, l1); mv.visitVarInsn(ILOAD, 2); Label l2 = new Label(); mv.visitJumpInsn(GOTO, l2); mv.visitLabel(l1); mv.visitInsn(ICONST_M1); mv.visitLabel(l2); mv.visitInsn(IRETURN); mv.visitLabel(l0); mv.visitVarInsn(ILOAD, 6); Label l3 = new Label(); mv.visitJumpInsn(IFGE, l3); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 6); mv.visitLabel(l3); mv.visitVarInsn(ILOAD, 5); Label l4 = new Label(); mv.visitJumpInsn(IFNE, l4); mv.visitVarInsn(ILOAD, 6); mv.visitInsn(IRETURN); mv.visitLabel(l4); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(CALOAD); mv.visitVarInsn(ISTORE, 7); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(ISUB); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 8); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ILOAD, 6); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 9); Label l5 = new Label(); mv.visitLabel(l5); mv.visitVarInsn(ILOAD, 9); mv.visitVarInsn(ILOAD, 8); Label l6 = new Label(); mv.visitJumpInsn(IF_ICMPGT, l6); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 9); mv.visitInsn(CALOAD); mv.visitVarInsn(ILOAD, 7); Label l7 = new Label(); mv.visitJumpInsn(IF_ICMPEQ, l7); Label l8 = new Label(); mv.visitLabel(l8); mv.visitIincInsn(9, 1); mv.visitVarInsn(ILOAD, 9); mv.visitVarInsn(ILOAD, 8); mv.visitJumpInsn(IF_ICMPGT, l7); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 9); mv.visitInsn(CALOAD); mv.visitVarInsn(ILOAD, 7); mv.visitJumpInsn(IF_ICMPEQ, l7); mv.visitJumpInsn(GOTO, l8); mv.visitLabel(l7); mv.visitVarInsn(ILOAD, 9); mv.visitVarInsn(ILOAD, 8); Label l9 = new Label(); mv.visitJumpInsn(IF_ICMPGT, l9); mv.visitVarInsn(ILOAD, 9); mv.visitInsn(ICONST_1); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 10); mv.visitVarInsn(ILOAD, 10); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(IADD); mv.visitInsn(ICONST_1); mv.visitInsn(ISUB); mv.visitVarInsn(ISTORE, 11); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(ICONST_1); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 12); Label l10 = new Label(); mv.visitLabel(l10); mv.visitVarInsn(ILOAD, 10); mv.visitVarInsn(ILOAD, 11); Label l11 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l11); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 10); mv.visitInsn(CALOAD); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 12); mv.visitInsn(CALOAD); mv.visitJumpInsn(IF_ICMPNE, l11); mv.visitIincInsn(10, 1); mv.visitIincInsn(12, 1); mv.visitJumpInsn(GOTO, l10); mv.visitLabel(l11); mv.visitVarInsn(ILOAD, 10); mv.visitVarInsn(ILOAD, 11); mv.visitJumpInsn(IF_ICMPNE, l9); mv.visitVarInsn(ILOAD, 9); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(ISUB); mv.visitInsn(IRETURN); mv.visitLabel(l9); mv.visitIincInsn(9, 1); mv.visitJumpInsn(GOTO, l5); mv.visitLabel(l6); mv.visitInsn(ICONST_M1); mv.visitInsn(IRETURN); mv.visitMaxs(3, 13); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "lastIndexOf", "(Ljava/lang/String;)I", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "lastIndexOf", "(Ljava/lang/String;I)I"); mv.visitInsn(IRETURN); mv.visitMaxs(3, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "lastIndexOf", "(Ljava/lang/String;I)I", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 1); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKESTATIC, "java/lang/String", "lastIndexOf", "([CII[CIII)I"); mv.visitInsn(IRETURN); mv.visitMaxs(7, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_STATIC, "lastIndexOf", "([CII[CIII)I", null, null); mv.visitCode(); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(ISUB); mv.visitVarInsn(ISTORE, 7); mv.visitVarInsn(ILOAD, 6); Label l0 = new Label(); mv.visitJumpInsn(IFGE, l0); mv.visitInsn(ICONST_M1); mv.visitInsn(IRETURN); mv.visitLabel(l0); mv.visitVarInsn(ILOAD, 6); mv.visitVarInsn(ILOAD, 7); Label l1 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l1); mv.visitVarInsn(ILOAD, 7); mv.visitVarInsn(ISTORE, 6); mv.visitLabel(l1); mv.visitVarInsn(ILOAD, 5); Label l2 = new Label(); mv.visitJumpInsn(IFNE, l2); mv.visitVarInsn(ILOAD, 6); mv.visitInsn(IRETURN); mv.visitLabel(l2); mv.visitVarInsn(ILOAD, 4); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(IADD); mv.visitInsn(ICONST_1); mv.visitInsn(ISUB); mv.visitVarInsn(ISTORE, 8); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 8); mv.visitInsn(CALOAD); mv.visitVarInsn(ISTORE, 9); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(IADD); mv.visitInsn(ICONST_1); mv.visitInsn(ISUB); mv.visitVarInsn(ISTORE, 10); mv.visitVarInsn(ILOAD, 10); mv.visitVarInsn(ILOAD, 6); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 11); Label l3 = new Label(); mv.visitLabel(l3); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ILOAD, 10); Label l4 = new Label(); mv.visitJumpInsn(IF_ICMPLT, l4); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 11); mv.visitInsn(CALOAD); mv.visitVarInsn(ILOAD, 9); mv.visitJumpInsn(IF_ICMPEQ, l4); mv.visitIincInsn(11, -1); mv.visitJumpInsn(GOTO, l3); mv.visitLabel(l4); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ILOAD, 10); Label l5 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l5); mv.visitInsn(ICONST_M1); mv.visitInsn(IRETURN); mv.visitLabel(l5); mv.visitVarInsn(ILOAD, 11); mv.visitInsn(ICONST_1); mv.visitInsn(ISUB); mv.visitVarInsn(ISTORE, 12); mv.visitVarInsn(ILOAD, 12); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(ICONST_1); mv.visitInsn(ISUB); mv.visitInsn(ISUB); mv.visitVarInsn(ISTORE, 13); mv.visitVarInsn(ILOAD, 8); mv.visitInsn(ICONST_1); mv.visitInsn(ISUB); mv.visitVarInsn(ISTORE, 14); Label l6 = new Label(); mv.visitLabel(l6); mv.visitVarInsn(ILOAD, 12); mv.visitVarInsn(ILOAD, 13); Label l7 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l7); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 12); mv.visitIincInsn(12, -1); mv.visitInsn(CALOAD); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 14); mv.visitIincInsn(14, -1); mv.visitInsn(CALOAD); mv.visitJumpInsn(IF_ICMPEQ, l6); mv.visitIincInsn(11, -1); mv.visitJumpInsn(GOTO, l3); mv.visitLabel(l7); mv.visitVarInsn(ILOAD, 13); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(ISUB); mv.visitInsn(ICONST_1); mv.visitInsn(IADD); mv.visitInsn(IRETURN); mv.visitMaxs(3, 15); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "substring", "(I)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "substring", "(II)Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(3, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "substring", "(II)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ILOAD, 1); Label l0 = new Label(); mv.visitJumpInsn(IFGE, l0); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 1); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l0); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); Label l1 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l1); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l1); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ILOAD, 2); Label l2 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l2); mv.visitTypeInsn(NEW, "java/lang/StringIndexOutOfBoundsException"); mv.visitInsn(DUP); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(ISUB); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringIndexOutOfBoundsException", "<init>", "(I)V"); mv.visitInsn(ATHROW); mv.visitLabel(l2); mv.visitVarInsn(ILOAD, 1); Label l3 = new Label(); mv.visitJumpInsn(IFNE, l3); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitJumpInsn(IF_ICMPNE, l3); mv.visitVarInsn(ALOAD, 0); Label l4 = new Label(); mv.visitJumpInsn(GOTO, l4); mv.visitLabel(l3); mv.visitTypeInsn(NEW, "java/lang/String"); mv.visitInsn(DUP); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(IADD); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(ISUB); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/String", "<init>", "(II[C)V"); mv.visitLabel(l4); mv.visitInsn(ARETURN); mv.visitMaxs(5, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "subSequence", "(II)Ljava/lang/CharSequence;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "substring", "(II)Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(3, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "concat", "(Ljava/lang/String;)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "length", "()I"); mv.visitVarInsn(ISTORE, 2); mv.visitVarInsn(ILOAD, 2); Label l0 = new Label(); mv.visitJumpInsn(IFNE, l0); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ARETURN); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ILOAD, 2); mv.visitInsn(IADD); mv.visitIntInsn(NEWARRAY, T_CHAR); mv.visitVarInsn(ASTORE, 3); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(ICONST_0); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "getChars", "(II[CI)V"); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ICONST_0); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "getChars", "(II[CI)V"); mv.visitTypeInsn(NEW, "java/lang/String"); mv.visitInsn(DUP); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ILOAD, 2); mv.visitInsn(IADD); mv.visitVarInsn(ALOAD, 3); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/String", "<init>", "(II[C)V"); mv.visitInsn(ARETURN); mv.visitMaxs(5, 4); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "replace", "(CC)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ILOAD, 2); Label l0 = new Label(); mv.visitJumpInsn(IF_ICMPEQ, l0); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ISTORE, 3); mv.visitInsn(ICONST_M1); mv.visitVarInsn(ISTORE, 4); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 5); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ISTORE, 6); Label l1 = new Label(); mv.visitLabel(l1); mv.visitIincInsn(4, 1); mv.visitVarInsn(ILOAD, 4); mv.visitVarInsn(ILOAD, 3); Label l2 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l2); mv.visitVarInsn(ALOAD, 5); mv.visitVarInsn(ILOAD, 6); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(IADD); mv.visitInsn(CALOAD); mv.visitVarInsn(ILOAD, 1); mv.visitJumpInsn(IF_ICMPNE, l1); mv.visitJumpInsn(GOTO, l2); mv.visitLabel(l2); mv.visitVarInsn(ILOAD, 4); mv.visitVarInsn(ILOAD, 3); mv.visitJumpInsn(IF_ICMPGE, l0); mv.visitVarInsn(ILOAD, 3); mv.visitIntInsn(NEWARRAY, T_CHAR); mv.visitVarInsn(ASTORE, 7); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 8); Label l3 = new Label(); mv.visitLabel(l3); mv.visitVarInsn(ILOAD, 8); mv.visitVarInsn(ILOAD, 4); Label l4 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l4); mv.visitVarInsn(ALOAD, 7); mv.visitVarInsn(ILOAD, 8); mv.visitVarInsn(ALOAD, 5); mv.visitVarInsn(ILOAD, 6); mv.visitVarInsn(ILOAD, 8); mv.visitInsn(IADD); mv.visitInsn(CALOAD); mv.visitInsn(CASTORE); mv.visitIincInsn(8, 1); mv.visitJumpInsn(GOTO, l3); mv.visitLabel(l4); mv.visitVarInsn(ILOAD, 4); mv.visitVarInsn(ILOAD, 3); Label l5 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l5); mv.visitVarInsn(ALOAD, 5); mv.visitVarInsn(ILOAD, 6); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(IADD); mv.visitInsn(CALOAD); mv.visitVarInsn(ISTORE, 8); mv.visitVarInsn(ALOAD, 7); mv.visitVarInsn(ILOAD, 4); mv.visitVarInsn(ILOAD, 8); mv.visitVarInsn(ILOAD, 1); Label l6 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l6); mv.visitVarInsn(ILOAD, 2); Label l7 = new Label(); mv.visitJumpInsn(GOTO, l7); mv.visitLabel(l6); mv.visitVarInsn(ILOAD, 8); mv.visitLabel(l7); mv.visitInsn(CASTORE); mv.visitIincInsn(4, 1); mv.visitJumpInsn(GOTO, l4); mv.visitLabel(l5); mv.visitTypeInsn(NEW, "java/lang/String"); mv.visitInsn(DUP); mv.visitInsn(ICONST_0); mv.visitVarInsn(ILOAD, 3); mv.visitVarInsn(ALOAD, 7); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/String", "<init>", "(II[C)V"); mv.visitInsn(ARETURN); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ARETURN); mv.visitMaxs(5, 9); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "matches", "(Ljava/lang/String;)Z", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, "java/util/regex/Pattern", "matches", "(Ljava/lang/String;Ljava/lang/CharSequence;)Z"); mv.visitInsn(IRETURN); mv.visitMaxs(2, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "contains", "(Ljava/lang/CharSequence;)Z", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "toString", "()Ljava/lang/String;"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "indexOf", "(Ljava/lang/String;)I"); mv.visitInsn(ICONST_M1); Label l0 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l0); mv.visitInsn(ICONST_1); Label l1 = new Label(); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l0); mv.visitInsn(ICONST_0); mv.visitLabel(l1); mv.visitInsn(IRETURN); mv.visitMaxs(2, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "replaceFirst", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKESTATIC, "java/util/regex/Pattern", "compile", "(Ljava/lang/String;)Ljava/util/regex/Pattern;"); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/regex/Pattern", "matcher", "(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;"); mv.visitVarInsn(ALOAD, 2); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/regex/Matcher", "replaceFirst", "(Ljava/lang/String;)Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(2, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "replaceAll", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKESTATIC, "java/util/regex/Pattern", "compile", "(Ljava/lang/String;)Ljava/util/regex/Pattern;"); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/regex/Pattern", "matcher", "(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;"); mv.visitVarInsn(ALOAD, 2); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/regex/Matcher", "replaceAll", "(Ljava/lang/String;)Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(2, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "replace", "(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "toString", "()Ljava/lang/String;"); mv.visitIntInsn(BIPUSH, 16); mv.visitMethodInsn(INVOKESTATIC, "java/util/regex/Pattern", "compile", "(Ljava/lang/String;I)Ljava/util/regex/Pattern;"); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/regex/Pattern", "matcher", "(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;"); mv.visitVarInsn(ALOAD, 2); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "toString", "()Ljava/lang/String;"); mv.visitMethodInsn(INVOKESTATIC, "java/util/regex/Matcher", "quoteReplacement", "(Ljava/lang/String;)Ljava/lang/String;"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/regex/Matcher", "replaceAll", "(Ljava/lang/String;)Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(2, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "split", "(Ljava/lang/String;I)[Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKESTATIC, "java/util/regex/Pattern", "compile", "(Ljava/lang/String;)Ljava/util/regex/Pattern;"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/regex/Pattern", "split", "(Ljava/lang/CharSequence;I)[Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(3, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "split", "(Ljava/lang/String;)[Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ICONST_0); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "split", "(Ljava/lang/String;I)[Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(3, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "toLowerCase", "(Ljava/util/Locale;)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 1); Label l0 = new Label(); mv.visitJumpInsn(IFNONNULL, l0); mv.visitTypeInsn(NEW, "java/lang/NullPointerException"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NullPointerException", "<init>", "()V"); mv.visitInsn(ATHROW); mv.visitLabel(l0); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 2); Label l1 = new Label(); mv.visitLabel(l1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); Label l2 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 2); mv.visitInsn(IADD); mv.visitInsn(CALOAD); mv.visitVarInsn(ISTORE, 3); mv.visitVarInsn(ILOAD, 3); mv.visitLdcInsn(new Integer(55296)); Label l3 = new Label(); mv.visitJumpInsn(IF_ICMPLT, l3); mv.visitVarInsn(ILOAD, 3); mv.visitLdcInsn(new Integer(56319)); mv.visitJumpInsn(IF_ICMPGT, l3); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "codePointAt", "(I)I"); mv.visitVarInsn(ISTORE, 4); mv.visitVarInsn(ILOAD, 4); mv.visitVarInsn(ILOAD, 4); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toLowerCase", "(I)I"); Label l4 = new Label(); mv.visitJumpInsn(IF_ICMPEQ, l4); Label l5 = new Label(); mv.visitJumpInsn(GOTO, l5); mv.visitLabel(l4); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 4); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "charCount", "(I)I"); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 2); Label l6 = new Label(); mv.visitJumpInsn(GOTO, l6); mv.visitLabel(l3); mv.visitVarInsn(ILOAD, 3); mv.visitVarInsn(ILOAD, 3); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toLowerCase", "(C)C"); Label l7 = new Label(); mv.visitJumpInsn(IF_ICMPEQ, l7); mv.visitJumpInsn(GOTO, l5); mv.visitLabel(l7); mv.visitIincInsn(2, 1); mv.visitLabel(l6); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l2); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ARETURN); mv.visitLabel(l5); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitIntInsn(NEWARRAY, T_CHAR); mv.visitVarInsn(ASTORE, 3); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 4); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(ICONST_0); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKESTATIC, "java/lang/System", "arraycopy", "(Ljava/lang/Object;ILjava/lang/Object;II)V"); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/Locale", "getLanguage", "()Ljava/lang/String;"); mv.visitVarInsn(ASTORE, 5); mv.visitVarInsn(ALOAD, 5); mv.visitLdcInsn("tr"); Label l8 = new Label(); mv.visitJumpInsn(IF_ACMPEQ, l8); mv.visitVarInsn(ALOAD, 5); mv.visitLdcInsn("az"); mv.visitJumpInsn(IF_ACMPEQ, l8); mv.visitVarInsn(ALOAD, 5); mv.visitLdcInsn("lt"); Label l9 = new Label(); mv.visitJumpInsn(IF_ACMPNE, l9); mv.visitLabel(l8); mv.visitInsn(ICONST_1); Label l10 = new Label(); mv.visitJumpInsn(GOTO, l10); mv.visitLabel(l9); mv.visitInsn(ICONST_0); mv.visitLabel(l10); mv.visitVarInsn(ISTORE, 6); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ISTORE, 11); Label l11 = new Label(); mv.visitLabel(l11); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); Label l12 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l12); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 11); mv.visitInsn(IADD); mv.visitInsn(CALOAD); mv.visitVarInsn(ISTORE, 9); mv.visitVarInsn(ILOAD, 9); mv.visitInsn(I2C); mv.visitLdcInsn(new Integer(55296)); Label l13 = new Label(); mv.visitJumpInsn(IF_ICMPLT, l13); mv.visitVarInsn(ILOAD, 9); mv.visitInsn(I2C); mv.visitLdcInsn(new Integer(56319)); mv.visitJumpInsn(IF_ICMPGT, l13); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 11); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "codePointAt", "(I)I"); mv.visitVarInsn(ISTORE, 9); mv.visitVarInsn(ILOAD, 9); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "charCount", "(I)I"); mv.visitVarInsn(ISTORE, 10); Label l14 = new Label(); mv.visitJumpInsn(GOTO, l14); mv.visitLabel(l13); mv.visitInsn(ICONST_1); mv.visitVarInsn(ISTORE, 10); mv.visitLabel(l14); mv.visitVarInsn(ILOAD, 6); Label l15 = new Label(); mv.visitJumpInsn(IFNE, l15); mv.visitVarInsn(ILOAD, 9); mv.visitIntInsn(SIPUSH, 931); Label l16 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l16); mv.visitLabel(l15); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKESTATIC, "java/lang/ConditionalSpecialCasing", "toLowerCaseEx", "(Ljava/lang/String;ILjava/util/Locale;)I"); mv.visitVarInsn(ISTORE, 8); Label l17 = new Label(); mv.visitJumpInsn(GOTO, l17); mv.visitLabel(l16); mv.visitVarInsn(ILOAD, 9); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toLowerCase", "(I)I"); mv.visitVarInsn(ISTORE, 8); mv.visitLabel(l17); mv.visitVarInsn(ILOAD, 8); mv.visitInsn(ICONST_M1); Label l18 = new Label(); mv.visitJumpInsn(IF_ICMPEQ, l18); mv.visitVarInsn(ILOAD, 8); mv.visitLdcInsn(new Integer(65536)); Label l19 = new Label(); mv.visitJumpInsn(IF_ICMPLT, l19); mv.visitLabel(l18); mv.visitVarInsn(ILOAD, 8); mv.visitInsn(ICONST_M1); Label l20 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l20); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKESTATIC, "java/lang/ConditionalSpecialCasing", "toLowerCaseCharArray", "(Ljava/lang/String;ILjava/util/Locale;)[C"); mv.visitVarInsn(ASTORE, 7); Label l21 = new Label(); mv.visitJumpInsn(GOTO, l21); mv.visitLabel(l20); mv.visitVarInsn(ILOAD, 10); mv.visitInsn(ICONST_2); Label l22 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l22); mv.visitVarInsn(ILOAD, 4); mv.visitVarInsn(ILOAD, 8); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(IADD); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toChars", "(I[CI)I"); mv.visitVarInsn(ILOAD, 10); mv.visitInsn(ISUB); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 4); Label l23 = new Label(); mv.visitJumpInsn(GOTO, l23); mv.visitLabel(l22); mv.visitVarInsn(ILOAD, 8); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toChars", "(I)[C"); mv.visitVarInsn(ASTORE, 7); mv.visitLabel(l21); mv.visitVarInsn(ALOAD, 7); mv.visitInsn(ARRAYLENGTH); mv.visitVarInsn(ISTORE, 12); mv.visitVarInsn(ILOAD, 12); mv.visitVarInsn(ILOAD, 10); Label l24 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l24); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(ARRAYLENGTH); mv.visitVarInsn(ILOAD, 12); mv.visitInsn(IADD); mv.visitVarInsn(ILOAD, 10); mv.visitInsn(ISUB); mv.visitIntInsn(NEWARRAY, T_CHAR); mv.visitVarInsn(ASTORE, 13); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 13); mv.visitInsn(ICONST_0); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(IADD); mv.visitMethodInsn(INVOKESTATIC, "java/lang/System", "arraycopy", "(Ljava/lang/Object;ILjava/lang/Object;II)V"); mv.visitVarInsn(ALOAD, 13); mv.visitVarInsn(ASTORE, 3); mv.visitLabel(l24); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 13); Label l25 = new Label(); mv.visitLabel(l25); mv.visitVarInsn(ILOAD, 13); mv.visitVarInsn(ILOAD, 12); Label l26 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l26); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(IADD); mv.visitVarInsn(ILOAD, 13); mv.visitInsn(IADD); mv.visitVarInsn(ALOAD, 7); mv.visitVarInsn(ILOAD, 13); mv.visitInsn(CALOAD); mv.visitInsn(CASTORE); mv.visitIincInsn(13, 1); mv.visitJumpInsn(GOTO, l25); mv.visitLabel(l26); mv.visitVarInsn(ILOAD, 4); mv.visitVarInsn(ILOAD, 12); mv.visitVarInsn(ILOAD, 10); mv.visitInsn(ISUB); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 4); mv.visitJumpInsn(GOTO, l23); mv.visitLabel(l19); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(IADD); mv.visitVarInsn(ILOAD, 8); mv.visitInsn(I2C); mv.visitInsn(CASTORE); mv.visitLabel(l23); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ILOAD, 10); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 11); mv.visitJumpInsn(GOTO, l11); mv.visitLabel(l12); mv.visitTypeInsn(NEW, "java/lang/String"); mv.visitInsn(DUP); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(IADD); mv.visitVarInsn(ALOAD, 3); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/String", "<init>", "(II[C)V"); mv.visitInsn(ARETURN); mv.visitMaxs(6, 14); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "toLowerCase", "()Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, "java/util/Locale", "getDefault", "()Ljava/util/Locale;"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "toLowerCase", "(Ljava/util/Locale;)Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(2, 1); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "toUpperCase", "(Ljava/util/Locale;)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 1); Label l0 = new Label(); mv.visitJumpInsn(IFNONNULL, l0); mv.visitTypeInsn(NEW, "java/lang/NullPointerException"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NullPointerException", "<init>", "()V"); mv.visitInsn(ATHROW); mv.visitLabel(l0); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 2); Label l1 = new Label(); mv.visitLabel(l1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); Label l2 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 2); mv.visitInsn(IADD); mv.visitInsn(CALOAD); mv.visitVarInsn(ISTORE, 3); mv.visitVarInsn(ILOAD, 3); mv.visitLdcInsn(new Integer(55296)); Label l3 = new Label(); mv.visitJumpInsn(IF_ICMPLT, l3); mv.visitVarInsn(ILOAD, 3); mv.visitLdcInsn(new Integer(56319)); mv.visitJumpInsn(IF_ICMPGT, l3); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "codePointAt", "(I)I"); mv.visitVarInsn(ISTORE, 3); mv.visitVarInsn(ILOAD, 3); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "charCount", "(I)I"); mv.visitVarInsn(ISTORE, 4); Label l4 = new Label(); mv.visitJumpInsn(GOTO, l4); mv.visitLabel(l3); mv.visitInsn(ICONST_1); mv.visitVarInsn(ISTORE, 4); mv.visitLabel(l4); mv.visitVarInsn(ILOAD, 3); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toUpperCaseEx", "(I)I"); mv.visitVarInsn(ISTORE, 5); mv.visitVarInsn(ILOAD, 5); mv.visitInsn(ICONST_M1); Label l5 = new Label(); mv.visitJumpInsn(IF_ICMPEQ, l5); mv.visitVarInsn(ILOAD, 3); mv.visitVarInsn(ILOAD, 5); Label l6 = new Label(); mv.visitJumpInsn(IF_ICMPEQ, l6); mv.visitJumpInsn(GOTO, l5); mv.visitLabel(l6); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 2); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l2); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ARETURN); mv.visitLabel(l5); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitIntInsn(NEWARRAY, T_CHAR); mv.visitVarInsn(ASTORE, 3); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 4); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(ICONST_0); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKESTATIC, "java/lang/System", "arraycopy", "(Ljava/lang/Object;ILjava/lang/Object;II)V"); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/Locale", "getLanguage", "()Ljava/lang/String;"); mv.visitVarInsn(ASTORE, 5); mv.visitVarInsn(ALOAD, 5); mv.visitLdcInsn("tr"); Label l7 = new Label(); mv.visitJumpInsn(IF_ACMPEQ, l7); mv.visitVarInsn(ALOAD, 5); mv.visitLdcInsn("az"); mv.visitJumpInsn(IF_ACMPEQ, l7); mv.visitVarInsn(ALOAD, 5); mv.visitLdcInsn("lt"); Label l8 = new Label(); mv.visitJumpInsn(IF_ACMPNE, l8); mv.visitLabel(l7); mv.visitInsn(ICONST_1); Label l9 = new Label(); mv.visitJumpInsn(GOTO, l9); mv.visitLabel(l8); mv.visitInsn(ICONST_0); mv.visitLabel(l9); mv.visitVarInsn(ISTORE, 6); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ISTORE, 11); Label l10 = new Label(); mv.visitLabel(l10); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); Label l11 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l11); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ILOAD, 11); mv.visitInsn(IADD); mv.visitInsn(CALOAD); mv.visitVarInsn(ISTORE, 9); mv.visitVarInsn(ILOAD, 9); mv.visitInsn(I2C); mv.visitLdcInsn(new Integer(55296)); Label l12 = new Label(); mv.visitJumpInsn(IF_ICMPLT, l12); mv.visitVarInsn(ILOAD, 9); mv.visitInsn(I2C); mv.visitLdcInsn(new Integer(56319)); mv.visitJumpInsn(IF_ICMPGT, l12); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 11); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "codePointAt", "(I)I"); mv.visitVarInsn(ISTORE, 9); mv.visitVarInsn(ILOAD, 9); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "charCount", "(I)I"); mv.visitVarInsn(ISTORE, 10); Label l13 = new Label(); mv.visitJumpInsn(GOTO, l13); mv.visitLabel(l12); mv.visitInsn(ICONST_1); mv.visitVarInsn(ISTORE, 10); mv.visitLabel(l13); mv.visitVarInsn(ILOAD, 6); Label l14 = new Label(); mv.visitJumpInsn(IFEQ, l14); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKESTATIC, "java/lang/ConditionalSpecialCasing", "toUpperCaseEx", "(Ljava/lang/String;ILjava/util/Locale;)I"); mv.visitVarInsn(ISTORE, 8); Label l15 = new Label(); mv.visitJumpInsn(GOTO, l15); mv.visitLabel(l14); mv.visitVarInsn(ILOAD, 9); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toUpperCaseEx", "(I)I"); mv.visitVarInsn(ISTORE, 8); mv.visitLabel(l15); mv.visitVarInsn(ILOAD, 8); mv.visitInsn(ICONST_M1); Label l16 = new Label(); mv.visitJumpInsn(IF_ICMPEQ, l16); mv.visitVarInsn(ILOAD, 8); mv.visitLdcInsn(new Integer(65536)); Label l17 = new Label(); mv.visitJumpInsn(IF_ICMPLT, l17); mv.visitLabel(l16); mv.visitVarInsn(ILOAD, 8); mv.visitInsn(ICONST_M1); Label l18 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l18); mv.visitVarInsn(ILOAD, 6); Label l19 = new Label(); mv.visitJumpInsn(IFEQ, l19); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKESTATIC, "java/lang/ConditionalSpecialCasing", "toUpperCaseCharArray", "(Ljava/lang/String;ILjava/util/Locale;)[C"); mv.visitVarInsn(ASTORE, 7); Label l20 = new Label(); mv.visitJumpInsn(GOTO, l20); mv.visitLabel(l19); mv.visitVarInsn(ILOAD, 9); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toUpperCaseCharArray", "(I)[C"); mv.visitVarInsn(ASTORE, 7); mv.visitJumpInsn(GOTO, l20); mv.visitLabel(l18); mv.visitVarInsn(ILOAD, 10); mv.visitInsn(ICONST_2); Label l21 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l21); mv.visitVarInsn(ILOAD, 4); mv.visitVarInsn(ILOAD, 8); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(IADD); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toChars", "(I[CI)I"); mv.visitVarInsn(ILOAD, 10); mv.visitInsn(ISUB); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 4); Label l22 = new Label(); mv.visitJumpInsn(GOTO, l22); mv.visitLabel(l21); mv.visitVarInsn(ILOAD, 8); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "toChars", "(I)[C"); mv.visitVarInsn(ASTORE, 7); mv.visitLabel(l20); mv.visitVarInsn(ALOAD, 7); mv.visitInsn(ARRAYLENGTH); mv.visitVarInsn(ISTORE, 12); mv.visitVarInsn(ILOAD, 12); mv.visitVarInsn(ILOAD, 10); Label l23 = new Label(); mv.visitJumpInsn(IF_ICMPLE, l23); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(ARRAYLENGTH); mv.visitVarInsn(ILOAD, 12); mv.visitInsn(IADD); mv.visitVarInsn(ILOAD, 10); mv.visitInsn(ISUB); mv.visitIntInsn(NEWARRAY, T_CHAR); mv.visitVarInsn(ASTORE, 13); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 13); mv.visitInsn(ICONST_0); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(IADD); mv.visitMethodInsn(INVOKESTATIC, "java/lang/System", "arraycopy", "(Ljava/lang/Object;ILjava/lang/Object;II)V"); mv.visitVarInsn(ALOAD, 13); mv.visitVarInsn(ASTORE, 3); mv.visitLabel(l23); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 13); Label l24 = new Label(); mv.visitLabel(l24); mv.visitVarInsn(ILOAD, 13); mv.visitVarInsn(ILOAD, 12); Label l25 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l25); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(IADD); mv.visitVarInsn(ILOAD, 13); mv.visitInsn(IADD); mv.visitVarInsn(ALOAD, 7); mv.visitVarInsn(ILOAD, 13); mv.visitInsn(CALOAD); mv.visitInsn(CASTORE); mv.visitIincInsn(13, 1); mv.visitJumpInsn(GOTO, l24); mv.visitLabel(l25); mv.visitVarInsn(ILOAD, 4); mv.visitVarInsn(ILOAD, 12); mv.visitVarInsn(ILOAD, 10); mv.visitInsn(ISUB); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 4); mv.visitJumpInsn(GOTO, l22); mv.visitLabel(l17); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(IADD); mv.visitVarInsn(ILOAD, 8); mv.visitInsn(I2C); mv.visitInsn(CASTORE); mv.visitLabel(l22); mv.visitVarInsn(ILOAD, 11); mv.visitVarInsn(ILOAD, 10); mv.visitInsn(IADD); mv.visitVarInsn(ISTORE, 11); mv.visitJumpInsn(GOTO, l10); mv.visitLabel(l11); mv.visitTypeInsn(NEW, "java/lang/String"); mv.visitInsn(DUP); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ILOAD, 4); mv.visitInsn(IADD); mv.visitVarInsn(ALOAD, 3); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/String", "<init>", "(II[C)V"); mv.visitInsn(ARETURN); mv.visitMaxs(6, 14); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "toUpperCase", "()Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, "java/util/Locale", "getDefault", "()Ljava/util/Locale;"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "toUpperCase", "(Ljava/util/Locale;)Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(2, 1); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "trim", "()Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ISTORE, 1); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 2); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "offset", "I"); mv.visitVarInsn(ISTORE, 3); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "value", "[C"); mv.visitVarInsn(ASTORE, 4); Label l0 = new Label(); mv.visitLabel(l0); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 1); Label l1 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l1); mv.visitVarInsn(ALOAD, 4); mv.visitVarInsn(ILOAD, 3); mv.visitVarInsn(ILOAD, 2); mv.visitInsn(IADD); mv.visitInsn(CALOAD); mv.visitIntInsn(BIPUSH, 32); mv.visitJumpInsn(IF_ICMPGT, l1); mv.visitIincInsn(2, 1); mv.visitJumpInsn(GOTO, l0); mv.visitLabel(l1); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 1); Label l2 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l2); mv.visitVarInsn(ALOAD, 4); mv.visitVarInsn(ILOAD, 3); mv.visitVarInsn(ILOAD, 1); mv.visitInsn(IADD); mv.visitInsn(ICONST_1); mv.visitInsn(ISUB); mv.visitInsn(CALOAD); mv.visitIntInsn(BIPUSH, 32); mv.visitJumpInsn(IF_ICMPGT, l2); mv.visitIincInsn(1, -1); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l2); mv.visitVarInsn(ILOAD, 2); Label l3 = new Label(); mv.visitJumpInsn(IFGT, l3); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); Label l4 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l4); mv.visitLabel(l3); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 2); mv.visitVarInsn(ILOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "substring", "(II)Ljava/lang/String;"); Label l5 = new Label(); mv.visitJumpInsn(GOTO, l5); mv.visitLabel(l4); mv.visitVarInsn(ALOAD, 0); mv.visitLabel(l5); mv.visitInsn(ARETURN); mv.visitMaxs(3, 5); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "toString", "()Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ARETURN); mv.visitMaxs(1, 1); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC, "toCharArray", "()[C", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitIntInsn(NEWARRAY, T_CHAR); mv.visitVarInsn(ASTORE, 1); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "java/lang/String", "count", "I"); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ICONST_0); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "getChars", "(II[CI)V"); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(ARETURN); mv.visitMaxs(5, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC + ACC_VARARGS, "format", "(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitTypeInsn(NEW, "java/util/Formatter"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "java/util/Formatter", "<init>", "()V"); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/Formatter", "format", "(Ljava/lang/String;[Ljava/lang/Object;)Ljava/util/Formatter;"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/Formatter", "toString", "()Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(3, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC + ACC_VARARGS, "format", "(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitTypeInsn(NEW, "java/util/Formatter"); mv.visitInsn(DUP); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/util/Formatter", "<init>", "(Ljava/util/Locale;)V"); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 2); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/Formatter", "format", "(Ljava/lang/String;[Ljava/lang/Object;)Ljava/util/Formatter;"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/Formatter", "toString", "()Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(3, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "valueOf", "(Ljava/lang/Object;)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); Label l0 = new Label(); mv.visitJumpInsn(IFNONNULL, l0); mv.visitLdcInsn("null"); Label l1 = new Label(); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "toString", "()Ljava/lang/String;"); mv.visitLabel(l1); mv.visitInsn(ARETURN); mv.visitMaxs(1, 1); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "valueOf", "([C)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitTypeInsn(NEW, "java/lang/String"); mv.visitInsn(DUP); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/String", "<init>", "([C)V"); mv.visitInsn(ARETURN); mv.visitMaxs(3, 1); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "valueOf", "([CII)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitTypeInsn(NEW, "java/lang/String"); mv.visitInsn(DUP); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/String", "<init>", "([CII)V"); mv.visitInsn(ARETURN); mv.visitMaxs(5, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "copyValueOf", "([CII)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitTypeInsn(NEW, "java/lang/String"); mv.visitInsn(DUP); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 1); mv.visitVarInsn(ILOAD, 2); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/String", "<init>", "([CII)V"); mv.visitInsn(ARETURN); mv.visitMaxs(5, 3); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "copyValueOf", "([C)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(ARRAYLENGTH); mv.visitMethodInsn(INVOKESTATIC, "java/lang/String", "copyValueOf", "([CII)Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(3, 1); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "valueOf", "(Z)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ILOAD, 0); Label l0 = new Label(); mv.visitJumpInsn(IFEQ, l0); mv.visitLdcInsn("true"); Label l1 = new Label(); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l0); mv.visitLdcInsn("false"); mv.visitLabel(l1); mv.visitInsn(ARETURN); mv.visitMaxs(1, 1); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "valueOf", "(C)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitInsn(ICONST_1); mv.visitIntInsn(NEWARRAY, T_CHAR); mv.visitInsn(DUP); mv.visitInsn(ICONST_0); mv.visitVarInsn(ILOAD, 0); mv.visitInsn(CASTORE); mv.visitVarInsn(ASTORE, 1); mv.visitTypeInsn(NEW, "java/lang/String"); mv.visitInsn(DUP); mv.visitInsn(ICONST_0); mv.visitInsn(ICONST_1); mv.visitVarInsn(ALOAD, 1); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/String", "<init>", "(II[C)V"); mv.visitInsn(ARETURN); mv.visitMaxs(5, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "valueOf", "(I)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(ILOAD, 0); mv.visitIntInsn(BIPUSH, 10); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "toString", "(II)Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(2, 1); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "valueOf", "(J)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(LLOAD, 0); mv.visitIntInsn(BIPUSH, 10); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Long", "toString", "(JI)Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(3, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "valueOf", "(F)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(FLOAD, 0); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Float", "toString", "(F)Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(1, 1); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "valueOf", "(D)Ljava/lang/String;", null, null); mv.visitCode(); mv.visitVarInsn(DLOAD, 0); mv.visitMethodInsn(INVOKESTATIC, "java/lang/Double", "toString", "(D)Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(2, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_NATIVE, "intern", "()Ljava/lang/String;", null, null); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_BRIDGE + ACC_SYNTHETIC, "compareTo", "(Ljava/lang/Object;)I", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ALOAD, 1); mv.visitTypeInsn(CHECKCAST, "java/lang/String"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "compareTo", "(Ljava/lang/String;)I"); mv.visitInsn(IRETURN); mv.visitMaxs(2, 2); mv.visitEnd(); } { mv = cw.visitMethod(ACC_STATIC, "<clinit>", "()V", null, null); mv.visitCode(); mv.visitInsn(ICONST_0); mv.visitTypeInsn(ANEWARRAY, "java/io/ObjectStreamField"); mv.visitFieldInsn(PUTSTATIC, "java/lang/String", "serialPersistentFields", "[Ljava/io/ObjectStreamField;"); mv.visitTypeInsn(NEW, "java/lang/String$CaseInsensitiveComparator"); mv.visitInsn(DUP); mv.visitInsn(ACONST_NULL); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/String$CaseInsensitiveComparator", "<init>", "(Ljava/lang/String$1;)V"); mv.visitFieldInsn(PUTSTATIC, "java/lang/String", "CASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;"); mv.visitInsn(RETURN); mv.visitMaxs(3, 0); mv.visitEnd(); } cw.visitEnd(); return cw.toByteArray(); } }
The code shows how to create most of the class artifacts. I would now explain parts of the code. However, I will use a simpler class for demonstration and also like to add appropriate comments. The reason why I discussed the above is that in case you get stuck about how to create a particular artifact, you can simply compile a class having it and then generate code using ASMifier to see how it is created. I will use the following code as an example. The class ClassCreationDemoMaker creates a class that would have been the result of compiling the class ClassCreationDemo.
ClassCreationDemo.java
package com.geekyarticles.asm; public class ClassCreationDemo { private int version; public int getVersion() { return version; } public void setVersion(int version) { this.version = version; } @Override public String toString(){ return "ClassCreationDemo: "+version; } }
ClassCreationDemoMaker.java
package com.geekyarticles.asm; import java.io.DataOutputStream; import java.io.FileOutputStream; import static org.objectweb.asm.Opcodes.*; import org.objectweb.asm.*; public class ClassCreationDemoMaker { public static byte[] dump () throws Exception { //ClassWriter is a class visitor that generates the code for the class ClassWriter cw = new ClassWriter(0); FieldVisitor fv; MethodVisitor mv; //Start creating the class. cw.visit(V1_6, ACC_PUBLIC + ACC_SUPER, "com/geekyarticles/asm/ClassCreationDemo", null, "java/lang/Object", null); { //version field fv = cw.visitField(ACC_PRIVATE, "version", "I", null, null); fv.visitEnd(); } { //Implementing the constructor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitInsn(RETURN); mv.visitMaxs(1, 1); mv.visitEnd(); } { //getVersion Method mv = cw.visitMethod(ACC_PUBLIC, "getVersion", "()I", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "com/geekyarticles/asm/ClassCreationDemo", "version", "I"); mv.visitInsn(IRETURN); mv.visitMaxs(1, 1); mv.visitEnd(); } { //setVersion Method mv = cw.visitMethod(ACC_PUBLIC, "setVersion", "(I)V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitVarInsn(ILOAD, 1); mv.visitFieldInsn(PUTFIELD, "com/geekyarticles/asm/ClassCreationDemo", "version", "I"); mv.visitInsn(RETURN); mv.visitMaxs(2, 2); mv.visitEnd(); } { //toString method mv = cw.visitMethod(ACC_PUBLIC, "toString", "()Ljava/lang/String;", null, null); mv.visitCode(); mv.visitTypeInsn(NEW, "java/lang/StringBuilder"); mv.visitInsn(DUP); mv.visitLdcInsn("ClassCreationDemo: "); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringBuilder", "<init>", "(Ljava/lang/String;)V"); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, "com/geekyarticles/asm/ClassCreationDemo", "version", "I"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(I)Ljava/lang/StringBuilder;"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "toString", "()Ljava/lang/String;"); mv.visitInsn(ARETURN); mv.visitMaxs(3, 1); mv.visitEnd(); } cw.visitEnd(); return cw.toByteArray(); } public static void main(String [] args) throws Exception{ DataOutputStream dout=new DataOutputStream(new FileOutputStream("ClassCreationDemo.class")); dout.write(dump()); dout.flush(); dout.close(); } }
The fundamental principle of creating a class is to use an object of ClassWriter, which is a ClassVisitor, and then call different visit methods in it in proper order. In this case we have only created one field and three methods. It is mandatory to create the constructor. The code is very simple to understand. Note that after calling the visitMethod method in the ClassWriter, we have used the MethodWriter returned from it to write the code in the method. Here also note that we have manually allocated the maximum stack size for each method. We can alternatively use ClassWriter.COMPUTE_MAXS flag in the ClassWriter constructor to avoid doing this.
Writing a class is always an in-memory process. This is because the constants used in the class always needs to be in the constant pool, which is near the start of the class and it stores all the field and method names and every other things.
Modifying classes: Honestly, this is where ASM shines, because of its sheer ease of use. In this section, we are going to create the class ClassModifierDemo which modifies the class ClassModificationDemo. The job of the modifier is to insert a code in each method invocation (including constructors) that prints its name.
ClassModifierDemo.java
package com.geekyarticles.asm; import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class ClassModifierDemo { public static class ModifierMethodWriter extends MethodVisitor{ private String methodName; public ModifierMethodWriter(int api, MethodVisitor mv, String methodName) { super(api, mv); this.methodName=methodName; } //This is the point we insert the code. Note that the instructions are added right after //the visitCode method of the super class. This ordering is very important. @Override public void visitCode() { super.visitCode(); super.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); super.visitLdcInsn("method: "+methodName); super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V"); } } //Our class modifier class visitor. It delegate all calls to the super class //Only makes sure that it returns our MethodVisitor for every method public static class ModifierClassWriter extends ClassVisitor{ private int api; public ModifierClassWriter(int api, ClassWriter cv) { super(api, cv); this.api=api; } @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor mv= super.visitMethod(access, name, desc, signature, exceptions); ModifierMethodWriter mvw=new ModifierMethodWriter(api, mv, name); return mvw; } } public static void main(String[] args) throws IOException { InputStream in=ASMHelloWorld.class.getResourceAsStream("/com/geekyarticles/asm/ClassModificationDemo.class"); ClassReader classReader=new ClassReader(in); ClassWriter cw=new ClassWriter(ClassWriter.COMPUTE_MAXS); //Wrap the ClassWriter with our custom ClassVisitor ModifierClassWriter mcw=new ModifierClassWriter(Opcodes.ASM4, cw); classReader.accept(mcw, 0); //Write the output to a class file File outputDir=new File("out/com/geekyarticles/asm"); outputDir.mkdirs(); DataOutputStream dout=new DataOutputStream(new FileOutputStream(new File(outputDir,"ClassModificationDemo.class"))); dout.write(cw.toByteArray()); } }
ClassModificationDemo.java
package com.geekyarticles.asm; public class ClassModificationDemo { private int version; public int getVersion() { return version; } public void setVersion(int version) { this.version = version; } @Override public String toString(){ return "ClassCreationDemo: "+version; } public static void main(String[] args) { System.out.println(new ClassModificationDemo()); } }
This example is a combination of reading and creating a class. In this case we simply wrap the ClassWriter with our own ClassVisitor. It simply delegates all calls directly to the ClassWriter except the visitMethod, which in turn is written to wrap the MethodVisitor returned by the ClassWriter with our own. MethodVisitor also directly delegates all calls to the super class except visitCode, which it uses to insert the custom code.
After running the program, a new version of ClassModificationDemo will be created in the out directory with proper package structure. Now we can run the ClassModificationDemo class from out directory and see the result. It will print which method is invoked when.
Reference: Manipulating Java Class Files with ASM 4 – Part One : Hello World! from our JCG partner Debasish Ray Chawdhuri at the Geeky Articles blog.
@Editor In the code of ASMHelloWorld.java, all of the code looks like commented. But if you look closely, the code is not commented, only colored wrongly. Please fix this. (The color is proper is the original blog)
Done!
Thank you for your comment!
Brs
awesome post!
Amazing article. especially the ASMifier. Thank you, dada.