No enclosing instance of type MySuperClass is available due to some intermediate constructor

前端 未结 1 1616
Happy的楠姐
Happy的楠姐 2021-02-13 10:04

I was trying to use an inner class of the super type, which was using generics. And got that strange error above.

class MySuperClass {
   class InnerCla         


        
1条回答
  •  有刺的猬
    2021-02-13 10:40

    Heh, and found the answer myself:

    The InnerClass is not static thus an instance of MySuperClass must be passed for the this$ reference - but that's not available before the super() call... simply making InnerClass static solved my problem.

    0 讨论(0)
提交回复
热议问题