It's been years since I've done some proper Java so I'm rusted...
I'm trying to subclass using gen-class . The Parent has only private CTORs and exposes a public static create method. Using the subclassed Child, I can indeed do (Child/create ...). However, no matter what I do, I always get a Parent back, whereas I obviously want a Child.
Any pointers? 🤔 🙏
https://stackoverflow.com/a/3952820/1184752 to make a subclass of a class with only private constructors?
Ah, fair point. Do you know what would happen if the CTORs where public/protected?
Since the return type of create , which delegates to the CTORs, is Parent
Yes so I hit a bottleneck I believe. It seems you can subclass but the static method is (I believe) attached to the Parent .
You cannot subclass something with only private constructors 🤷
since you need to call super()
and super needs to match to a constructor you have access to