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

Several illegal access warnings when using Java 9 #103

Closed
wvreeven opened this issue Nov 23, 2017 · 1 comment
Closed

Several illegal access warnings when using Java 9 #103

wvreeven opened this issue Nov 23, 2017 · 1 comment
Assignees

Comments

@wvreeven
Copy link

Several warnings are logged when XStream is used in Java 9. FYI I am using Java 9.0.1 that recently was released. So far I have seen these:

[junit] WARNING: An illegal reflective access operation has occurred
[junit] WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:lib/compile/xstream-1.4.9.jar) to field java.util.TreeMap.comparator
[junit] WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
[junit] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
[junit] WARNING: All illegal access operations will be denied in a future release

[junit] WARNING: An illegal reflective access operation has occurred
[junit] WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:lib/compile/xstream-1.4.9.jar) to field java.lang.reflect.Proxy.h
[junit] WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
[junit] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
[junit] WARNING: All illegal access operations will be denied in a future release

[junit] WARNING: An illegal reflective access operation has occurred
[junit] WARNING: Illegal reflective access by com.thoughtworks.xstream.converters.reflection.AbstractAttributedCharacterIteratorAttributeConverter (file:lib/compile/xstream-1.4.9.jar) to method java.text.AttributedCharacterIterator$Attribute.getName()
[junit] WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.converters.reflection.AbstractAttributedCharacterIteratorAttributeConverter
[junit] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
[junit] WARNING: All illegal access operations will be denied in a future release

[junit] WARNING: An illegal reflective access operation has occurred
[junit] WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:lib/compile/xstream-1.4.9.jar) to field java.awt.font.TextAttribute.instanceMap
[junit] WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
[junit] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
[junit] WARNING: All illegal access operations will be denied in a future release

The simple workaround for this is to add these command line options to the invocation of java:

--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED

However, this is not a proper solution of course. Please revise the code and fix the warnings. Many thanks!

@joehni joehni self-assigned this Dec 21, 2017
@joehni
Copy link
Member

joehni commented Dec 21, 2017

Duplicate of #101

@joehni joehni marked this as a duplicate of #101 Dec 21, 2017
@joehni joehni closed this as completed Dec 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants