本文整理汇总了Java中org.apache.bcel.classfile.LocalVariable.getSignature方法的典型用法代码示例。如果您正苦于以下问题:Java LocalVariable.getSignature方法的具体用法?Java LocalVariable.getSignature怎么用?Java LocalVariable.getSignature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.classfile.LocalVariable
的用法示例。
在下文中一共展示了LocalVariable.getSignature方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLocalVariable
import org.apache.bcel.classfile.LocalVariable; //导入方法依赖的package包/类
@CheckForNull
GenericObjectType getLocalVariable(int index, int pos) {
if (genericLocalVariables == null || !genericLocalVariables.get(index))
return null;
for (LocalVariable local : localTypeTable.getLocalVariableTypeTable())
if (local.getIndex() == index && local.getStartPC() <= pos
&& pos < +local.getStartPC() + local.getLength()) {
String signature = local.getSignature();
if (signature.indexOf('<') < 0) continue;
Type t;
try {
t = GenericUtilities.getType(signature);
if (t instanceof GenericObjectType)
return (GenericObjectType) t;
} catch (RuntimeException e) {
AnalysisContext.logError("Bad signature " + signature
+ " for " + local.getName(), e);
}
return null;
}
return null;
}
示例2: pushByLocalObjectLoad
import org.apache.bcel.classfile.LocalVariable; //导入方法依赖的package包/类
private void pushByLocalObjectLoad(DismantleBytecode dbc, int register) {
Method m = dbc.getMethod();
LocalVariableTable lvt = m.getLocalVariableTable();
if (lvt != null) {
LocalVariable lv = LVTHelper.getLocalVariableAtPC(lvt, register, dbc.getPC());
if (lv != null) {
String signature = lv.getSignature();
pushByLocalLoad(signature, register);
return;
}
}
pushBySignature("");
}
示例3: visitLocalVariable
import org.apache.bcel.classfile.LocalVariable; //导入方法依赖的package包/类
@Override
public void visitLocalVariable(LocalVariable obj) {
String name1 = obj.getSignature();
if (this.parser.isDebug()) {
this.parser.debug("visitLocalVariable: obj.getSignature() = " + name1);
Collection<String> types = ParseUtil.signatureToTypes(name1);
for (String name : types) {
this.jClass.getDetail().addVariableType(name);
if (this.parser.isDebug()) {
this.parser.debug("visitLocalVariable: variable type = " + name);
}
}
}
}
示例4: pushByLocalObjectLoad
import org.apache.bcel.classfile.LocalVariable; //导入方法依赖的package包/类
private void pushByLocalObjectLoad(DismantleBytecode dbc, int register) {
Method m = dbc.getMethod();
LocalVariableTable lvt = m.getLocalVariableTable();
if (lvt != null) {
LocalVariable lv = LVTHelper.getLocalVariableAtPC(lvt, register, dbc.getPC());
if (lv != null) {
String signature = lv.getSignature();
pushByLocalLoad(signature, register);
return;
}
}
pushByLocalLoad("Ljava/lang/Object;", register);
}
示例5: sawOpcode
import org.apache.bcel.classfile.LocalVariable; //导入方法依赖的package包/类
public void sawOpcode(int seen) {
switch (state) {
case SEEN_NOTHING:
if (seen == ALOAD)
register = getRegisterOperand();
else if ((seen >= ALOAD_0) && (seen <= ALOAD_3))
register = seen - ALOAD_0;
else
return;
state = SEEN_ALOAD;
break;
case SEEN_ALOAD:
try {
if (seen == INSTANCEOF) {
LocalVariable lv = LVTHelper.getLocalVariableAtPC(varTable, register, getPC());
if (lv != null) {
String objSignature = lv.getSignature();
if (objSignature.charAt(0) == 'L') {
objSignature = objSignature.substring(1, objSignature.length()-1).replace('/', '.');
String clsSignature = getDottedClassConstantOperand();
if (clsSignature.charAt(0) != '[') {
if (org.apache.bcel.Repository.instanceOf( objSignature, clsSignature )) {
bugReporter.reportBug(new BugInstance(this, "SIO_SUPERFLUOUS_INSTANCEOF", LOW_PRIORITY)
.addClassAndMethod(this)
.addSourceLine(this));
}
}
}
}
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
}
state = SEEN_NOTHING;
break;
}
}
示例6: sawOpcode
import org.apache.bcel.classfile.LocalVariable; //导入方法依赖的package包/类
@Override
public void sawOpcode(int seen) {
switch (state) {
case SEEN_NOTHING:
if (seen == ALOAD)
register = getRegisterOperand();
else if ((seen >= ALOAD_0) && (seen <= ALOAD_3))
register = seen - ALOAD_0;
else
return;
state = SEEN_ALOAD;
break;
case SEEN_ALOAD:
try {
if (seen == INSTANCEOF) {
LocalVariable lv = LVTHelper.getLocalVariableAtPC(varTable, register, getPC());
if (lv != null) {
String objSignature = lv.getSignature();
if (objSignature.charAt(0) == 'L') {
objSignature = objSignature.substring(1, objSignature.length() - 1).replace('/', '.');
String clsSignature = getDottedClassConstantOperand();
if (clsSignature.charAt(0) != '[') {
if (org.apache.bcel.Repository.instanceOf(objSignature, clsSignature)) {
bugReporter.reportBug(new BugInstance(this, "SIO_SUPERFLUOUS_INSTANCEOF", LOW_PRIORITY)
.addClassAndMethod(this).addSourceLine(this));
}
}
}
}
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
}
state = SEEN_NOTHING;
break;
}
}