I was trying to use an inner class of the super type, which was using generics. And got that strange error above.
class MySuperClass<B> {
class InnerClass {
}
MySuperClass(InnerClass... c) {
}
}
In the sub class I tried to instantiate it:
class MySubClass extends MySuperClass<String> {
MySubClass() {
super(new InnerClass(), new InnerClass());
}
}
The compiler confused me with
No enclosing instance of type MySuperClass<B> is available due to some intermediate constructor
Why?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With