clojure-java-9 icon indicating copy to clipboard operation
clojure-java-9 copied to clipboard

Reflection fails on non-exported classes

Open tobias opened this issue 9 years ago • 3 comments

See http://dev.clojure.org/jira/browse/CLJ-2066

tobias avatar Nov 22 '16 16:11 tobias

This currently affects data.xml (http://dev.clojure.org/jira/browse/DXML-32), but will affect general usage as well.

tobias avatar Nov 22 '16 16:11 tobias

One thing to keep in mind is that javax.xml.stream.XMLInputFactory::newInstance always had the potential to return an instance of a type that is not accessible. It could have returned an instance of a package private class for example. Using getClass() and assume it is public has always been a bit of an anti-pattern in core reflection. Here's one way that you can walk to hierarchy to find the member that is accessible:

http://mail.openjdk.java.net/pipermail/jigsaw-dev/2016-September/009357.html

AlanBateman avatar Apr 13 '17 16:04 AlanBateman

Unfortunately, that solution depends on java.lang.Module, which doesn't exist < java 9.

tobias avatar Apr 25 '17 18:04 tobias