rmuir opened a new pull request #44:
URL: https://github.com/apache/lucene/pull/44
Detects common cases of unreachable/dead code.
Don't be confused by the name, this isn't enabling annotation-based null
analyzer or discouraging safety checks in the code.
This is simple flow analysis to detect cases like the following:
```
foo = null;
if (foo != null) {
// provably dead code
}
```
```
foo.invokeMethod();
if (foo != null) {
// provably dead code, would have thrown exc
}
```
I reviewed all the errors, and the check seems productive. I think a lot of
this stuff happens as the code "ages" over time. Lots of WTFs It even found
what appears to be a seriously broken `equals()` implementation.
For generated javacc code, the check is disabled via
`SuppressWarnings("unused")` because javacc generates strange/bad code such as:
```
if ("" == null)
```
For TestStressNRTReplication's `startNode()` method, the check is also
disabled because analysis folds the "test evilness controls" which are static
final constants. This itself is a WTF, shouldn't we instead randomize these
evil things in our tests rather than hardcoding them to specific values?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]