如何触发 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/