I would like to use ResponseSubscribers.ByteArraySubscriber that is in jdk.internal.net.http I use openjdk11
I tried 2 things :
1/ I added to maven compiler plugin exports module
--add-exportsjava.net.http/jdk.internal.net.http=fr.app
-> it compile !
2/ I created module-info.java
module fr.app {
requires java.net.http;
requires com.fasterxml.jackson.core;
requires com.fasterxml.jackson.databind;
requires com.fasterxml.jackson.datatype.jsr310;
exports fr.app;
exports fr.app.parser;
}
There is an error when running a junit test that use the class importing jdk.internal.net.http
fr.app.AppException: java.io.IOException: class fr.app.MyClass$BodySubscribers (in unnamed module @0x6537cf78) cannot access class jdk.internal.net.http.ResponseSubscribers$ByteArraySubscriber (in module java.net.http) because module java.net.http does not export jdk.internal.net.http to unnamed module @0x6537cf78
I understand BodySubscribers must be exported only in named module But my module is name fr.app right ?