On 11/07/16 12:02, Alan Bateman wrote: >> That option may well be the status quo as of JDK8 but with JDK9 it is >> the status quo in a changed world. Firstly, this so-called status quo >> significantly undermines the point and utility of Jigsaw since >> effectively it negates it's presence at runtime for large parts of the >> code base. So, you get compile-time checking but you don't get any >> runtime enforcement.
> It means that public types in these packages are accessible to other > components. Non-public types/members would not be accessible of course, > at least not without suppressing access checks (= setAccessible when > using core reflection). I think I need to ask you to clarify this as it doesn't seem to recognise the point I was making. Of course, that may well indicate that I have failed to understand the precise behaviour of exports dynamic. Let us assume Module M exports dynamic P, where P is a package which contains a public class C_pub and a non-public class C_pri (let's say it is package-protected). My understanding is that this means that: Java source files for classes not in module M which import these classes or reference them by name will suffer a compile-time error. References to the corresponding instances of class Class for C_pub or C_pri may nevertheless be obtained by methods of classes not in Module M at runtime (e.g. using a classloader lookup by name). References to members of these classes (methods or fields) may be obtained by methods of classes not in Module M (e.g. by using the public API of Class). Calls to setEnabled(true) on those members will succeed even when the calling method is not in class M (assuming the call is not invalidated by the usual (mon-module) security restrictions) The latter is so irrespective of whether we are referring to class C_pub or C_pri and irrespective of whether the member of C_pub or C_pri in question is public or non-public. I'd be grateful if you could confirm or contradict any of these points. regards, Andrew Dinn ----------- Senior Principal Software Engineer Red Hat UK Ltd Registered in England and Wales under Company Registration No. 03798903 Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander