当前位置: 首页>>代码示例>>Java>>正文


Java LocalVariable.getSignature方法代码示例

本文整理汇总了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;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:24,代码来源:TypeFrameModelingVisitor.java

示例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("");
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:OpcodeStack.java

示例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);
			}
		}
	}
}
 
开发者ID:jdepend,项目名称:cooper,代码行数:15,代码来源:SmallClassFileVisitor.java

示例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);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:14,代码来源:OpcodeStack.java

示例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;
	}
	
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:42,代码来源:SuperfluousInstanceOf.java

示例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;
    }

}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:42,代码来源:SuperfluousInstanceOf.java


注:本文中的org.apache.bcel.classfile.LocalVariable.getSignature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。