public static void doNullReturn(Code code, Class<?> type) throws Exception { switch (getType(type)) { case tNone: break; case tCharacter: case tBoolean: case tByte: case tShort: case tInteger: code.iconst_0(); code.ireturn(); break; case tLong: code.lconst_0(); code.lreturn(); break; case tFloat: code.fconst_0(); code.freturn(); break; case tDouble: code.dconst_0(); code.dreturn(); break; case tVoid: code.return_(); break; default: code.aconst_null(); code.areturn(); break; } }