-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
Serialization object construction doesn't work on JDK9 anymore #45
Comments
I noticed that indeed |
@henri-tremblay have you tested SunReflectionFactorySerializationInstantiator with JDK9? I was under the impression that calling setAccessible(true) fails on Java 9. See mp911de/lettuce@a3c36bc . |
I did. And it was working. You have a different experience? Do you have a test case? |
@mp911de I'm having trouble getting my hands on the latest EA actually.. |
@mp911de could I trouble you for a bit more information about the commit I referenced above? |
@johnou sure (mail, gitter, Twitter, …).
works for Java 9 (but not Java 8 and earlier). It's however possible this might change in future Java 9 versions because "the team is fixing loopholes until the Java 9 release" (statement from an Oracle PM I met recently). |
@mp911de that's perfect, just wanted to give @henri-tremblay a heads up. |
Shoot! The code from above works inside of unnamed modules but not if you create a real Java 9 module and import the library that's going to invoke a default method on an interface. I found an ugly hack via a derived class. It boils down back to where we started: there's no official way to deal with Methodhandles of encapsulated components. |
What do you mean by "encapsulated components"? And then it's getting annoying to test... I fell like I should just use the UnsafeInstantiator and it will be then end of it. |
I'm still new to the Java 9 terminology so sorry if I don't use the right terms, still learning. I mean by that a Java 9 module with a module descriptor. |
Thanks... I'm not that good with the terminology either. So can you please confirm the current state: Is that it? |
module com.my.module {
}
module com.my.module {
opens com.my.package to org.framework.module;
// or
//exports com.my.package to org.framework.module;
} I received, however, a response to private |
Oh dear Lord... First time I see "open". So, again, to make sure I get it. Let's say I have:
And then This will fail unless
Is that right? |
I can confirm that's what you need to do for plain old jars. I'm not sure whether that's still the case when each module comes with a module descriptor and declares its dependencies. I attached a screenshot that shows a Maven and a |
There was an incompatible change introduced in method
sun.reflect.ReflectionFactory.newConstructorForSerialization()
in recent JDK9 b142 build.
The text was updated successfully, but these errors were encountered: