Re: Generated dnProvideFields method appears to not handle case where fieldNumbers array is null (i.e. class has no attributes) in DN 5.1.6

Page bloom

I found the code that's adding the dnProvideFields methods during BCE:

The execute method is doing the comparison with null here:


    public void execute()




        Label l0 = new Label();


        visitor.visitVarInsn(Opcodes.ALOAD, 1);

        Label l1 = new Label();

        visitor.visitJumpInsn(Opcodes.IFNONNULL, l1);

        visitor.visitTypeInsn(Opcodes.NEW, "java/lang/IllegalArgumentException");


        visitor.visitLdcInsn("argment is null");

        visitor.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/IllegalArgumentException",

            "<init>", "(Ljava/lang/String;)V");


It's all in Java VM machine language (obviously much more efficient than performing a compile phase during enhancement) which makes for interesting reading ;)

I'm wondering if it's better to just change StateManagerImpl so that it passes an empty Array into dnProvideFields rather than changing the enhancer...

Join to automatically receive all group messages.