Comments (3)
I can't really tell, never tried it. The library uses reflection to find all field members of a class. Then it recursively deep clones them. How do you get a reference to a native object and where do you store it? Is that reference a specific java type?
from cloning.
This is an example of what I want to clone:
https://github.com/bytedeco/javacpp-presets/blob/master/opencv/src/main/java/org/bytedeco/javacpp/opencv_core.java
This object extends Pointer defined here:
https://github.com/bytedeco/javacpp/blob/master/src/main/java/org/bytedeco/javacpp/Pointer.java
This seems to keep fields with references to the memory addresses somewhere in the object. I suppose if you clone it this object will still be pointing to the same object so this won't work.
from cloning.
They seem to use longs to point to the mem address as you say. So cloner will just copy the long number and point to the same address. But you can impl IFastCloner for Pointer.class and register that with cloner and provide your own cloning impl for it - if you have a way to copy the memory those longs point to.
from cloning.
Related Issues (20)
- NoClassDefFoundError HOT 1
- Invalid clone result for List.of() and Set.of() objects on JDK15 HOT 2
- illegal reflective access HOT 1
- Java 16 Support HOT 16
- download url in wiki/downloads.md is 404 HOT 1
- About instantiation. HOT 3
- Avoid throwing and catching ClassNotFoundException for SubList and RandomAccessSubList
- Bump objenesis to 3.2
- Illegal reflective access by com.rits.cloning.Cloner$CloneObjectCloner for Timestamp.nanos HOT 1
- why use "I" of interface prefix HOT 3
- Java module
- Version 1.11 not available at Maven Repository? HOT 3
- java.util.Date cloning error HOT 2
- java.lang.IllegalArgumentException: Can not set final java.lang.String field org.apache.logging.log4j.Level.name to org.apache.logging.log4j.Level
- java.lang.NoClassDefFoundError:
- Objenesis dependency version maintenance in this repo HOT 1
- Stackoverflow when deepclone an object with recursive references.
- Java 17 support for complex deep cloning HOT 2
- Custom cloning HOT 3
- Latest Release Update? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloning.