I read about the -Xlint:unchecked in the Oracle Java tutorial link. And I would like to setup my IDE to inform me about unsafe code. But I faced some troubles trying to accomplish so. But I managed to get a warning message in my Terminal using command:
javac GenericsMain.java Box.java -Xlint:unchecked
I got such message
GenericsMain.java:19: warning: [unchecked] unchecked call to addItem(T)
as a member of the raw type Box
rawBox.addItem(8);
^
where T is a type-variable:
T extends Object declared in class Box
GenericsMain.java:23: warning:
[unchecked] unchecked call to addItem(T) as a member of the raw type Box
rawBox.addItem(8);
^
where T is a type-variable:
T extends Object declared in class Box
2 warnings
How can I provide this in my IDE? Thank you.