You can only return a subclass of the parent return type.
Compilation allows you to automatically open and unpack between primitives and wrappers, but this does not make one of the subclasses of the other. Primitives are not classes and cannot be used as you suggest.
I would just get getStatus () return Boolean or return the parent Boolean
In theory, auto-boxing can be expanded to allow what you offer, but I donβt think it is of much use.
In theory, you can also write this
class A { int method() { ... } } class B extends A { short method() { .... } }
How the compiler supports implicit boost. However, again, I suspect that this is also of little use.
source share