raven-compiler/src/main/java/org/raven/compiler/ClassMaker.java
/**
     * Creates an empty stub method that does nothing, used as
     * a placeholder for unimplemented interface methods
     *
     * @param name The name of the method
     * @param type The method type
     */
Creates an empty stub method that does nothing, used as
a placeholder for unimplemented interface methods

@param name The name of the method
@param type The method type
Creates an empty stub method that does nothing used as a placeholder for unimplemented interface methods @param name The name of the method @param type The method type
private void createStub(final String name, final Type type) {
        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, name, type.getDescriptor(), null, new String[0]);
        mv.visitCode();
        Primitive p = Primitive.getPrimitiveType(type.getReturnType().getDescriptor());
        if (p != null) {
            switch (p) {
                case INT:
                case BYTE:
                case SHORT:
                case BOOLEAN:
                case CHAR:
                    mv.visitInsn(ICONST_0);
                    break;
                case LONG:
                    mv.visitInsn(LCONST_0);
                    break;
                case FLOAT:
                    mv.visitInsn(FCONST_0);
                    break;
                case DOUBLE:
                    mv.visitInsn(FCONST_0);
                    break;
            }
            p.ret(mv);
        } else {
            mv.visitInsn(ACONST_NULL);
            mv.visitInsn(ARETURN);
        }
        mv.visitMaxs(0, 0);
        mv.visitEnd();
    }
private void createStub ( final String name , final Type type ) { MethodVisitor mv = cw . visitMethod ( ACC_PUBLIC , name , type . getDescriptor ( ) , null , new String [ 0 ] ) ; mv . visitCode ( ) ; Primitive p = Primitive . getPrimitiveType ( type . getReturnType ( ) . getDescriptor ( ) ) ; if ( p != null ) { switch ( p ) { case INT : case BYTE : case SHORT : case BOOLEAN : case CHAR : mv . visitInsn ( ICONST_0 ) ; break ; case LONG : mv . visitInsn ( LCONST_0 ) ; break ; case FLOAT : mv . visitInsn ( FCONST_0 ) ; break ; case DOUBLE : mv . visitInsn ( FCONST_0 ) ; break ; } p . ret ( mv ) ; } else { mv . visitInsn ( ACONST_NULL ) ; mv . visitInsn ( ARETURN ) ; } mv . visitMaxs ( 0 , 0 ) ; mv . visitEnd ( ) ; }
Creates an empty stub method that does nothing, used as
 a placeholder for unimplemented interface methods
Creates an empty stub method that does nothing used as a placeholder for unimplemented interface methods