On 13/03/2018 09:23, Bernard Amade wrote:
now if in module B you just create a Service by inheriting from this class:
  - the className is correct (an instance of the class has been created for the 
- you can't invoke newInstance from that very class!(if the class is not opened 
or exported)
Constructor::newInstance has always been caller sensitive. If I read the example correctly, you've got code in class A trying to create an instance of class B. B is not accessible to A, it doesn't matter that B extends A. The issue you are running into isn't new with modules - you'll see the same IllegalAccessException with the class path for the case that B is not public (and in a different package to A).

- you can't get the Resource (or other files) unless they are explicilty opened.
if you copy this code in the class implementing the service everything just 
works fine
so there is a difference between the same code being explicitly in the class or 
The Class.getResourceXXX methods are also caller sensitive so the example is code in class A trying to locate a resource in its own module. If you maintain both A and B then it would be simpler if B were to call the method in the super class with a connection or URL to the resource.


Reply via email to