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

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

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

Bytecode.addGetstatic介绍

[英]Appends GETSTATIC.
[中]附加GETSTATIC。

代码示例

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

/**
   * Appends instructions for executing
   * <code>java.lang.System.println(<i>message</i>)</code>.
   *
   * @param message           printed message.
   */
  public void addPrintln(String message) {
    addGetstatic("java.lang.System", "err", "Ljava/io/PrintStream;");
    addLdc(message);
    addInvokevirtual("java.io.PrintStream",
             "println", "(Ljava/lang/String;)V");
  }
}

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

/**
   * Appends instructions for executing
   * <code>java.lang.System.println(<i>message</i>)</code>.
   *
   * @param message           printed message.
   */
  public void addPrintln(String message) {
    addGetstatic("java.lang.System", "err", "Ljava/io/PrintStream;");
    addLdc(message);
    addInvokevirtual("java.io.PrintStream",
             "println", "(Ljava/lang/String;)V");
  }
}

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

protected void atCflow(ASTList cname) throws CompileError {
  StringBuffer sbuf = new StringBuffer();
  if (cname == null || cname.tail() != null)
    throw new CompileError("bad " + cflowName);
  makeCflowName(sbuf, cname.head());
  String name = sbuf.toString();
  Object[] names = resolver.getClassPool().lookupCflow(name);
  if (names == null)
    throw new CompileError("no such " + cflowName + ": " + name);
  bytecode.addGetstatic((String)names[0], (String)names[1],
             "Ljavassist/runtime/Cflow;");
  bytecode.addInvokevirtual("javassist.runtime.Cflow",
               "value", "()I");
  exprType = INT;
  arrayDim = 0;
  className = null;
}

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

protected void atCflow(ASTList cname) throws CompileError {
  StringBuffer sbuf = new StringBuffer();
  if (cname == null || cname.tail() != null)
    throw new CompileError("bad " + cflowName);
  makeCflowName(sbuf, cname.head());
  String name = sbuf.toString();
  Object[] names = resolver.getClassPool().lookupCflow(name);
  if (names == null)
    throw new CompileError("no such " + cflowName + ": " + name);
  bytecode.addGetstatic((String)names[0], (String)names[1],
             "Ljavassist/runtime/Cflow;");
  bytecode.addInvokevirtual("javassist.runtime.Cflow",
               "value", "()I");
  exprType = INT;
  arrayDim = 0;
  className = null;
}

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

code.addGetstatic(thisClassName, DEFAULT_INTERCEPTOR, HANDLER_TYPE);
  code.addPutfield(thisClassName, HANDLER, HANDLER_TYPE);
  code.addGetstatic(thisClassName, DEFAULT_INTERCEPTOR, HANDLER_TYPE);
  code.addOpcode(Opcode.IFNONNULL);
  code.addIndex(10);
code.addGetstatic(NULL_INTERCEPTOR_HOLDER, DEFAULT_INTERCEPTOR, HANDLER_TYPE);
code.addPutfield(thisClassName, HANDLER, HANDLER_TYPE);
int pc = code.currentPc();

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

int delIndex = index * 2 + 1;
int arrayVar = args + 1;
code.addGetstatic(thisClassName, HOLDER, HOLDER_TYPE);
code.addAstore(arrayVar);

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

code.addGetstatic(thisClassName, DEFAULT_INTERCEPTOR, HANDLER_TYPE);
  code.addPutfield(thisClassName, HANDLER, HANDLER_TYPE);
  code.addGetstatic(thisClassName, DEFAULT_INTERCEPTOR, HANDLER_TYPE);
  code.addOpcode(Opcode.IFNONNULL);
  code.addIndex(10);
code.addGetstatic(NULL_INTERCEPTOR_HOLDER, DEFAULT_INTERCEPTOR, HANDLER_TYPE);
code.addPutfield(thisClassName, HANDLER, HANDLER_TYPE);
int pc = code.currentPc();

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

int delIndex = index * 2 + 1;
int arrayVar = args + 1;
code.addGetstatic(thisClassName, HOLDER, HOLDER_TYPE);
code.addAstore(arrayVar);

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

