RFR: JDK-8259395 Patching automatic module with additional packages re-creates module without "requires java.base"
Johannes Kuhn
github.com+652983+dasbrain at openjdk.java.net
Sun Jan 10 15:29:00 UTC 2021
On Sun, 10 Jan 2021 15:14:31 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Simple fix - one line change: https://openjdk.github.io/cr/?repo=jdk&pr=2000&range=00#sdiff-0.
>>
>> Most of the changes come from an additional test that fails without this fix:
>>
>> Error: Unable to load main class somelib.test.TestMain in module somelib
>> java.lang.IllegalAccessError: superclass access check failed: class somelib.test.TestMain (in module somelib) cannot access class java.lang.Object (in module java.base) because module java.base does not export java.lang to module somelib
>>
>> As described in JDK-8259395.
>> You can view the output of the test without patch here: https://github.com/DasBrain/jdk/runs/1668078245
>>
>> Thanks to @AlanBateman for pointing out the right fix.
>
> test/jdk/jdk/modules/scenarios/automaticmodules/RunWithAutomaticModules.java line 186:
>
>> 184: }
>> 185:
>> 186: /**
>
> The update to ModulePatcher is fine, that was an oversight that was missed because it's a real corner to have an automatic module be the initial module and patch it to add additional packages at the same time.
>
> The tests for --patch-module are in jdk/tools/launcher/modules/patch. I was planning to add tests there for patching automatic modules when I created the issue (I didn't know you were going to create a PR for it).
Choosing the right place for the test was one of the harder parts.
I did choose automaticmodules because it already has most of the necessary machinery already in place.
But I will move the tests to jdk/tools/launcher/modules/patch.
And making a PR was a shortcut reaction - "Hey, I could do this".
-------------
PR: https://git.openjdk.java.net/jdk/pull/2000
More information about the core-libs-dev
mailing list