private void createSerialisation(final ClassWriter cw, final String pluginId, final String key) { final MethodVisitor mv = cw .visitMethod(Modifier.PUBLIC, "writeReplace", "()Ljava/lang/Object;", null, new String[] { Type.getType(ObjectStreamException.class).getInternalName() }); mv.visitCode(); mv.visitTypeInsn(NEW, "org/talend/sdk/component/runtime/serialization/SerializableService"); mv.visitInsn(DUP); mv.visitLdcInsn(pluginId); mv.visitLdcInsn(key); mv .visitMethodInsn(INVOKESPECIAL, "org/talend/sdk/component/runtime/serialization/SerializableService", "<init>", "(Ljava/lang/String;Ljava/lang/String;)V", false); mv.visitInsn(ARETURN); mv.visitMaxs(-1, -1); mv.visitEnd(); }
mv.visitLdcInsn(Type.getType("L" + classNameToOverride + ";")); mv.visitLdcInsn(method.getName()); mv.visitFieldInsn(GETSTATIC, wrapperType, "TYPE", "Ljava/lang/Class;"); } else { mv.visitLdcInsn(Type.getType(parameterType)); Class<?> exceptionType = exceptionTypes[i]; mv.visitLdcInsn(Type.getType("L" + exceptionType.getCanonicalName().replace('.', '/') + ";")); mv.visitVarInsn(ALOAD, length); mv
mv.visitLdcInsn(Type.getType("L" + classNameToOverride + ";")); mv.visitLdcInsn(method.getName()); mv.visitLdcInsn(Type.getType(parameterType)); mv.visitLdcInsn(Type.getType("L" + exceptionType.getCanonicalName().replace('.', '/') + ";")); mv.visitVarInsn(Opcodes.ALOAD, length); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/reflect/InvocationTargetException", "getCause",