MagicAccessorImpl

Alan Bateman Alan.Bateman at oracle.com
Tue Jun 13 16:02:33 UTC 2017


On 13/06/2017 15:53, Henri Tremblay wrote:
> Hi,
>
> I am back as promised.
>
> Another instantiator is using ObjectStreamClass.newInstance through 
> reflection (setAccessible). I get, of course, a warning about it.
>
> I can fix it with --add-opens java.base/java.io 
> <http://java.io>=ALL-UNNAMED
>
> Can I do something that doesn't involve jvm arguments?
>
ObjectStreamClass.newInstance is package private and never meant to be 
used from outside of the java.io package. So the warning is correct and 
can only be suppressed by using `--add-open` to explicitly open the 
package. The warning or the use of `--add-opens` serves as remainder 
that this code is hacking into the JDK and that the hack break at some 
point.

-Alan.


More information about the jdk9-dev mailing list