paulk-asert opened a new pull request, #2566:
URL: https://github.com/apache/groovy/pull/2566
Under newer JDKs, ObjectUtil.cloneObject fails for EnumSet because the
MethodHandles.Lookup, teleported into the concrete RegularEnumSet (a
package-private subclass in java.base), lacks the access needed to unreflect
the inherited public clone() method. The IllegalAccessException is swallowed by
DefaultGroovyMethodsSupport.cloneObject's catch-all and cloneSimilarCollection
falls back to LinkedHashSet, so
EnumSet.of(A, B, C) + D
now returns a LinkedHashSet instead of an EnumSet. Subsequent assignment to
an EnumSet-typed variable or field then fails with a GroovyCastException.
Fall back to plain reflective Method.invoke when the MethodHandle Lookup
cannot access clazz. The clone method itself is public, so reflective
invocation succeeds without needing --add-opens.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]