Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Illegal Reflection" warning for Clojure 1.10 & Java 11 #152

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

cloojure
Copy link

@cloojure cloojure commented Mar 2, 2019

Upgrading from Clojure 1.9 to 1.10, I am getting a new warning:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by clojure.lang.InjectedInvoker/0x0000000800231c40 (file:/home/alan/.m2/repository/org/clojure/clojure/1.10.0/clojure-1.10.0.jar) to method com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(org.xml.sax.InputSource,org.xml.sax.HandlerBase)
WARNING: Please consider reporting this to the maintainers of clojure.lang.InjectedInvoker/0x0000000800231c40
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Using Java 11 on Ubuntu 16.04.

This can be fixed by type hints on the net.cgrand.xml/startparse-sax method. I also upgraded the project.clj to current versions of lein and jsoup. Tests are clean:

~/gh/enlive > lein clean ; lein test

lein test net.cgrand.enlive-html.test

lein test tst.net.cgrand.xml

Ran 31 tests containing 105 assertions.
0 failures, 0 errors.

~/gh/enlive > java --version ; lein --version
java 11 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11+28)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11+28, mixed mode)

Leiningen 2.9.0 on Java 11 Java HotSpot(TM) 64-Bit Server VM

@pbwolf
Copy link

pbwolf commented Mar 2, 2019

Uh oh, does the 1st argument have to be nailed down? The docstring (of a function that calls this one in the same file) says s may be "a File, InputStream or String naming a URI". That docstring matches clojure.xml/parse, and both of those functions actually also accept InputSource (which was suggested to be documented in Clojure here (https://dev.clojure.org/jira/browse/CLJ-1290)), which in turn accepts a Reader, which is the most direct way to parse XML content of a string... a StringReader in an InputSource. In short, the new constraint to just accept nothing but InputStream should be documented or, better yet, an alternative found without such a constraint.

@gloorfindel
Copy link

This error was resolved by updating from clojure version from 1.10 to 1.10.1 for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants