[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jdt-core-dev] Unnecessary type checks (cast/instanceof)
|
If you get your hands onto JDT/Core from HEAD, it contains support for
detecting unnecessary type checks. Until UI provides preference page for
it, you can enable it by adding
the line:
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
to file:
<workspace>\.metadata\.plugins\org.eclipse.jdt.core\pref_store.ini
NOTE: this new behavior is operational, but not final yet (it should soon
detect a few more scenarii: conditional expressions and unnecessary
narrowing cast, also see bug 35442).
Now some teasing stats:
With following optional warnings enabled:
- unnecessary type check
- superfluous semicolon
- indirect access to static member
The 2 latters can be enabled by adding following 2 lines to pref_store.ini:
org.eclipse.jdt.core.compiler.problem.superfluousSemicolon=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
Against 20030107
org.eclipse.jdt.core (HEAD) 1 warning left (was many more than that
before I starting testing it (around 90 if I remember well) <g>)
org.eclipse.jdt.ui 414 warnings
org.eclipse.jdt.launching: 4 warnings
org.eclipse.jdt.junit 16 warnings
org.eclipse.jdt.debug 97 warnings
org.eclipse.jdt.debug.ui 87 warnings
Of course, we (JDT) cannot stand bad Java code... <g>