Reputation: 40969
For the same code, Eclipse shows warnings about unused variables, but compiling with "javac" (v1.6) does not. Does Eclipse use a different compiler or parser? How can I get javac to show the same warnings?
Upvotes: 4
Views: 3501
Reputation: 20803
Quote from JDT core (Eclipse's editor infrastructure)
JDT Core is the Java infrastructure of the Java IDE. It includes:
An incremental Java compiler. Implemented as an Eclipse builder, it is based on technology evolved from VisualAge for Java compiler. In particular, it allows to run and debug code which still contains unresolved errors.
It is the incremental Java compiler that shows the warning.
There are no ways to enable that warning in Sun/Oracle javac
Upvotes: 6
Reputation: 2273
From javadoc:
-Xlint Enable all recommended warnings. In this release, all available warnings are recommended.
And yes, eclispe use own compiler
Upvotes: 3
Reputation: 4686
This is part of the validation in eclipse. If you wanted your own rules similar to what eclipse does, you could use something like PMD.
http://pmd.sourceforge.net/rules/unusedcode.html
Upvotes: 2
Reputation: 272687
Eclipse uses its own compiler. You can enable/disable various messages by going to Window->Preferences->Java->Compiler->Errors/Warnings.
Upvotes: 6