Bytecode code = new Bytecode(cp);
if (is_static) {
  code.addGetstatic(Bytecode.THIS, fieldName, fieldType);

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

Bytecode code = new Bytecode(cp);
if (is_static) {
  code.addGetstatic(Bytecode.THIS, fieldName, fieldType);

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

code.addGetstatic(Bytecode.THIS, fieldName, fieldType);

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

code.addGetstatic(Bytecode.THIS, fieldName, fieldType);

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

public static void println(Bytecode proxyBytecode, String message) {
    proxyBytecode.addGetstatic("java/lang/System", "out", "Ljava/io/PrintStream;");
    proxyBytecode.addLdc(message);
    proxyBytecode.addInvokevirtual("java.io.PrintStream", "println", "(Ljava/lang/String;)V");
  }
}

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

/**
   * Appends instructions for executing
   * <code>java.lang.System.println(<i>message</i>)</code>.
   *
   * @param message           printed message.
   */
  public void addPrintln(String message) {
    addGetstatic("java.lang.System", "err", "Ljava/io/PrintStream;");
    addLdc(message);
    addInvokevirtual("java.io.PrintStream",
             "println", "(Ljava/lang/String;)V");
  }
}

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

/**
   * Appends instructions for executing
   * <code>java.lang.System.println(<i>message</i>)</code>.
   *
   * @param message           printed message.
   */
  public void addPrintln(String message) {
    addGetstatic("java.lang.System", "err", "Ljava/io/PrintStream;");
    addLdc(message);
    addInvokevirtual("java.io.PrintStream",
             "println", "(Ljava/lang/String;)V");
  }
}

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

/**
   * Appends instructions for executing
   * <code>java.lang.System.println(<i>message</i>)</code>.
   *
   * @param message           printed message.
   */
  public void addPrintln(String message) {
    addGetstatic("java.lang.System", "err", "Ljava/io/PrintStream;");
    addLdc(message);
    addInvokevirtual("java.io.PrintStream",
             "println", "(Ljava/lang/String;)V");
  }
}

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

/**
   * Appends instructions for executing
   * <code>java.lang.System.println(<i>message</i>)</code>.
   *
   * @param message           printed message.
   */
  public void addPrintln(String message) {
    addGetstatic("java.lang.System", "err", "Ljava/io/PrintStream;");
    addLdc(message);
    addInvokevirtual("java.io.PrintStream",
             "println", "(Ljava/lang/String;)V");
  }
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

/**
   * Appends instructions for executing
   * <code>java.lang.System.println(<i>message</i>)</code>.
   *
   * @param message           printed message.
   */
  public void addPrintln(String message) {
    addGetstatic("java.lang.System", "err", "Ljava/io/PrintStream;");
    addLdc(message);
    addInvokevirtual("java.io.PrintStream",
             "println", "(Ljava/lang/String;)V");
  }
}

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

public static Bytecode println(ConstPool cp, String message) {
  Bytecode proxyBytecode = new Bytecode(cp);
  proxyBytecode.addGetstatic("java/lang/System", "out", "Ljava/io/PrintStream;");
  proxyBytecode.addLdc(message);
  proxyBytecode.addInvokevirtual("java.io.PrintStream", "println", "(Ljava/lang/String;)V");
  return proxyBytecode;
}

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

private void addEntityViewManagerGetter(CtClass cc, Method method) throws CannotCompileException {
  ConstPool cp = cc.getClassFile2().getConstPool();
  String desc = Descriptor.of(method.getReturnType().getName());
  MethodInfo minfo = new MethodInfo(cp, method.getName(), "()" + desc);
  minfo.setAccessFlags(AccessFlag.PUBLIC);
  Bytecode code = new Bytecode(cp, 1, 1);
  code.addGetstatic(cc, "$$_evm", desc);
  code.addOpcode(Bytecode.ARETURN);
  minfo.setCodeAttribute(code.toCodeAttribute());
  cc.addMethod(CtMethod.make(minfo, cc));
}

相关文章