chaokunyang commented on issue #2193:
URL: https://github.com/apache/fury/issues/2193#issuecomment-2841062756
Hi @Nikhil-n17 , the fury you are using is too old, could you try latest
fury? And for your case, in latest fury, we do support such usage:
```
@Test
public void testInconsistentRegistrationName() throws Exception {
ClassLoader classLoader =
JaninoUtils.compile(Thread.currentThread().getContextClassLoader(),
aunit, bunit, cunit);
byte[] serialized;
{
Class<?> A = classLoader.loadClass("demo.pkg1.A");
Class<?> B = classLoader.loadClass("demo.test.B");
Class<?> C = classLoader.loadClass("demo.report.C");
Fury fury =
builder()
.withCompatibleMode(CompatibleMode.COMPATIBLE)
.withClassLoader(classLoader)
.build();
fury.register(A, "test.A");
fury.register(B, "test.B");
fury.register(C, "test.C");
Object a = A.getMethod("create").invoke(null);
System.out.println(a);
serialized = fury.serialize(a);
}
{
classLoader =
JaninoUtils.compile(Thread.currentThread().getContextClassLoader(), newAUnit,
newCUnit);
Class<?> A = classLoader.loadClass("example.pkg1.A");
Class<?> C = classLoader.loadClass("example.test.C");
Fury fury =
builder()
.withCompatibleMode(CompatibleMode.COMPATIBLE)
.withClassLoader(classLoader)
.build();
fury.register(A, "test.A");
fury.register(C, "test.C");
Object newObj = fury.deserialize(serialized);
System.out.println(newObj);
Object f3 = getObjectFieldValue(newObj, "f3");
Assert.assertNotNull(f3);
Assert.assertEquals(f3.toString(), "C{f2=1000}");
}
}
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]