@RequiresNonNull("type") private void addMixin(ClassNode mixinClassNode) { List<FieldNode> fieldNodes = mixinClassNode.fields; for (FieldNode fieldNode : fieldNodes) { if (!Modifier.isTransient(fieldNode.access)) { // this is needed to avoid serialization issues (even if the new field is // serializable, this can still cause issues in a cluster if glowroot is not // deployed on all nodes) throw new IllegalStateException( "@Mixin fields must be marked transient: " + mixinClassNode.name); } fieldNode.accept(this); } List<MethodNode> methodNodes = mixinClassNode.methods; for (MethodNode mn : methodNodes) { if (mn.name.equals("<init>")) { continue; } String[] exceptions = Iterables.toArray(mn.exceptions, String.class); MethodVisitor mv = cw.visitMethod(mn.access, mn.name, mn.desc, mn.signature, exceptions); mn.accept(new MethodRemapper(mv, new SimpleRemapper(mixinClassNode.name, type.getInternalName()))); } }
@Override public void visitMethodInsn( final int opcode, final String owner, final String name, final String descriptor, final boolean isInterface) { if (api < Opcodes.ASM5) { super.visitMethodInsn(opcode, owner, name, descriptor, isInterface); return; } doVisitMethodInsn(opcode, owner, name, descriptor, isInterface); }
@Override public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) { super.visitFrame(type, nLocal, remapEntries(nLocal, local), nStack, remapEntries(nStack, stack)); }
@Override public void visitFrame( final int type, final int numLocal, final Object[] local, final int numStack, final Object[] stack) { super.visitFrame( type, numLocal, remapFrameTypes(numLocal, local), numStack, remapFrameTypes(numStack, stack)); }
@Override public void visitMethodInsn( final int opcode, final String owner, final String name, final String descriptor, final boolean isInterface) { if (api < Opcodes.ASM5) { super.visitMethodInsn(opcode, owner, name, descriptor, isInterface); return; } doVisitMethodInsn(opcode, owner, name, descriptor, isInterface); }
@Override public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) { super.visitFrame(type, nLocal, remapEntries(nLocal, local), nStack, remapEntries(nStack, stack)); }
@Override public void visitFrame( final int type, final int numLocal, final Object[] local, final int numStack, final Object[] stack) { super.visitFrame( type, numLocal, remapFrameTypes(numLocal, local), numStack, remapFrameTypes(numStack, stack)); }
@Override public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc, final boolean itf) { if (api < Opcodes.ASM5) { super.visitMethodInsn(opcode, owner, name, desc, itf); return; } doVisitMethodInsn(opcode, owner, name, desc, itf); }
/** * Constructs a new remapper for methods. The default implementation of this method returns a new * {@link MethodRemapper}. * * @param methodVisitor the MethodVisitor the remapper must delegate to. * @return the newly created remapper. */ protected MethodVisitor createMethodRemapper(final MethodVisitor methodVisitor) { return new MethodRemapper(api, methodVisitor, remapper); }
@Override public void visitFrame( final int type, final int numLocal, final Object[] local, final int numStack, final Object[] stack) { super.visitFrame( type, numLocal, remapFrameTypes(numLocal, local), numStack, remapFrameTypes(numStack, stack)); }
@Override public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc, final boolean itf) { if (api < Opcodes.ASM5) { super.visitMethodInsn(opcode, owner, name, desc, itf); return; } doVisitMethodInsn(opcode, owner, name, desc, itf); }
/** * Constructs a new remapper for methods. The default implementation of this method returns a new * {@link MethodRemapper}. * * @param methodVisitor the MethodVisitor the remapper must delegate to. * @return the newly created remapper. */ protected MethodVisitor createMethodRemapper(final MethodVisitor methodVisitor) { return new MethodRemapper(api, methodVisitor, remapper); }
@Override public void visitMethodInsn( final int opcode, final String owner, final String name, final String descriptor, final boolean isInterface) { if (api < Opcodes.ASM5) { super.visitMethodInsn(opcode, owner, name, descriptor, isInterface); return; } doVisitMethodInsn(opcode, owner, name, descriptor, isInterface); }
/** * Constructs a new remapper for methods. The default implementation of this method returns a new * {@link MethodRemapper}. * * @param methodVisitor the MethodVisitor the remapper must delegate to. * @return the newly created remapper. */ protected MethodVisitor createMethodRemapper(final MethodVisitor methodVisitor) { return new MethodRemapper(api, methodVisitor, remapper); }
@Deprecated @Override public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) { if (api >= Opcodes.ASM5) { super.visitMethodInsn(opcode, owner, name, desc); return; } doVisitMethodInsn(opcode, owner, name, desc, opcode == Opcodes.INVOKEINTERFACE); }
protected MethodVisitor createMethodRemapper(MethodVisitor mv) { return new MethodRemapper(mv, remapper); }
@Deprecated @Override public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) { if (api >= Opcodes.ASM5) { super.visitMethodInsn(opcode, owner, name, desc); return; } doVisitMethodInsn(opcode, owner, name, desc, opcode == Opcodes.INVOKEINTERFACE); }
protected MethodVisitor createMethodRemapper(MethodVisitor mv) { return new MethodRemapper(mv, remapper); }
/** * Deprecated. * * @deprecated use {@link #visitMethodInsn(int, String, String, String, boolean)} instead. */ @Deprecated @Override public void visitMethodInsn( final int opcode, final String owner, final String name, final String descriptor) { if (api >= Opcodes.ASM5) { super.visitMethodInsn(opcode, owner, name, descriptor); return; } doVisitMethodInsn(opcode, owner, name, descriptor, opcode == Opcodes.INVOKEINTERFACE); }
/** * Deprecated. * * @deprecated use {@link #visitMethodInsn(int, String, String, String, boolean)} instead. */ @Deprecated @Override public void visitMethodInsn( final int opcode, final String owner, final String name, final String descriptor) { if (api >= Opcodes.ASM5) { super.visitMethodInsn(opcode, owner, name, descriptor); return; } doVisitMethodInsn(opcode, owner, name, descriptor, opcode == Opcodes.INVOKEINTERFACE); }