java - Eclipse 中的 "Type parameter hides another type"警告示例

标签 java eclipse

如何触发 Eclipse 向我发出“类型参数隐藏另一种类型”警告?我正在寻找代码示例。

文档描述如下:启用后,如果内部类的类型参数隐藏外部类型,编译器将发出错误或警告。

最佳答案

class Test<A> {
  class Inner<A> {
    // here A denotes the generic parameter of Test.Inner
    // the type A of Test is hidden
  }
  <A> void test() {
    // here it is not a class but the type parameter A of Test is also hidden
    // if I remember well, the warning shows these too
  }
}

关于java - Eclipse 中的 "Type parameter hides another type"警告示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5173555/

相关文章:

java - Java Web 应用程序中的电子邮件,更好的方法吗?

Java EE Servlet eclipse tomcat HTTP Error 500 Servlet执行抛出异常

java - 包更改后在tomcat中发布失败

隐藏公共(public)访问器的 Java 私有(private)方法

java - HttpClient 4.2.2 和带用户名/密码的代理

java - 同时部署到多个 AVD

java - 如何使用android解密php加密的字符串?

java - 等价于M2E的Maven-> Gradle更新项目?

eclipse - 如何在多台计算机上使用相同的插件和设置自动安装 Eclipse?

java - 在我的 Eclipse 项目中添加亚马逊产品广告 API 文件作为依赖项