Running java testing application running on Java 10. Warning 'Illegal reflective access' is thrown.
Since Jdk 9, illegal reflective access is allowed but warning is thrown. Illegal reflective access will not be permitted in future release. See:
http://mail.openjdk.java.net/pipermail/jigsaw-dev/2017-May/012673.html
Jdk 8 allows reflective access but jdk 8 end of life date is Jan 2019.
Java 9 EOL is March 2018 and supported Java is now Java 10 up to Sep 2018.
(See http://www.oracle.com/technetwork/java/eol-135779.html)
There is no information when this Illegal reflective access is completely removed from jdk. But when it is removed htmlunit will stop working.
The stack trace:
WARNING: Illegal reflective access by net.sourceforge.htmlunit.corejs.javascript.NativeArray (file:/lib/htmlunit-core-js-2.28.jar) to field java.util.Arrays$LegacyMergeSort.userRequested
at net.sourceforge.htmlunit.corejs.javascript.NativeArray.<clinit>(NativeArray.java:39)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.initSafeStandardObjects(ScriptRuntime.java:186)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.initStandardObjects(ScriptRuntime.java:284)
at net.sourceforge.htmlunit.corejs.javascript.Context.initStandardObjects(Context.java:1241)
at net.sourceforge.htmlunit.corejs.javascript.Context.initStandardObjects(Context.java:1177)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.init(JavaScriptEngine.java:210)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.access$000(JavaScriptEngine.java:105)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$1.run(JavaScriptEngine.java:174)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:599)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:527)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.initialize(JavaScriptEngine.java:185)
at com.gargoylesoftware.htmlunit.WebClient.initialize(WebClient.java:1073)
at com.gargoylesoftware.htmlunit.WebWindowImpl.setEnclosedPage(WebWindowImpl.java:146)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:217)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:195)</clinit>
Just hit the same problem while trying to add HTML5 support to Doxia.
Turns out this behaviour was introduced in htmlunit v2.13.
This bug is a showstopper for any large project, if Doxia was to depend on htmlunit 2.13 or greater, nobody would be able to generate a maven site, and therefore use maven on future JDKs.
I'm currently in the middle of updating core-js to be in sync with the lastest rhino. There are a lot of changes in Rhino regarding the sorting; maybe this is already fixed. Will have a look at this soon.
We are now using the latest Rhino code. If you still have problems with this please open a rhino issue on github.