本文整理了Java中javassist.bytecode.Bytecode.addLdc()
方法的一些代码示例,展示了Bytecode.addLdc()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytecode.addLdc()
方法的具体详情如下:
包路径:javassist.bytecode.Bytecode
类名称:Bytecode
方法名:addLdc
[英]Appends LDC or LDC_W.
[中]附加最不发达国家或最不发达国家。
代码示例来源:origin: redisson/redisson
int compile(Bytecode code) throws CannotCompileException {
code.addLdc(param);
return 1;
}
代码示例来源:origin: org.javassist/javassist
@Override
int compile(Bytecode code) throws CannotCompileException {
code.addLdc(param);
return 1;
}
代码示例来源:origin: redisson/redisson
/**
* Appends LDC or LDC_W. The pushed item is a <code>String</code>
* object.
*
* @param s the character string pushed by LDC or LDC_W.
*/
public void addLdc(String s) {
addLdc(constPool.addStringInfo(s));
}
代码示例来源:origin: redisson/redisson
public void atStringL(StringL s) throws CompileError {
exprType = CLASS;
arrayDim = 0;
className = jvmJavaLangString;
bytecode.addLdc(s.get());
}
代码示例来源:origin: org.javassist/javassist
/**
* Appends LDC or LDC_W. The pushed item is a <code>String</code>
* object.
*
* @param s the character string pushed by LDC or LDC_W.
*/
public void addLdc(String s) {
addLdc(constPool.addStringInfo(s));
}
代码示例来源:origin: org.javassist/javassist
@Override
public void atStringL(StringL s) throws CompileError {
exprType = CLASS;
arrayDim = 0;
className = jvmJavaLangString;
bytecode.addLdc(s.get());
}
代码示例来源:origin: redisson/redisson
/**
* Appends FCONST or FCONST_<n>
*
* @param f the pushed float constant.
*/
public void addFconst(float f) {
if (f == 0.0f || f == 1.0f || f == 2.0f)
addOpcode(11 + (int)f); // fconst_<n>
else
addLdc(constPool.addFloatInfo(f));
}
代码示例来源:origin: redisson/redisson
int compileIfStatic(CtClass type, String name, Bytecode code,
Javac drv) throws CannotCompileException
{
code.addLdc(value);
code.addPutstatic(Bytecode.THIS, name, Descriptor.of(type));
return 1; // stack size
}
代码示例来源: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: redisson/redisson
/**
* @param thisMethod might be null.
*/
private static void callFind2Methods(Bytecode code, String superMethod, String thisMethod,
int index, String desc, int classVar, int arrayVar) {
String findClass = RuntimeSupport.class.getName();
String findDesc
= "(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/reflect/Method;)V";
code.addAload(classVar);
code.addLdc(superMethod);
if (thisMethod == null)
code.addOpcode(Opcode.ACONST_NULL);
else
code.addLdc(thisMethod);
code.addIconst(index);
code.addLdc(desc);
code.addAload(arrayVar);
code.addInvokestatic(findClass, "find2Methods", findDesc);
}
代码示例来源:origin: org.javassist/javassist
/**
* Appends FCONST or FCONST_<n>
*
* @param f the pushed float constant.
*/
public void addFconst(float f) {
if (f == 0.0f || f == 1.0f || f == 2.0f)
addOpcode(11 + (int)f); // fconst_<n>
else
addLdc(constPool.addFloatInfo(f));
}
代码示例来源:origin: org.javassist/javassist
@Override
int compileIfStatic(CtClass type, String name, Bytecode code,
Javac drv) throws CannotCompileException
{
code.addLdc(value);
code.addPutstatic(Bytecode.THIS, name, Descriptor.of(type));
return 1; // stack size
}
代码示例来源:origin: redisson/redisson
int compile(CtClass type, String name, Bytecode code,
CtClass[] parameters, Javac drv)
throws CannotCompileException
{
code.addAload(0);
code.addLdc(value);
code.addPutfield(Bytecode.THIS, name, Descriptor.of(type));
return 2; // stack size
}
代码示例来源: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 atClassObject2(String cname) throws CompileError {
if (getMajorVersion() < ClassFile.JAVA_5)
super.atClassObject2(cname);
else
bytecode.addLdc(bytecode.getConstPool().addClassInfo(cname));
}
代码示例来源:origin: org.javassist/javassist
@Override
int compile(CtClass type, String name, Bytecode code,
CtClass[] parameters, Javac drv)
throws CannotCompileException
{
code.addAload(0);
code.addLdc(value);
code.addPutfield(Bytecode.THIS, name, Descriptor.of(type));
return 2; // stack size
}
代码示例来源:origin: org.javassist/javassist
@Override
protected void atClassObject2(String cname) throws CompileError {
if (getMajorVersion() < ClassFile.JAVA_5)
super.atClassObject2(cname);
else
bytecode.addLdc(bytecode.getConstPool().addClassInfo(cname));
}
代码示例来源:origin: redisson/redisson
protected final int compileStringParameter(Bytecode code)
throws CannotCompileException
{
int nparam = stringParams.length;
code.addIconst(nparam);
code.addAnewarray(javaLangString);
for (int j = 0; j < nparam; ++j) {
code.add(Bytecode.DUP); // dup
code.addIconst(j); // iconst_<j>
code.addLdc(stringParams[j]); // ldc ...
code.add(Bytecode.AASTORE); // aastore
}
return 4;
}
代码示例来源:origin: org.javassist/javassist
protected final int compileStringParameter(Bytecode code)
throws CannotCompileException
{
int nparam = stringParams.length;
code.addIconst(nparam);
code.addAnewarray(javaLangString);
for (int j = 0; j < nparam; ++j) {
code.add(Bytecode.DUP); // dup
code.addIconst(j); // iconst_<j>
code.addLdc(stringParams[j]); // ldc ...
code.add(Bytecode.AASTORE); // aastore
}
return 4;
}
代码示例来源:origin: redisson/redisson
/**
* Appends ICONST or ICONST_<n>
*
* @param n the pushed integer constant.
*/
public void addIconst(int n) {
if (n < 6 && -2 < n)
addOpcode(3 + n); // iconst_<i> -1..5
else if (n <= 127 && -128 <= n) {
addOpcode(16); // bipush
add(n);
}
else if (n <= 32767 && -32768 <= n) {
addOpcode(17); // sipush
add(n >> 8);
add(n);
}
else
addLdc(constPool.addIntegerInfo(n));
}
内容来源于网络,如有侵权,请联系作者删除!