Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Eclipse warn about Java "unused variables" but javac does not?

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?

like image 364
stackoverflowuser2010 Avatar asked Dec 02 '22 00:12

stackoverflowuser2010


1 Answers

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

like image 113
ring bearer Avatar answered Dec 04 '22 07:12

ring bearer