使用参数化类的原始方式,使用类名

huangapple go评论57阅读模式
英文:

Raw use of parameterized class using class for name

问题

我有这行代码

Class c1 = Class.forName(BASE_PACKAGE_NAME + "." + appId + ".v" + version.replace(",", "") + NAME);

但我有编译警告:

原始使用带参数的类
英文:

I have this line of code

   Class c1 = Class.forName(BASE_PACKAGE_NAME + "." + appId + ".v" + version.replace(",", "") + NAME);

but I have the compilation Warning:

Raw use of parameterized class

答案1

得分: 1

你需要指定泛型类型。你可以使用:

Class<?> c1 = Class.forName(...

来消除警告。

英文:

You need to specify the generic type. You can use:

Class&lt;?&gt; c1 = Class.forName(...

to silence the warning.

huangapple
  • 本文由 发表于 2020年8月4日 05:38:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/63237304.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定