CodeEmitter(ClassEmitter ce, MethodVisitor mv, int access, Signature sig, Type[] exceptionTypes) { super(access, sig.getDescriptor(), mv); this.ce = ce; state = new State(ce.getClassInfo(), access, sig, exceptionTypes); }
private Signature rename(Signature sig, int index) { return new Signature("CGLIB$" + sig.getName() + "$" + index, sig.getDescriptor()); }
private void emit_invoke(int opcode, Type type, Signature sig) { if (sig.getName().equals(Constants.CONSTRUCTOR_NAME) && ((opcode == Constants.INVOKEVIRTUAL) || (opcode == Constants.INVOKESTATIC))) { // TODO: error } mv.visitMethodInsn(opcode, type.getInternalName(), sig.getName(), sig.getDescriptor()); }
private void emitConstructors(ClassEmitter ce, List constructors) { boolean seenNull = false; for (Iterator it = constructors.iterator(); it.hasNext();) { MethodInfo constructor = (MethodInfo)it.next(); CodeEmitter e = EmitUtils.begin_method(ce, constructor, Constants.ACC_PUBLIC); e.load_this(); e.dup(); e.load_args(); Signature sig = constructor.getSignature(); seenNull = seenNull || sig.getDescriptor().equals("()V"); e.super_invoke_constructor(sig); e.invoke_static_this(BIND_CALLBACKS); if (!interceptDuringConstruction) { e.load_this(); e.push(1); e.putfield(CONSTRUCTED_FIELD); } e.return_value(); e.end_method(); } if (!classOnly && !seenNull && arguments == null) throw new IllegalArgumentException("Superclass has no null constructors but no arguments were given"); }
public SerializableMockitoMethodProxy(MethodProxy methodProxy) { Object info = Whitebox.getInternalState(methodProxy, "createInfo"); c1 = (Class<?>) Whitebox.getInternalState(info, "c1"); c2 = (Class<?>) Whitebox.getInternalState(info, "c2"); desc = methodProxy.getSignature().getDescriptor(); name = methodProxy.getSignature().getName(); superName = methodProxy.getSuperName(); this.methodProxy = methodProxy; }
public SerializableMockitoMethodProxy(MethodProxy methodProxy) { assert methodProxy != null; Object info = Whitebox.getInternalState(methodProxy, "createInfo"); c1 = (Class<?>) Whitebox.getInternalState(info, "c1"); c2 = (Class<?>) Whitebox.getInternalState(info, "c2"); desc = methodProxy.getSignature().getDescriptor(); name = methodProxy.getSignature().getName(); superName = methodProxy.getSuperName(); this.methodProxy = methodProxy; }
e.dup(); e.push(2 * index + 1); e.push(sig.getDescriptor()); e.aastore(); e.push(sig.getDescriptor()); e.push(sig.getName()); e.push(impl.getName());
MethodVisitor v = cv.visitMethod(access, sig.getName(), sig.getDescriptor(), null, TypeUtils.toInternalNames(exceptions));
CodeEmitter(ClassEmitter ce, MethodVisitor mv, int access, Signature sig, Type[] exceptionTypes) { super(access, sig.getDescriptor(), mv); this.ce = ce; state = new State(ce.getClassInfo(), access, sig, exceptionTypes); }
private Signature rename(Signature sig, int index) { return new Signature("CGLIB$" + sig.getName() + "$" + index, sig.getDescriptor()); }
private void emit_invoke(int opcode, Type type, Signature sig) { if (sig.getName().equals(Constants.CONSTRUCTOR_NAME) && ((opcode == Constants.INVOKEVIRTUAL) || (opcode == Constants.INVOKESTATIC))) { // TODO: error } mv.visitMethodInsn(opcode, type.getInternalName(), sig.getName(), sig.getDescriptor()); }
private void emitConstructors(ClassEmitter ce, List constructors) { boolean seenNull = false; for (Iterator it = constructors.iterator(); it.hasNext();) { MethodInfo constructor = (MethodInfo)it.next(); CodeEmitter e = EmitUtils.begin_method(ce, constructor, Constants.ACC_PUBLIC); e.load_this(); e.dup(); e.load_args(); Signature sig = constructor.getSignature(); seenNull = seenNull || sig.getDescriptor().equals("()V"); e.super_invoke_constructor(sig); e.invoke_static_this(BIND_CALLBACKS); if (!interceptDuringConstruction) { e.load_this(); e.push(1); e.putfield(CONSTRUCTED_FIELD); } e.return_value(); e.end_method(); } if (!classOnly && !seenNull && arguments == null) throw new IllegalArgumentException("Superclass has no null constructors but no arguments were given"); }
public SerializableMockitoMethodProxy(MethodProxy methodProxy) { Object info = Whitebox.getInternalState(methodProxy, "createInfo"); c1 = (Class<?>) Whitebox.getInternalState(info, "c1"); c2 = (Class<?>) Whitebox.getInternalState(info, "c2"); desc = methodProxy.getSignature().getDescriptor(); name = methodProxy.getSignature().getName(); superName = methodProxy.getSuperName(); this.methodProxy = methodProxy; }
e.dup(); e.push(2 * index + 1); e.push(sig.getDescriptor()); e.aastore(); e.push(sig.getDescriptor()); e.push(sig.getName()); e.push(impl.getName());
MethodVisitor v = cv.visitMethod(access, sig.getName(), sig.getDescriptor(), null, TypeUtils.toInternalNames(exceptions));