-
Improvement
-
Resolution: Duplicate
-
Medium
-
None
-
None
-
None
We currently purely inherit this class, which is suboptimal when dealing with generics, most notably this case does not work:
interface Foo extends DataObject; public <T extends Foo> void doSomething(T foo) { Class<? extends T> fooSubclass = foo.getImplementedInterface(); }
While all implementations are already returning the right answer (and if they don't Binding just breaks down), it is not expressed in the interface contract.
This this by generating a default interface method:
interface Foo extends DataObject { @Override default Class<? extends Foo> getImplementedInterface() { return Foo.class; } }
This already exists in Builder's implementation generator, albeit in the form:
@Override public Class<Foo> getImplementedInterface() { return Foo.class; }
- duplicates
-
MDSAL-396 Add DataObject.implementedInterface()
- Resolved