remove unnecessary InvalidClassFileException declarations

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3618 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2009-05-29 14:23:29 +00:00
parent 1a181c55d5
commit 6f96d41dc2
4 changed files with 17 additions and 18 deletions

View File

@ -48,7 +48,6 @@ import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph; import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.cha.IClassHierarchy; import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.properties.WalaProperties; import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.shrikeCT.InvalidClassFileException;
import com.ibm.wala.ssa.IR; import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.SSAInstruction; import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.types.ClassLoaderReference; import com.ibm.wala.types.ClassLoaderReference;
@ -231,13 +230,7 @@ public abstract class IRTests extends WalaTestCase {
SSAInstruction[] insts = ir.getInstructions(); SSAInstruction[] insts = ir.getInstructions();
for (int i = 0; i < insts.length; i++) { for (int i = 0; i < insts.length; i++) {
if (insts[i] != null) { if (insts[i] != null) {
int ln = -1; int ln = m.getLineNumber(i);
try {
ln = m.getLineNumber(i);
} catch (InvalidClassFileException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
if (ln == definingLineNumber) { if (ln == definingLineNumber) {
System.err.println((" found " + insts[i] + " at " + ln)); System.err.println((" found " + insts[i] + " at " + ln));
for (int j = 0; j < insts[i].getNumberOfDefs(); j++) { for (int j = 0; j < insts[i].getNumberOfDefs(); j++) {

View File

@ -115,16 +115,14 @@ public interface IMethod extends IMember, ContextItem {
/** /**
* @return the source line number corresponding to a particular bytecode index, or -1 if the information is not available. * @return the source line number corresponding to a particular bytecode index, or -1 if the information is not available.
* @throws InvalidClassFileException
*/ */
int getLineNumber(int bcIndex) throws InvalidClassFileException; int getLineNumber(int bcIndex);
/** /**
* @return the (source code) name of the local variable of a given number at the specified program counter, or null if the * @return the (source code) name of the local variable of a given number at the specified program counter, or null if the
* information is not available. * information is not available.
* @throws InvalidClassFileException
*/ */
String getLocalVariableName(int bcIndex, int localNumber) throws InvalidClassFileException; String getLocalVariableName(int bcIndex, int localNumber);
/** /**
* something like: com.foo.bar.createLargeOrder(IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer; * something like: com.foo.bar.createLargeOrder(IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;

View File

@ -743,8 +743,12 @@ public abstract class ShrikeBTMethod implements IMethod, BytecodeConstants {
/* /*
* @see com.ibm.wala.classLoader.IMethod#getLineNumber(int) * @see com.ibm.wala.classLoader.IMethod#getLineNumber(int)
*/ */
public int getLineNumber(int bcIndex) throws InvalidClassFileException { public int getLineNumber(int bcIndex) {
return (getBCInfo().lineNumberMap == null) ? -1 : getBCInfo().lineNumberMap[bcIndex]; try {
return (getBCInfo().lineNumberMap == null) ? -1 : getBCInfo().lineNumberMap[bcIndex];
} catch (InvalidClassFileException e) {
return -1;
}
} }
/** /**
@ -788,8 +792,7 @@ public abstract class ShrikeBTMethod implements IMethod, BytecodeConstants {
/* /*
* @see com.ibm.wala.classLoader.IMethod#getLocalVariableName(int, int) * @see com.ibm.wala.classLoader.IMethod#getLocalVariableName(int, int)
*/ */
public abstract String getLocalVariableName(int bcIndex, int localNumber);
public abstract String getLocalVariableName(int bcIndex, int localNumber) throws InvalidClassFileException;
/* /*
* TODO: cache for efficiency? * TODO: cache for efficiency?

View File

@ -156,8 +156,13 @@ public final class ShrikeCTMethod extends ShrikeBTMethod implements IBytecodeMet
} }
@Override @Override
public String getLocalVariableName(int bcIndex, int localNumber) throws InvalidClassFileException { public String getLocalVariableName(int bcIndex, int localNumber){
int[][] map = getBCInfo().localVariableMap; int[][] map = null;
try {
map = getBCInfo().localVariableMap;
} catch (InvalidClassFileException e1) {
return null;
}
if (localNumber > getMaxLocals()) { if (localNumber > getMaxLocals()) {
throw new IllegalArgumentException("illegal local number: " + localNumber + ", method " + getName() + " uses at most " throw new IllegalArgumentException("illegal local number: " + localNumber + ", method " + getName() + " uses at most "