2

Unable to make field private static final java.lang.reflect.Method jdk.proxy9.$Proxy196.m0 accessible: module jdk.proxy9 does not "opens jdk.proxy9" to unnamed module @18ad9d68

I tried to upgrade my project from JDK11 to JDK17, but it had this problem, I tried to add:

--add-exports
java.base/sun.util.calendar=ALL-UNNAMED
--add-opens
java.base/sun.util.calendar=ALL-UNNAMED
--add-exports
java.base/java.util=ALL-UNNAMED
--add-opens
java.base/java.util=ALL-UNNAMED
--add-opens
java.base/java.lang=ALL-UNNAMED

But none of them worked, prompting the message“ module jdk.proxy9 does not "opens jdk.proxy9" to unnamed module”,I referred to the question I can't find a solution

Tablo_Jhin
  • 301
  • 1
  • 3
  • 10
  • 2
    Why do you want to make the field of a proxy accessible? – Holger Jun 23 '22 at 07:13
  • I have to use someone else's library, that's all – Tablo_Jhin Jun 24 '22 at 02:18
  • 1
    So your actual problem is “*I’m trying to use* ‘someone else's library’ *with JDK 17 but it’s not compatible*” but instead of asking about “someone else's library” [you’re asking about problems with jdk.proxy9.$Proxy196.m0](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem/66378#66378). The first step would be to ask the author of “someone else's library” about a JDK 17 compatible version. If that fails, you may ask a question here about the library, but it would be helpful to name the library and if it’s rather uncommon, describe its purpose. – Holger Jun 24 '22 at 07:36
  • Yes, you're right, but I can't get a JDK17-compatible library, it's an internal library, and it's old enough,So I want to know if there are any other ways, such as the JVM configuration to make it run normally – Tablo_Jhin Jun 27 '22 at 12:10
  • 1
    If it’s “an internal library” of *X*, then the maintainer of *X* are responsible. If it can’t be fixed, it has to be replaced. Mindlessly adding `--add-opens` directives won’t solve the fundamental problem of this code. – Holger Jun 27 '22 at 14:09

0 Answers0