开发者

Eclipse's Dead Code warning when it is reachable?

开发者 https://www.devze.com 2023-01-21 17:29 出处:网络
Why Eclipse gives me a dead code warning in the fourth line of the following method? How can it not be reachable?

Why Eclipse gives me a dead code warning in the fourth line of the following method? How can it not be reachable?

private void writeToSequenceFile() {
 try {
   CustomFileWriter nBatchWriter = new CustomFileWriter(sequeneceFileName, CONFIG_RESOURCE_NAME, "outputFile");
   // The line below is a dead code?   
   lineBuilder.setString("Line", fileSequenceDate.concat(" ").concat(fileSequenceNo));
   lineBuilder.setString("LineFeed", "\r");
   nBatchWriter.writeRecord(lineBuilder.toRecord());

   nBatchWriter.close();
  } catch (Exception ex){
   throw new NcoBusines开发者_StackOverflow中文版sProgramException("Error Writing To Sequence File!");
  } 
 }


Does it compile?

The only possible way that I can imagine for that line to be unreachable would be if the CustomFileWriter constructor called writeToSequenceFile(), causing infinite recursion, so the next line would never be reached. (Or if the constructor always threw an exception, but that would be a pretty silly way to write it.)


Are you sure it is ? It might be an artefact, try to close and reopen the file, or save all and rebuild.

0

精彩评论

暂无评论...
验证码 换一张
取 消