I am getting this warning:
When I click on the image, it just opens the associated Editor, but it doesn't say the line number where the warning is raised.
I don't want to add @SuppressWarning("unchecked")
on the whole class...
Any workaround/fix?
How to resolve warning message: uses unchecked or unsafe operations. You can resolve this warning message by using generics with Collections. In our example, we should use ArrayList<String> rather than ArrayList() . When you will compile above code, you won't get warning message anymore.
Open the needed file in the editor and from the main menu, select Build | Recompile 'class name' ( Ctrl+Shift+F9 ). Alternatively, in the Project tool window, right-click the class you need and from the context menu, select Recompile 'class name'.
To compile with -Xlint:unchecked
in IntelliJ IDEA:
Settings
dialog (Ctrl+Alt+S or ⌘ +, ) Compiler
> Java Compiler
Add following into the field Additional command line parameters
:
-Xlint:unchecked
Run your compile again
A faster solution:
Type "Additional com" and press Enter:
Type -Xlint:unchecked
> OK
Press Ctrl + Shift + F9 to recompile (or go to Build > Compile ... )
You will see the line and the column where the problem appeared
E.g.: Warning:(5,27) java: unchecked ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With