if (!classOptimizer.class$) {
MethodVisitor mv = classOptimizer.visitMethod(ACC_STATIC
| ACC_SYNTHETIC, "class$",
"(Ljava/lang/String;)Ljava/lang/Class;", null, null);
mv.visitCode();
Label l0 = new Label();
Label l1 = new Label();
Label l2 = new Label();
mv.visitTryCatchBlock(l0, l1, l2,
"java/lang/ClassNotFoundException");
mv.visitLabel(l0);
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Class", "forName",
"(Ljava/lang/String;)Ljava/lang/Class;");
mv.visitLabel(l1);
mv.visitInsn(ARETURN);
mv.visitLabel(l2);
mv.visitMethodInsn(INVOKEVIRTUAL,
"java/lang/ClassNotFoundException", "getMessage",
"()Ljava/lang/String;");
mv.visitVarInsn(ASTORE, 1);
mv.visitTypeInsn(NEW, "java/lang/NoClassDefFoundError");
mv.visitInsn(DUP);
mv.visitVarInsn(ALOAD, 1);
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NoClassDefFoundError",
"<init>", "(Ljava/lang/String;)V");
mv.visitInsn(ATHROW);
mv.visitMaxs(3, 2);
mv.visitEnd();
classOptimizer.class$ = true;
}
String clsName = classOptimizer.clsName;
mv.visitFieldInsn(GETSTATIC, clsName, fieldName, "Ljava/lang/Class;");
Label elseLabel = new Label();
mv.visitJumpInsn(IFNONNULL, elseLabel);
mv.visitLdcInsn(ldcName.replace('/', '.'));
mv.visitMethodInsn(INVOKESTATIC, clsName, "class$",
"(Ljava/lang/String;)Ljava/lang/Class;");
mv.visitInsn(DUP);
mv.visitFieldInsn(PUTSTATIC, clsName, fieldName, "Ljava/lang/Class;");
Label endLabel = new Label();
mv.visitJumpInsn(GOTO, endLabel);
mv.visitLabel(elseLabel);
mv.visitFieldInsn(GETSTATIC, clsName, fieldName, "Ljava/lang/Class;");
mv.visitLabel(endLabel);
}