本文整理了Java中org.apache.bcel.classfile.Method.getLineNumberTable()
方法的一些代码示例,展示了Method.getLineNumberTable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Method.getLineNumberTable()
方法的具体详情如下:
包路径:org.apache.bcel.classfile.Method
类名称:Method
方法名:getLineNumberTable
暂无
代码示例来源:origin: spotbugs/spotbugs
private boolean uniqueLocations(Collection<Location> derefLocationSet) {
boolean uniqueDereferenceLocations = false;
LineNumberTable table = method.getLineNumberTable();
if (table == null) {
uniqueDereferenceLocations = true;
} else {
BitSet linesMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method);
for (Location loc : derefLocationSet) {
int lineNumber = table.getSourceLine(loc.getHandle().getPosition());
if (!linesMentionedMultipleTimes.get(lineNumber)) {
uniqueDereferenceLocations = true;
}
}
}
return uniqueDereferenceLocations;
}
代码示例来源:origin: spotbugs/spotbugs
LineNumberTable lineNumberTable = method.getLineNumberTable();
int lineNum = -1;
int prevStartPc = -1;
代码示例来源:origin: spotbugs/spotbugs
private boolean uniqueLocations(Collection<Location> derefLocationSet) {
boolean uniqueDereferenceLocations = false;
CodeException[] exceptionTable = method.getCode().getExceptionTable();
if (exceptionTable == null) {
return true;
}
checkForCatchAll: {
for (CodeException e : exceptionTable) {
if (e.getCatchType() == 0) {
break checkForCatchAll;
}
}
return true;
}
LineNumberTable table = method.getLineNumberTable();
if (table == null) {
uniqueDereferenceLocations = true;
} else {
BitSet linesMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method);
for (Location loc : derefLocationSet) {
int lineNumber = table.getSourceLine(loc.getHandle().getPosition());
if (lineNumber > 0 && !linesMentionedMultipleTimes.get(lineNumber)) {
uniqueDereferenceLocations = true;
}
}
}
return uniqueDereferenceLocations;
}
代码示例来源:origin: spotbugs/spotbugs
boolean callToAssertionMethod(Location loc) {
InstructionHandle h = loc.getHandle();
int firstPos = h.getPosition();
LineNumberTable ln = method.getLineNumberTable();
int firstLine = ln == null ? -1 : ln.getSourceLine(firstPos);
while (h != null) {
int pos = h.getPosition();
if (ln == null) {
if (pos > firstPos + 15) {
break;
}
} else {
int line = ln.getSourceLine(pos);
if (line != firstLine) {
break;
}
}
Instruction i = h.getInstruction();
if (i instanceof InvokeInstruction) {
InvokeInstruction ii = (InvokeInstruction) i;
String name = ii.getMethodName(classContext.getConstantPoolGen());
if (name.startsWith("check") || name.startsWith("assert")) {
return true;
}
}
h = h.getNext();
}
return false;
}
代码示例来源:origin: spotbugs/spotbugs
/**
* Create a SourceLineAnnotation covering an entire method.
*
* @param javaClass
* JavaClass containing the method
* @param method
* the method
* @return a SourceLineAnnotation for the entire method
*/
public static SourceLineAnnotation forEntireMethod(JavaClass javaClass, @CheckForNull Method method) {
String sourceFile = javaClass.getSourceFileName();
if (method == null) {
return createUnknown(javaClass.getClassName(), sourceFile);
}
Code code = method.getCode();
LineNumberTable lineNumberTable = method.getLineNumberTable();
if (code == null || lineNumberTable == null) {
return createUnknown(javaClass.getClassName(), sourceFile);
}
return forEntireMethod(javaClass.getClassName(), sourceFile, lineNumberTable, code.getLength());
}
代码示例来源:origin: spotbugs/spotbugs
public static LocalVariableAnnotation getLocalVariableAnnotation(Method method, int local, int position1, int position2) {
LocalVariableTable localVariableTable = method.getLocalVariableTable();
String localName = UNKNOWN_NAME;
if (localVariableTable != null) {
LocalVariable lv1 = localVariableTable.getLocalVariable(local, position1);
if (lv1 == null) {
lv1 = localVariableTable.getLocalVariable(local, position2);
position1 = position2;
}
if (lv1 != null) {
localName = lv1.getName();
}
}
LineNumberTable lineNumbers = method.getLineNumberTable();
if (lineNumbers == null) {
return new LocalVariableAnnotation(localName, local, position1);
}
int line = lineNumbers.getSourceLine(position1);
return new LocalVariableAnnotation(localName, local, position1, line);
}
代码示例来源:origin: spotbugs/spotbugs
LineNumberTable lineNumbers = method.getLineNumberTable();
for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {
Location location = i.next();
代码示例来源:origin: spotbugs/spotbugs
LineNumberTable table = method.getLineNumberTable();
int position = exceptionThrowerHandle.getPosition();
int line = table == null ? 0 : table.getSourceLine(position);
代码示例来源:origin: spotbugs/spotbugs
Method m = Global.getAnalysisCache().getMethodAnalysis(Method.class, methodDescriptor);
XClass xclass = Global.getAnalysisCache().getClassAnalysis(XClass.class, methodDescriptor.getClassDescriptor());
LineNumberTable lnt = m.getLineNumberTable();
String sourceFile = xclass.getSource();
if (sourceFile != null && lnt != null) {
代码示例来源:origin: gosu-lang/old-gosu-repo
private static Integer getMethodLineNumber(Method method) {
LineNumberTable lineNumberTable = method.getLineNumberTable();
return lineNumberTable == null ? -1 : lineNumberTable.getLineNumberTable()[0].getLineNumber();
}
代码示例来源:origin: gosu-lang/old-gosu-repo
private static Integer getMethodLineNumber(Method method) {
LineNumberTable lineNumberTable = method.getLineNumberTable();
return lineNumberTable == null ? -1 : lineNumberTable.getLineNumberTable()[0].getLineNumber();
}
代码示例来源:origin: org.apache.maven.shared/maven-shared-jar
private boolean hasDebugSymbols( JavaClass javaClass )
{
boolean ret = false;
Method[] methods = javaClass.getMethods();
for ( int i = 0; i < methods.length; i++ )
{
LineNumberTable linenumbers = methods[i].getLineNumberTable();
if ( linenumbers != null && linenumbers.getLength() > 0 )
{
ret = true;
break;
}
}
return ret;
}
}
代码示例来源:origin: com.google.code.findbugs/findbugs
private boolean uniqueLocations(Collection<Location> derefLocationSet) {
boolean uniqueDereferenceLocations = false;
LineNumberTable table = method.getLineNumberTable();
if (table == null) {
uniqueDereferenceLocations = true;
} else {
BitSet linesMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method);
for (Location loc : derefLocationSet) {
int lineNumber = table.getSourceLine(loc.getHandle().getPosition());
if (!linesMentionedMultipleTimes.get(lineNumber)) {
uniqueDereferenceLocations = true;
}
}
}
return uniqueDereferenceLocations;
}
代码示例来源:origin: com.google.code.findbugs/findbugs
boolean callToAssertionMethod(Location loc) {
InstructionHandle h = loc.getHandle();
int firstPos = h.getPosition();
LineNumberTable ln = method.getLineNumberTable();
int firstLine = ln == null ? -1 : ln.getSourceLine(firstPos);
while (h != null) {
int pos = h.getPosition();
if (ln == null) {
if (pos > firstPos + 15) {
break;
}
} else {
int line = ln.getSourceLine(pos);
if (line != firstLine) {
break;
}
}
Instruction i = h.getInstruction();
if (i instanceof InvokeInstruction) {
InvokeInstruction ii = (InvokeInstruction) i;
String name = ii.getMethodName(classContext.getConstantPoolGen());
if (name.startsWith("check") || name.startsWith("assert")) {
return true;
}
}
h = h.getNext();
}
return false;
}
代码示例来源:origin: com.google.code.findbugs/findbugs
private boolean uniqueLocations(Collection<Location> derefLocationSet) {
boolean uniqueDereferenceLocations = false;
CodeException[] exceptionTable = method.getCode().getExceptionTable();
if (exceptionTable == null) {
return true;
}
checkForCatchAll: {
for (CodeException e : exceptionTable) {
if (e.getCatchType() == 0) {
break checkForCatchAll;
}
}
return true;
}
LineNumberTable table = method.getLineNumberTable();
if (table == null) {
uniqueDereferenceLocations = true;
} else {
BitSet linesMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method);
for (Location loc : derefLocationSet) {
int lineNumber = table.getSourceLine(loc.getHandle().getPosition());
if (lineNumber > 0 && !linesMentionedMultipleTimes.get(lineNumber)) {
uniqueDereferenceLocations = true;
}
}
}
return uniqueDereferenceLocations;
}
代码示例来源:origin: com.google.code.findbugs/findbugs
LineNumberTable lineNumbers = method.getLineNumberTable();
if (lineNumbers == null) {
return new LocalVariableAnnotation(localName, local, position1);
代码示例来源:origin: com.google.code.findbugs/findbugs
/**
* Create a SourceLineAnnotation covering an entire method.
*
* @param javaClass
* JavaClass containing the method
* @param method
* the method
* @return a SourceLineAnnotation for the entire method
*/
public static SourceLineAnnotation forEntireMethod(JavaClass javaClass, @CheckForNull Method method) {
String sourceFile = javaClass.getSourceFileName();
if (method == null) {
return createUnknown(javaClass.getClassName(), sourceFile);
}
Code code = method.getCode();
LineNumberTable lineNumberTable = method.getLineNumberTable();
if (code == null || lineNumberTable == null) {
return createUnknown(javaClass.getClassName(), sourceFile);
}
return forEntireMethod(javaClass.getClassName(), sourceFile, lineNumberTable, code.getLength());
}
代码示例来源:origin: com.mebigfatguy.fb-contrib/fb-contrib
LineNumberTable lnt = getMethod().getLineNumberTable();
if (lnt == null) {
return pc;
代码示例来源:origin: mebigfatguy/fb-contrib
LineNumberTable lnt = getMethod().getLineNumberTable();
if (lnt == null) {
return pc;
代码示例来源:origin: com.google.code.findbugs/findbugs
Method m = Global.getAnalysisCache().getMethodAnalysis(Method.class, methodDescriptor);
XClass xclass = Global.getAnalysisCache().getClassAnalysis(XClass.class, methodDescriptor.getClassDescriptor());
LineNumberTable lnt = m.getLineNumberTable();
String sourceFile = xclass.getSource();
if (sourceFile != null && lnt != null) {
内容来源于网络,如有侵权,请联系作者删除!