/** * Visits a method instruction. A method instruction is an instruction that * invokes a method. * * @param opcode * the opcode of the type instruction to be visited. This opcode * is either INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or * INVOKEINTERFACE. * @param owner * the internal name of the method's owner class (see * {@link Type#getInternalName() getInternalName}). * @param name * the method's name. * @param desc * the method's descriptor (see {@link Type Type}). */ @Deprecated public void visitMethodInsn(int opcode, String owner, String name, String desc) { if (api >= Opcodes.ASM5) { boolean itf = opcode == Opcodes.INVOKEINTERFACE; visitMethodInsn(opcode, owner, name, desc, itf); return; } if (mv != null) { mv.visitMethodInsn(opcode, owner, name, desc); } }
"INVOKESPECIAL/STATIC on interfaces require ASM 5"); visitMethodInsn(opcode, owner, name, desc); return; mv.visitMethodInsn(opcode, owner, name, desc, itf);
/** * Visits a method instruction. A method instruction is an instruction that * invokes a method. * * @param opcode * the opcode of the type instruction to be visited. This opcode * is either INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or * INVOKEINTERFACE. * @param owner * the internal name of the method's owner class (see * {@link Type#getInternalName() getInternalName}). * @param name * the method's name. * @param desc * the method's descriptor (see {@link Type Type}). */ @Deprecated public void visitMethodInsn(int opcode, String owner, String name, String desc) { if (api >= Opcodes.ASM5) { boolean itf = opcode == Opcodes.INVOKEINTERFACE; visitMethodInsn(opcode, owner, name, desc, itf); return; } if (mv != null) { mv.visitMethodInsn(opcode, owner, name, desc); } }
"INVOKESPECIAL/STATIC on interfaces require ASM 5"); visitMethodInsn(opcode, owner, name, desc); return; mv.visitMethodInsn(opcode, owner, name, desc, itf);
mv.visitFieldInsn(opcode, iowner, iname, idesc); } else { mv.visitMethodInsn(opcode, iowner, iname, idesc, itf);
/** * Visits a method instruction. A method instruction is an instruction that * invokes a method. * * @param opcode * the opcode of the type instruction to be visited. This opcode * is either INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or * INVOKEINTERFACE. * @param owner * the internal name of the method's owner class (see * {@link Type#getInternalName() getInternalName}). * @param name * the method's name. * @param desc * the method's descriptor (see {@link Type Type}). */ @Deprecated public void visitMethodInsn(int opcode, String owner, String name, String desc) { if (api >= Opcodes.ASM5) { boolean itf = opcode == Opcodes.INVOKEINTERFACE; visitMethodInsn(opcode, owner, name, desc, itf); return; } if (mv != null) { mv.visitMethodInsn(opcode, owner, name, desc); } }
/** * Visits a method instruction. A method instruction is an instruction that * invokes a method. * * @param opcode * the opcode of the type instruction to be visited. This opcode * is either INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or * INVOKEINTERFACE. * @param owner * the internal name of the method's owner class (see * {@link Type#getInternalName() getInternalName}). * @param name * the method's name. * @param desc * the method's descriptor (see {@link Type Type}). */ @Deprecated public void visitMethodInsn(int opcode, String owner, String name, String desc) { if (api >= Opcodes.ASM5) { boolean itf = opcode == Opcodes.INVOKEINTERFACE; visitMethodInsn(opcode, owner, name, desc, itf); return; } if (mv != null) { mv.visitMethodInsn(opcode, owner, name, desc); } }
/** * Visits a method instruction. A method instruction is an instruction that * invokes a method. * * @param opcode * the opcode of the type instruction to be visited. This opcode * is either INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or * INVOKEINTERFACE. * @param owner * the internal name of the method's owner class (see * {@link Type#getInternalName() getInternalName}). * @param name * the method's name. * @param desc * the method's descriptor (see {@link Type Type}). */ @Deprecated public void visitMethodInsn(int opcode, String owner, String name, String desc) { if (api >= Opcodes.ASM5) { boolean itf = opcode == Opcodes.INVOKEINTERFACE; visitMethodInsn(opcode, owner, name, desc, itf); return; } if (mv != null) { mv.visitMethodInsn(opcode, owner, name, desc); } }
/** * Visits a method instruction. A method instruction is an instruction that * invokes a method. * * @param opcode * the opcode of the type instruction to be visited. This opcode * is either INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or * INVOKEINTERFACE. * @param owner * the internal name of the method's owner class (see * {@link Type#getInternalName() getInternalName}). * @param name * the method's name. * @param desc * the method's descriptor (see {@link Type Type}). */ @Deprecated public void visitMethodInsn(int opcode, String owner, String name, String desc) { if (api >= Opcodes.ASM5) { boolean itf = opcode == Opcodes.INVOKEINTERFACE; visitMethodInsn(opcode, owner, name, desc, itf); return; } if (mv != null) { mv.visitMethodInsn(opcode, owner, name, desc); } }
"INVOKESPECIAL/STATIC on interfaces require ASM 5"); visitMethodInsn(opcode, owner, name, desc); return; mv.visitMethodInsn(opcode, owner, name, desc, itf);
"INVOKESPECIAL/STATIC on interfaces require ASM 5"); visitMethodInsn(opcode, owner, name, desc); return; mv.visitMethodInsn(opcode, owner, name, desc, itf);
/** * Visits a method instruction. A method instruction is an instruction that * invokes a method. * * @param opcode * the opcode of the type instruction to be visited. This opcode * is either INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or * INVOKEINTERFACE. * @param owner * the internal name of the method's owner class (see * {@link Type#getInternalName() getInternalName}). * @param name * the method's name. * @param desc * the method's descriptor (see {@link Type Type}). */ @Deprecated public void visitMethodInsn(int opcode, String owner, String name, String desc) { if (api >= Opcodes.ASM5) { boolean itf = opcode == Opcodes.INVOKEINTERFACE; visitMethodInsn(opcode, owner, name, desc, itf); return; } if (mv != null) { mv.visitMethodInsn(opcode, owner, name, desc); } }
"INVOKESPECIAL/STATIC on interfaces require ASM 5"); visitMethodInsn(opcode, owner, name, desc); return; mv.visitMethodInsn(opcode, owner, name, desc, itf);
"INVOKESPECIAL/STATIC on interfaces require ASM 5"); visitMethodInsn(opcode, owner, name, desc); return; mv.visitMethodInsn(opcode, owner, name, desc, itf);
"INVOKESPECIAL/STATIC on interfaces require ASM 5"); visitMethodInsn(opcode, owner, name, desc); return; mv.visitMethodInsn(opcode, owner, name, desc, itf);
Class<?> createBeanClass() { ClassWriter writer = new ClassWriter(0); String name = prefix + Integer.toString(generatedClassCounter.addAndGet(1)); writer.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC, name, null, "java/lang/Object", null); MethodVisitor methodVisitor = writer.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null); methodVisitor.visitCode(); methodVisitor.visitVarInsn(Opcodes.ALOAD, 0); methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); methodVisitor.visitInsn(Opcodes.RETURN); methodVisitor.visitMaxs(1, 1); methodVisitor.visitEnd(); writer.visitEnd(); byte[] bytecode = writer.toByteArray(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { Class<?> result = (Class<?>) defineClassMethod.invoke(classLoader, name.replace("/", "."), bytecode, 0, bytecode.length); LOGGER.fine("Created class " + result.getName()); return result; } catch (Throwable t) { LOGGER.log(Level.SEVERE, "error calling ClassLoader.defineClass", t); return null; } } }
Class<?> createBeanClass() { ClassWriter writer = new ClassWriter(0); String name = prefix + Integer.toString(generatedClassCounter.addAndGet(1)); writer.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC, name, null, "java/lang/Object", null); MethodVisitor methodVisitor = writer.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null); methodVisitor.visitCode(); methodVisitor.visitVarInsn(Opcodes.ALOAD, 0); methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); methodVisitor.visitInsn(Opcodes.RETURN); methodVisitor.visitMaxs(1, 1); methodVisitor.visitEnd(); writer.visitEnd(); byte[] bytecode = writer.toByteArray(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { Class<?> result = (Class<?>) defineClassMethod.invoke(classLoader, name.replace("/", "."), bytecode, 0, bytecode.length); LOGGER.fine("Created class " + result.getName()); return result; } catch (Throwable t) { LOGGER.log(Level.SEVERE, "error calling ClassLoader.defineClass", t); return null; } } }
Class<?> createBeanClass() { ClassWriter writer = new ClassWriter(0); String name = prefix + Integer.toString(generatedClassCounter.addAndGet(1)); writer.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC, name, null, "java/lang/Object", null); MethodVisitor methodVisitor = writer.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null); methodVisitor.visitCode(); methodVisitor.visitVarInsn(Opcodes.ALOAD, 0); methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); methodVisitor.visitInsn(Opcodes.RETURN); methodVisitor.visitMaxs(1, 1); methodVisitor.visitEnd(); writer.visitEnd(); byte[] bytecode = writer.toByteArray(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { Class<?> result = (Class<?>) defineClassMethod.invoke(classLoader, name.replace("/", "."), bytecode, 0, bytecode.length); LOGGER.fine("Created class " + result.getName()); return result; } catch (Throwable t) { LOGGER.log(Level.SEVERE, "error calling ClassLoader.defineClass", t); return null; } } }
mv.visitFieldInsn(opcode, iowner, iname, idesc); } else { mv.visitMethodInsn(opcode, iowner, iname, idesc, itf);
mv.visitFieldInsn(opcode, iowner, iname, idesc); } else { mv.visitMethodInsn(opcode, iowner, iname, idesc, itf);