java 缺少泛型类 Class<T> 的类型参数,其中 T 是类型变量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15821407/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 20:58:31 来源:igfitidea点击:
Missing type arguments for generic class Class<T> where T is a type-variable
提问by kamaci
I use Oracle JDK 7 and when I build project I get that message:
我使用 Oracle JDK 7,当我构建项目时,我收到以下消息:
missing type arguments for generic class Class<T> where T is a type-variable:
T extends Object declared in class Class
Here is the class:
这是课程:
public class Among {
private static final Class<?>[] EMPTY_PARAMS = new Class[0]; //warning line
Any ideas how to solve it. It is used at many places and I have many warnings.
任何想法如何解决它。它在很多地方使用,我有很多警告。
回答by pholser
private static final Class<?>[] EMPTY_PARAMS = new Class<?>[0];
Note the <?>
at the instantiation of the array.
注意<?>
数组的实例化。