ALL-UNNAMED module does not export all packages from classpath

Alex Buckley alex.buckley at oracle.com
Mon Mar 20 21:56:58 UTC 2017


I can't figure out which classes are on which path, and why you think 
ALL-UNNAMED should export FROM the classpath when its purpose is to 
export TO the classpath.

Please clarify your configuration in a few short sentences, rather than 
asking us to open a zip file on an unknown host.

Alex

On 3/20/2017 2:44 PM, Pavel Bucek wrote:
> // moving from jdk9-dev, as suggested.
>
> Hi Jon,
>
> Thanks for clarification of the error message.
>
> The main point here is that adding "import ... " fixes the issue, which
> doesn't feel correct.
>
> When dependencies are put on the classpath, the import statement is not
> required.
>
> Regards,
> Pavel
>
> On 20/03/2017 22:26, Jonathan Gibbons wrote:
>> If nothing else, the javac error message needs work.
>>
>>> (package org.mockito.stubbing is declared in module , which does not
>>> export it)
>>
>> The space between "module" and "," means there's an "empty" module
>> name there, for the unnamed module, which should have been stated
>> explicitly (i.e. "declared in the unnamed module").
>>
>> Follow-ups would be better on jigsaw-dev or compiler-dev.
>>
>> -- Jon
>>
>>
>>
>> On 03/20/2017 02:15 PM, Libor Kramolis wrote:
>>> Hello.
>>>
>>> I have problem to compile following unit test:
>>> import org.junit.Test;
>>> import static org.junit.Assert.assertEquals;
>>> import static org.mockito.ArgumentMatchers.any;
>>> import static org.mockito.Mockito.mock;
>>> import static org.mockito.Mockito.when;
>>>
>>> public class TestCase {
>>>
>>>      @Test
>>>      public void test() {
>>>          Context context = mock(Context.class);
>>>          when(context.test(any())) //returns
>>> org.mockito.stubbing.OngoingStubbing
>>>                  .thenReturn("mock");
>>>
>>>          assertEquals("mock", context.test("any"));
>>>      }
>>>
>>>      interface Context {
>>>          String test(String value);
>>>      }
>>>
>>> }
>>> with following error:
>>>
>>> src/test/java/tst/TestCase.java:15: error:
>>> OngoingStubbing.thenReturn(T,T...) in package org.mockito.stubbing is
>>> not accessible
>>>                  .thenReturn("mock");
>>>                  ^
>>>    (package org.mockito.stubbing is declared in module , which does
>>> not export it)
>>>    where T is a type-variable:
>>>      T extends Object declared in interface OngoingStubbing
>>> 1 error
>>>
>>> Interface org.mockito.stubbing.OngoingStubbing is returned by when(…)
>>> method. And whenever I explicitly import the interface (no other
>>> change in code is necessary) compilation works.
>>>
>>> Full reproduced sources are available in zip file at
>>> http://anise.cz/~paja/liba/reproducer.zip
>>> <http://anise.cz/~paja/liba/reproducer.zip>. It contains javac
>>> commands. It is also possible to build it by Maven.
>>>
>>> What do you think about this behaviour? It seems to me as a bug. The
>>> import statement is very artificial in this case.
>>>
>>> Thanks in advance for your help.
>>>
>>> Best regards,
>>> Libor
>>
>


More information about the jigsaw-dev mailing list