【发布时间】:2011-03-02 21:13:21
【问题描述】:
如何触发 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
}
}
【讨论】:
class Outer<T> {
class Inner<T> {}
}
【讨论】:
public class Outer<T>
{
class Inner<T>
{
}
}
【讨论】: