简体   繁体   English

如何在Eclipse中禁用警告 - 'Class是原始类型。对泛型类型<T>的引用应该参数化'

[英]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. 我知道如何修复它们但我不想这样,我试图禁用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. 您可以将@SuppressWarnings("rawtypes")添加到方法,语句或方法参数中以禁止显示此警告。

As an example a common one in Eclipse plugins is: 举个例子,Eclipse插件中常见的一个是:

@Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)

You Can change the settings in eclipse: 您可以在eclipse中更改设置:

  1. Go to project properties -> Java Compiler -> Errors/Warnings 转到项目属性 - > Java编译器 - >错误/警告
  2. Enable the - Enable project specific settings 启用 - 启用项目特定设置
  3. Change warning to ignore. 更改警告以忽略。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Eclipse警告 - 类是原始类型。 对泛型类的引用 <T> 应该参数化 - Eclipse warning - Class is a raw type. References to generic type Class<T> should be parameterized 警告-类是原始类型。 对泛型类型Class的引用 <T> 应该参数化 - Warning - Class is a raw type. References to generic type Class<T> should be parameterized 为什么我收到警告:Class是原始类型。对泛型类型<T>的引用应该参数化“? - Why am I getting the warning :Class is a raw type. References to generic type Class<T> should be parameterized"? 类型类是原始类型。 对泛型类型Class的引用 <T> 应该参数化 - Type Class is a raw type. References to generic type Class<T> should be parameterized 类是原始类型。 对泛型类型Class的引用 <T> 应该参数化 - Class is a raw type. References to generic type Class<T> should be parameterized AddLinkEntry类是原始类型。 对泛型类型AddLinkEntry类的引用 <T> 应该参数化 - AddLinkEntry Class is a raw type. References to generic type AddLinkEntry Class<T> should be parameterized 如何解决此警告? -是原始类型。 泛型类型的引用应参数化 - How to address this warning? - Is a raw type. References to generic type should be parameterized 如何结束LinkedHashMap是一种原始类型。 引用泛型类型LinkedHashMap <K,V> 应该是Eclipse中的参数化问题 - How to over come LinkedHashMap is a raw type. References to generic type LinkedHashMap<K,V> should be parameterized issue in Eclipse 原始类型。 对泛型类型的引用应该被参数化 - Raw type. References to generic types should be parameterized AdapterView是原始类型。 泛型类型AdapterView的引用 <T> 应该参数化 - AdapterView is a raw type. References to generic type AdapterView<T> should be parameterized
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM