Error message when accessing non-public type

Jan Lahoda jan.lahoda at oracle.com
Wed Jun 15 13:12:47 UTC 2016


Hi Gunnar,

I don't recall a significant change recently regarding the errors, javac 
(should) currently produce either the "cannot find" or "not visible" 
error depending on exact circumstances ("not visible" should be produced 
if javac have already seen the given class). We are currently looking at 
improving the error messages, providing an improved "not visible" error 
in a wider range of cases.

Jan

On 15.6.2016 12:24, Gunnar Morling wrote:
> Hi,
>
> When referring to a not-exported type from another module, I'm getting this
> rather generic compilation error:
>
>      package someprivate.pakkage does not exist
> import someprivate.pakkage.SomeType;
>                                                ^
>      error: cannot find symbol SomeType
>
> As if the type was not existing at all. As per this blog post [1], a more
> specific error used to be raised in previous EA builds:
>
>      error: SomeType is not visible because
>      package someprivate.pakkage is not visible
>
> I found that previous error more helpful, as it gives an indication of what
> to do in order to prevent it. Has this been changed intentionally? Or am I
> doing something wrong here?
>
> Thanks,
>
> --Gunnar
>
> [1]
> https://blog.codecentric.de/en/2015/11/first-steps-with-java9-jigsaw-part-1/
>


More information about the jigsaw-dev mailing list