It's possible to tell Eclipse which code should lead to warning, which to error and which should be handled as normal.
You need to do the following two steps for this purpose:
- Open Window -> Preferences -> Java -> Compiler -> Errors/Warnings.
- Change properties in the way you want.
My settings are shown below.