Useful compiler warning setting

You may have this already but in case not…

I have just turned on the Eclipse option to warn when variable declarations shadow another of the same name:

Preferences | Java | Compiler | Errors/Warnings

pastedImage.png

…after noticing a case of this by manual inspection (never easy without help from the IDE).

Of course what to do if the warning is raised needs some thought…

  • if it is really a different variable, change the name to avoid confusion

  • if it should be the shadowed variable, change the declaration (having worked out the impact)

mungo

The University of Dundee is a registered Scottish Charity, No: SC015096

···

Mungo Carstairs
Jalview Computational Scientist
The Barton Group
Division of Computational Biology
College of Life Sciences
University of Dundee, Dundee, Scotland, UK.
www.jalview.org
www.compbio.dundee.ac.uk