Java generics type parameter hiding

后端 未结 2 1214
北海茫月
北海茫月 2021-01-06 02:21

I\'m defining a class:

class Foo> {
}

the compiler is complaining about I being

2条回答
  •  梦毁少年i
    2021-01-06 02:42

    If I is already defined in the outer class just make this

    public class Outer> {
      public class Foo {
      } 
    }
    

    You cannot redefine I in your inner class. The I of the inner class would be something else than the I of the outer class, if this is what you want, well, rename it.

    HTH

提交回复
热议问题