简体   繁体   中英

How to disable warning in Eclipse - 'Class is a raw type. References to generic type Class<T> should be parameterized'

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.

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:

  1. Go to project properties -> Java Compiler -> Errors/Warnings
  2. Enable the - Enable project specific settings
  3. Change warning to ignore.

如果您对由Class对象建模的Class的类型不感兴趣,则抑制或忽略警告的替代方法是使用<?>表示法,如下所示: Class<?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM