garydgregory commented on PR #1883: URL: https://github.com/apache/commons-lang/pull/1883#issuecomment-6984386680
@AmarGhugare Thanks for working on this. The reported bug is real, and delegating to `clone()` fixes the isolated root-object and proxy cases. However, the current implementation introduces a compatibility regression and does not preserve class identity throughout the object graph. For example, an `ArrayList` containing application-loaded objects currently roundtrips successfully. With this change, if the thread context loader defines a same-named class, the deserialized elements can acquire that loader’s class identity, causing `ClassCastException` when accessed. The added `super.resolveClass()` fallback cannot help because the context-loader lookup succeeds, but returns the wrong class. There are also related gaps: - A proxy can retain its original class while its invocation handler is deserialized into a same-named class from another loader. - A plugin-only class can roundtrip directly but still fail when placed inside a bootstrap-loaded collection. The existing tests pass, but additional regression tests reproduce these cases against the PR. I think we need to preserve the original classes throughout the serialized graph before merging. Extending the existing proxy-class recording mechanism to ordinary class descriptors addresses these cases without relying on loader lookup order. I’ve implemented that locally and added coverage for mixed-loader graphs, nested plugin objects, and handler class identity. Addressed in commit c44f56692bd553aa87d23a3bb29c182f06e8459b. Closing; you are credited in `changes.xml`. -- 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]
