本文整理汇总了Java中scouter.javassist.CtField.getFieldInfo2方法的典型用法代码示例。如果您正苦于以下问题:Java CtField.getFieldInfo2方法的具体用法?Java CtField.getFieldInfo2怎么用?Java CtField.getFieldInfo2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scouter.javassist.CtField
的用法示例。
在下文中一共展示了CtField.getFieldInfo2方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: atFieldRead
import scouter.javassist.CtField; //导入方法依赖的package包/类
private void atFieldRead(CtField f) throws CompileError {
FieldInfo finfo = f.getFieldInfo2();
String type = finfo.getDescriptor();
int i = 0;
int dim = 0;
char c = type.charAt(i);
while (c == '[') {
++dim;
c = type.charAt(++i);
}
arrayDim = dim;
exprType = MemberResolver.descToType(c);
if (c == 'L')
className = type.substring(i + 1, type.indexOf(';', i + 1));
else
className = null;
}
示例2: atFieldAssignCore
import scouter.javassist.CtField; //导入方法依赖的package包/类
private void atFieldAssignCore(CtField f, boolean is_static, int fi,
boolean is2byte) throws CompileError {
if (fi != 0) {
if (is_static) {
bytecode.add(PUTSTATIC);
bytecode.growStack(is2byte ? -2 : -1);
}
else {
bytecode.add(PUTFIELD);
bytecode.growStack(is2byte ? -3 : -2);
}
bytecode.addIndex(fi);
}
else {
CtClass declClass = f.getDeclaringClass();
AccessorMaker maker = declClass.getAccessorMaker();
// make should be non null.
FieldInfo finfo = f.getFieldInfo2();
MethodInfo minfo = maker.getFieldSetter(finfo, is_static);
bytecode.addInvokestatic(declClass, minfo.getName(),
minfo.getDescriptor());
}
}
示例3: atFieldRead
import scouter.javassist.CtField; //导入方法依赖的package包/类
/**
* Generates bytecode for reading a field value.
* It returns a fieldref_info index or zero if the field is a private
* one declared in an enclosing class.
*/
private int atFieldRead(CtField f, boolean isStatic) throws CompileError {
FieldInfo finfo = f.getFieldInfo2();
boolean is2byte = setFieldType(finfo);
AccessorMaker maker = isAccessibleField(f, finfo);
if (maker != null) {
MethodInfo minfo = maker.getFieldGetter(finfo, isStatic);
bytecode.addInvokestatic(f.getDeclaringClass(), minfo.getName(),
minfo.getDescriptor());
return 0;
}
else {
int fi = addFieldrefInfo(f, finfo);
if (isStatic) {
bytecode.add(GETSTATIC);
bytecode.growStack(is2byte ? 2 : 1);
}
else {
bytecode.add(GETFIELD);
bytecode.growStack(is2byte ? 1 : 0);
}
bytecode.addIndex(fi);
return fi;
}
}
示例4: atFieldAssign
import scouter.javassist.CtField; //导入方法依赖的package包/类
protected void atFieldAssign(Expr expr, int op, ASTree left,
ASTree right, boolean doDup) throws CompileError
{
CtField f = fieldAccess(left, false);
boolean is_static = resultStatic;
if (op != '=' && !is_static)
bytecode.addOpcode(DUP);
int fi;
if (op == '=') {
FieldInfo finfo = f.getFieldInfo2();
setFieldType(finfo);
AccessorMaker maker = isAccessibleField(f, finfo);
if (maker == null)
fi = addFieldrefInfo(f, finfo);
else
fi = 0;
}
else
fi = atFieldRead(f, is_static);
int fType = exprType;
int fDim = arrayDim;
String cname = className;
atAssignCore(expr, op, right, fType, fDim, cname);
boolean is2w = is2word(fType, fDim);
if (doDup) {
int dup_code;
if (is_static)
dup_code = (is2w ? DUP2 : DUP);
else
dup_code = (is2w ? DUP2_X1 : DUP_X1);
bytecode.addOpcode(dup_code);
}
atFieldAssignCore(f, is_static, fi, is2w);
exprType = fType;
arrayDim = fDim;
className = cname;
}