Using Eclipse Java Compiler Errors/Warnings – Improving your code quality

If you want to setup a more restricted development environment to create Java code with higher code quality, have a look at the Eclipse preferences settings under Java -> Compiler -> Errors/Warnings.

Here you can define how the Java compiler should react to certain common programming problems, e.g. you can define that “Assignement has no effect (e.g. x=x)” causes an error in Eclipse.

I highly recommend the usage of restrictive settings here to improve your code quality. For example I consider the following settings as important:


This should only be your first step, additional checks are provided by Findbugs and Checkstyles Using FindBugs and Checkstyle in Eclipse – Tutorial

About Lars Vogel

Lars Vogel is the founder and CEO of the vogella GmbH and works as Eclipse and Android consultant, trainer and book author. He is a regular speaker at international conferences, He is the primary author of With more than one million visitors per month this website is one of the central sources for Java, Eclipse and Android programming information.
This entry was posted in Eclipse. Bookmark the permalink.

4 Responses to Using Eclipse Java Compiler Errors/Warnings – Improving your code quality

  1. Kevin says:

    Due to legacy code we tend to go with the warning setting instead of error but now that the code base is warning free I like the idea of switching to error. All sections of this settings panel should be explored by Eclipse users. I really wish you could export these settings. I hate to set them up for every workspace and I want to export them and give our required set of warnings / errors to new employees.

    I also consider the JavaDoc errors / warnings section of the preferences dialog important. If you use JavaDoc style commenting then you should allow Eclipse to help you keep it all in sync as best it can warning of missing return and parameter references.

  2. vogella says:

    Hi Kevin,

    exporting these settings would also in my opinion valuable. Can you open a bug for this?

    Best regards, Lars

  3. Gaurav says:

    There settings are part of the complete export of Preferences but can’t be exported independently..

    I gave a shot at trying to tweak the full export by deleting all other values and importing back on a different machine but didn’t work for me, haven’t tried since..

  4. thSoft says:

    Note that you can configure these settings per project and then commit the preferences to the source control, thus automatically enforcing a coding standard for your project.

Comments are closed.