Why does compilation of public APIs leaking internal types not fail?
问题 I have the follwing Java 9 module: module com.example.a { exports com.example.a; } With an exported type: public class Api { public static void foo(ImplDetail args) {} } And a non-exported type: package com.example.b.internal; public class ImplDetail {} The exported type uses the non-exported type as a method parameter type in a public method. I'd have assumed that the compiler would reject such an inconsistent class configuration, as clients in other modules could not really invoke the foo()