How to solve InaccessibleObjectException ("Unable to make {member} accessible:
module {A} does not 'opens {package}' to {B}") on Java 9?
touches on the issue:Using --add-opens should be considered a workaround.The
right thing is for libraries performing illegal access to fix their issues.
https://www.reddit.com/r/java/comments/p9ymhb/what_exactly_is_the_reason_for_denying_reflection
reflection removes encapsulation: makes every element in a code unit part of
its APIStrong encapsulation aids in maintainability and security.
https://blogs.oracle.com/javamagazine/post/a-peek-into-java-17-continuing-the-drive-to-encapsulate-the-java-runtime-internals
The result is a user class that is tightly coupled to the internal
implementation of the JDK.If enough developers abuse this openness, this leads
to a situation in which it is difficult or impossible to make changes to the
internals, because to do so would break deployed libraries and
applications.This is one of the problems that modules were invented to solve.
I have found:
On app engine there's no need for --add-opens java.base/java.lang=ALL-UNNAMED,
only on local jetty.This java fix for LinkedHashMap reflection failure is
probably more worrying:...Field field =
LinkedHashMap_CustomFieldSerializer.class.getDeclaredField("reflectionHasFailed");field.setAccessible(true);...
On Saturday 22 June 2024 at 02:53:52 BST, Craig Mitchell
<[email protected]> wrote:
This is because, from Java 9, access to the Java classes has been restricted.
More info:
https://stackoverflow.com/questions/41265266/how-to-solve-inaccessibleobjectexception-unable-to-make-member-accessible-m
In the case of GWT, if you want exceptions passed back via RPC, GWT needs
access to the java.lang classes to serialise them to contain all the Java class
details.
So, you need to add: --add-opens java.base/java.lang=ALL-UNNAMED when running.
I didn't know it was not recommended. Why is it bad to do?
On Saturday 22 June 2024 at 3:34:59 am UTC+10 Tim Macpherson wrote:
It happens with the latest tbroyer archetype, just change the server method so
it always throws
Yahoo Mail: Search, Organize, Conquer
On Fri, Jun 21, 2024 at 4:20 PM, Colin Alworth<[email protected]> wrote:
Can you share a little more detail, like the full error message with stack
trace, and the GWT version you're using? Some improvements were made in this
area for GWT 2.11, and some messages of this kind are merely warnings,
indicating that reflection was attempted and some fallback can usually be used
instead.
On Friday, June 21, 2024 at 8:45:59 AM UTC-5 [email protected] wrote:
SInce upgrading to Java 11, throwing a new IllegalArgumentException in an RPC
server-side implementation gives InaccessibleObjectException. It can be
stopped by using a VM argument --add-opens, but apparently this is not
recommended.
Can anyone clarify ?
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-web-toolkit/6c4d8967-066c-4f36-a95f-9bf8df2e2589n%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-web-toolkit/0a0af252-eb15-4c39-9ecb-dc8b1cb09da3n%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-web-toolkit/1828436132.14532993.1719050787610%40mail.yahoo.com.