Last modified 16 years ago
Last modified on 01/12/09 18:51:15
For now, we should use the following compiler settings about warnings and errors in order to increase the quality of the code. From the Window/Preferences/Java/Compiler choose your settings to match those in the pictures bellow. Some of these work only with Eclipse 3.3 (Europa), so you should emerge to that version.
Note: you may have to adjust some other options in order to see all the warnings while building. To start with, from Window/Preferences/Java/Compiler/Building set Maximum number of problems reported per compilation unit to 3000 (there are above 2000 warnings currently). From the problems view (where the warnings are shown), choose preferences and set "Limit visible items per group:" to 3000.
- How to fix or suppress some of the warnings:
- How to fix:
- Access to a non accessible member of a enclosing type: - if it safe to make the member protected, make it, otherwise suppress the warning.
- How to suppress: use the @SuppressWarnings(list of warnings) directive before a method declaration.
- How to fix:
@SuppressWarnings("unqualified-field-access")
public void static...
In order to suppress the correct warnings just click on the warning mark on the left and choose the @Suppress... line in the help window.
Comments
- Note that warnings should be suppressed only when there is no smart way to avoid them, not just to decrease the warnings count. For now, if you are not sure, ask. --Milo
- The images linked in the page are not present, which makes the page almost useless. Also I think that the default compiler settings for Eclipse suit our needs. And we don't have 2000 warnings anymore. It would be good if the paragraphs had some headings. --boyan@2009-01-12
Attachments
-
Code_style.JPG
(67.0 KB) -
added by Tanya 17 years ago.
Code_style
-
Potential_problems.JPG
(65.4 KB) -
added by Tanya 17 years ago.
Potential_problems
-
Name_shadowing_restricted_API.JPG
(66.3 KB) -
added by Tanya 17 years ago.
Name_shadowing_restricted_API
-
Unnecessary_code.JPG
(61.3 KB) -
added by Tanya 17 years ago.
Unnecessary_code
-
Generic_types.JPG
(64.8 KB) -
added by Tanya 17 years ago.
Generic_types
-
Javadoc_warnings.JPG
(56.3 KB) -
added by Tanya 17 years ago.
Javadoc_warnings