javassist.bytecode.Bytecode.addReturn()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中javassist.bytecode.Bytecode.addReturn()方法的一些代码示例,展示了Bytecode.addReturn()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytecode.addReturn()方法的具体详情如下:
包路径:javassist.bytecode.Bytecode
类名称:Bytecode
方法名:addReturn

Bytecode.addReturn介绍

[英]Appends ARETURN, IRETURN, .., or RETURN.
[中]附件是RETURN、IRETURN、。。,或返回。

代码示例

代码示例来源:origin: redisson/redisson

code.addInvokespecial(clazz, MethodInfo.nameInit, desc);
code.addReturn(null);
minfo.setCodeAttribute(code.toCodeAttribute());
cf.addMethod(minfo);

代码示例来源:origin: redisson/redisson

code.addReturn(Descriptor.toCtClass(fieldType, pool));
minfo.setCodeAttribute(code.toCodeAttribute());
cf.addMethod(minfo);

代码示例来源:origin: redisson/redisson

code.addInvokevirtual(clazz, name, desc);
code.addReturn(Descriptor.getReturnType(desc, pool));
minfo.setCodeAttribute(code.toCodeAttribute());
cf.addMethod(minfo);

代码示例来源:origin: redisson/redisson

code.addReturn(null);
code.setMaxLocals(reg);
minfo.setCodeAttribute(code.toCodeAttribute());

代码示例来源:origin: org.javassist/javassist

code.addInvokespecial(clazz, MethodInfo.nameInit, desc);
code.addReturn(null);
minfo.setCodeAttribute(code.toCodeAttribute());
cf.addMethod(minfo);

代码示例来源:origin: org.javassist/javassist

code.addReturn(Descriptor.toCtClass(fieldType, pool));
minfo.setCodeAttribute(code.toCodeAttribute());
cf.addMethod(minfo);

代码示例来源:origin: redisson/redisson

code.addGetstatic(Bytecode.THIS, fieldName, fieldType);
code.addReturn(field.getType());

代码示例来源:origin: org.javassist/javassist

code.addInvokevirtual(clazz, name, desc);
code.addReturn(Descriptor.getReturnType(desc, pool));
minfo.setCodeAttribute(code.toCodeAttribute());
cf.addMethod(minfo);

代码示例来源:origin: org.javassist/javassist

code.addReturn(null);
code.setMaxLocals(reg);
minfo.setCodeAttribute(code.toCodeAttribute());

代码示例来源:origin: redisson/redisson

code.addReturn(null);

代码示例来源:origin: org.javassist/javassist

code.addGetstatic(Bytecode.THIS, fieldName, fieldType);
code.addReturn(field.getType());

代码示例来源:origin: redisson/redisson

code.addReturn(delegate.getReturnType());
code.setMaxLocals(++s);
code.setMaxStack(s < 2 ? 2 : s); // for a 2-word return value

代码示例来源:origin: org.javassist/javassist

code.addReturn(null);

代码示例来源:origin: org.javassist/javassist

code.addReturn(delegate.getReturnType());
code.setMaxLocals(++s);
code.setMaxStack(s < 2 ? 2 : s); // for a 2-word return value

代码示例来源:origin: Blazebit/blaze-persistence

private CtMethod createGetterBridge(CtClass cc, Method getter, CtMethod attributeGetter) throws NotFoundException, CannotCompileException {
  ConstPool cp = cc.getClassFile2().getConstPool();
  CtClass bridgeReturnType = pool.get(getter.getReturnType().getName());
  String desc = "()" + Descriptor.of(bridgeReturnType);
  MethodInfo bridge = new MethodInfo(cp, getter.getName(), desc);
  bridge.setAccessFlags(AccessFlag.PUBLIC | AccessFlag.BRIDGE | AccessFlag.SYNTHETIC);
  Bytecode code = new Bytecode(cp, needsTwoStackSlots(bridgeReturnType) ? 2 : 1, 1);
  code.addAload(0);
  code.addInvokevirtual(cc, getter.getName(), attributeGetter.getReturnType(), null);
  code.addReturn(bridgeReturnType);
  bridge.setCodeAttribute(code.toCodeAttribute());
  return CtMethod.make(bridge, cc);
}

代码示例来源:origin: Blazebit/blaze-persistence

private CtMethod createSetterBridge(CtClass cc, Method setter, CtMethod attributeSetter) throws NotFoundException, CannotCompileException {
  ConstPool cp = cc.getClassFile2().getConstPool();
  CtClass bridgeParameterType = pool.get(setter.getParameterTypes()[0].getName());
  String desc = "(" + Descriptor.of(bridgeParameterType) + ")V";
  MethodInfo bridge = new MethodInfo(cp, setter.getName(), desc);
  bridge.setAccessFlags(AccessFlag.PUBLIC | AccessFlag.BRIDGE | AccessFlag.SYNTHETIC);
  Bytecode code = new Bytecode(cp, needsTwoStackSlots(bridgeParameterType) ? 4 : 2, 2);
  code.addAload(0);
  code.addAload(1);
  code.addCheckcast(attributeSetter.getParameterTypes()[0]);
  code.addInvokevirtual(cc, setter.getName(), CtClass.voidType, attributeSetter.getParameterTypes());
  code.addReturn(CtClass.voidType);
  bridge.setCodeAttribute(code.toCodeAttribute());
  return CtMethod.make(bridge, cc);
}

代码示例来源:origin: Blazebit/blaze-persistence

} else {
  try {
    code.addReturn(field.getType());
  } catch (NotFoundException e) {
    throw new CannotCompileException(e);

代码示例来源:origin: org.jboss.javassist/com.springsource.javassist

code.addReturn(delegate.getReturnType());
code.setMaxLocals(++s);
code.setMaxStack(s < 2 ? 2 : s); // for a 2-word return value

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

code.addReturn(delegate.getReturnType());
code.setMaxLocals(++s);
code.setMaxStack(s < 2 ? 2 : s); // for a 2-word return value

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

code.addReturn(delegate.getReturnType());
code.setMaxLocals(++s);
code.setMaxStack(s < 2 ? 2 : s); // for a 2-word return value

相关文章