private void generateStaticInitializer() {
    if (staticInitializerChunks.size() > 0) {
      MethodVisitor mv = v.newMethod(null, ACC_PUBLIC | ACC_STATIC, "<clinit>", "()V", null, null);
      if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
        mv.visitCode();

        InstructionAdapter v = new InstructionAdapter(mv);

        for (CodeChunk chunk : staticInitializerChunks) {
          chunk.generate(v);
        }

        mv.visitInsn(RETURN);
        FunctionCodegen.endVisit(v, "static initializer", myClass);
      }
    }
  }
Beispiel #2
0
 public static void genMethodThrow(MethodVisitor mv, String exception, String message) {
   mv.visitCode();
   genThrow(mv, exception, message);
   mv.visitMaxs(-1, -1);
   mv.visitEnd();
 }