-
Notifications
You must be signed in to change notification settings - Fork 112
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
Java 16 Support #105
Comments
There seem also to be issues with statics and nullable transients due to cloning/src/main/java/com/rits/cloning/Cloner.java Lines 580 to 592 in 6cea78f
I wonder if this code needs to |
@chadlwilson Looks good to me. @kostaskougios What do you think? |
@chadlwilson , @tweimer Is it just a class like |
Yeah, that should do it. In the specific case I came across in the wild it was a class extending ArrayList (without a custom fastcloner) and dying on the static final serialversionUID. I can create a proper reprod later, however it was more curious to me as (without knowing all the details of how this works) I thought it ignored statics so it was a bit confusing that it was failing on a static field. Of course whether libraries like this have a chance on Java 16 without allowing illegal access or |
@chadlwilson I've created a test case but it passes:
Any ideas on how to make it fail? |
@kostaskougios Ahh, okay - that won't fail because the static is defined within a class belonging to something not defined as a module per se; and likely "open" to the calling code. However, if you debug the code, you will see it is still (potentially unnecessarily) calling So I guess the challenge here is when the static is defined by a JDK class in a JDK module (since these are now closed by default), or to other types where the library defines module boundaries to be enforced by the JVM. So the simplest reprod, similar to the original case I found, would be public static class StaticTransient extends ArrayList<String> { }
@Test
public void testStaticTransient() {
new Cloner().deepClone(new StaticTransient());
} ...yielding
Alternatively, define |
@chadlwilson ok, this code fails of
can't you define |
@kostaskougios We use that flag, but this still causes a warning. Can't you move the {{setAccessible}} flag inside that if statement? |
Ok after a few attempts with @tweimer , it seems the setAccessible is required. |
Thanks @kostaskougios - that should at least keep the focus for users on the pieces/internals they shouldn't be relying upon access to for deep cloning, so they can register their own fastcloner. |
Hi @tweimer and @kostaskougios - could we please get a new Looks like the diff would be this. In Java 17 it is necessary to specifically open each module required for such reflective access with This fix to avoid touching statics would help reduce the "noise" from use of the cloner so users can focus on only opening the necessary packages for the non-static fields requiring cloning, or potentially adding their own fast cloners which don't require the reflective access. If there is any help required to cut a release, I can possibly pitch in. |
Sorry @chadlwilson , I tried a week ago to deploy but there was a problem with my gpg, I created one and pushed it to a gpg registry but it didn't fix the issue. Effectively I am locked out of maven central. There must be a way to gain access again but nowdays I don't have time to maintain the lib anymore or work on this. |
Thanks for the reply @kostaskougios . Appreciate the effort - and sorry to hear that. I understand if you don't have the time/energy, however there is some stuff at https://central.sonatype.org/publish/requirements/gpg/#dealing-with-expired-keys which might be helpful if you hadn't seen it, and want to have another go at it. My random guess is potentially an issue with primary key vs subkey signing (seems they only support primary key signing) or assuming you can still authenticate with Maven Central, perhaps the new key not being adequately linked to your account somehow. If not possible to unblock this, I wonder if @tweimer is interested in taking over or forking somehow. 🤔 |
I don't have any plans to take this project over. |
Looks like an update is available under a different name #117 (comment) |
A call to the constructor throws an exception with java 16.
I think the reason is the JEP 396
A Workarround is to use the launcher option
--illegal-access=permit
The text was updated successfully, but these errors were encountered: