我在 eclipse 中从if(line == null)语句到r.close()语句收到死代码警告。
BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
int counter = 0;
while(true)
{
String line = r.readLine();
counter++;
if(line.contains(" = "))
{
String[] keyVal = new String[2];
keyVal[0] = line.substring(0, line.indexOf(" = ") - 1);
keyVal[1] = line.substring(line.indexOf(" = ") + 3);
buffer.add(keyVal);
}
else
{
new Exception("Invalid expression at line " + counter + " in file " + file.getPath()).printStackTrace();
}
if(line == null) // dead code here
{
break;
}
}
System.out.println("here is a dead code");
r.close(); // another dead code
森林海
相关分类