-
Bug
-
Resolution: Won't Do
-
None
-
Lithium
-
None
-
Operating System: All
Platform: All
-
3975
The current API for createInstance is as follows,
java.lang.AutoCloseable createInstance();
The problem with this is that when a module provides services a developer may not return an appropriate implementation of the services it provides. The error can then only be detected at runtime.
One suggestion from rovarga is to change the API as follows,
<T extends InterfaceA & InterfaceB & AutoClosable> T createInstance();
which forces the developer to return an appropriate implementation.
This also clarifies how exactly a module is supposed to provide multiple services.