Reputation:
I'm using the Version "4.7.2 December 2017 Update" of Eclipse and I have a warning that when I use:
System.out.println(20 % 10 == 0);
And in the "Problems" tab, this shows up: Warnings (1 item) > Comparing Identical Expressions
So how do I fix this warning, do I have to do in the Project Properties > Java Compiler > Errors/Warnings or Workspace Properties > Java > Compiler > Errors/Warnings or inside the Project Properties > Project Preference?
Upvotes: 1
Views: 2102
Reputation: 101
You can also use @SuppressWarnings("all") but it will turn off all warnings on that code block of course
Upvotes: 0
Reputation: 111142
Eclipse is telling you that this expression will always be true.
If you really want to turn this off you can set the behavior for this in the Preferences in 'Java > Compiler > Errors/Warnings'. In the 'Potential programming issues' section set the action for 'Comparing identical values' to 'Ignore'
For a single project this can be configured in the project Properties in 'Java Compiler > Errors/Warnings'.
Upvotes: 1