When I compile thrid-party library a number of 'should be parameterized' warnings are generated. I know how to fix them but I do not want to so I tried to disable all warning/error in Eclipse. However, the warnings are still generated after every warning/error are disable. Please help.
4 Answers
You can add @SuppressWarnings("rawtypes")
to a method, statement or method argument to suppress this warning.
As an example a common one in Eclipse plugins is:
@Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)
You Can change the settings in eclipse:
- Go to project properties -> Java Compiler -> Errors/Warnings
- Enable the - Enable project specific settings
- Change warning to ignore.
in the file: .settings/org.eclipse.jdt.core.prefs
add:
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
If you're not interested in the type of the class being modelled by the Class
object, an alternative to suppressing or ignoring the warnings is to use the <?>
notation as follows: Class<?>
.
-
That wont work. If the class has been defined generically(bounded or unbounded) and if its used without generics then <?> won't help. Either use with type parameter or suppress/ignore warning.– nanosoftFeb 26, 2018 at 7:11