kostaskougios / cloning

deep clone java objects
Other
591 stars 112 forks source link

Illegal reflective access by com.rits.cloning.Cloner$CloneObjectCloner for Timestamp.nanos #113

Open johanhaleby opened 2 years ago

johanhaleby commented 2 years ago

Hi!

I run into this problem when running our application:

[ERROR] WARNING: An illegal reflective access operation has occurred
[ERROR] WARNING: Illegal reflective access by com.rits.cloning.Cloner$CloneObjectCloner (file:/root/.m2/repository/io/github/kostaskougios/cloning/1.10.3/cloning-1.10.3.jar) to field java.sql.Timestamp.nanos
[ERROR] WARNING: Please consider reporting this to the maintainers of com.rits.cloning.Cloner$CloneObjectCloner
[ERROR] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
[ERROR] WARNING: All illegal access operations will be denied in a future release

I'm using Java 17. Is there anything I can/should do from my side?

Regards /Johan

chadlwilson commented 2 years ago

Might want to look at https://github.com/kostaskougios/cloning/issues/105

For this type of thing you probably need to implement and register a fast cloner for java.sql.Timestamp which does not rely on reflection (to internals of the object)

There's an example at https://github.com/gocd/gocd/blob/5638a49a35e5a96836f8870deae69a8e9c8f1093/util/src/main/java/com/thoughtworks/go/util/ClonerFactory.java#L42-L68 if you're interested (and test)