On 3/24/2016 12:53 PM, fo...@univ-mlv.fr wrote:
Moreover, I don't think an issue like this should fail the compilation:
even if the example above would make it into a module: at worst a client
could treat the result as an accessible super-type & use it (analog, for
the case where an inaccessible type is used as a parameter, where a
client could try to pass in an accessible subclass instance).

If the client doesn't see the super-type, how can it knows that 'subclass' is a 
subclass of that super-type ?
Apart sending null, it don't think you can do better.

Suppose the parameter type is a package-private interface I, but there's a public class C in the same package that implements I. Since C's superinterfaces are not exactly secret, I can instantiate C from anywhere, and pass the instance to the method expecting I. All of which is to say, while C# may have long given errors for inaccessible types in signatures, Java hasn't.

Alex

Reply via email to