Skip to content

Simplify serialisation of NativeJavaObject and JavaMembers#2249

Open
aardvark179 wants to merge 6 commits intomozilla:masterfrom
aardvark179:aardvark179-java-member-refactor
Open

Simplify serialisation of NativeJavaObject and JavaMembers#2249
aardvark179 wants to merge 6 commits intomozilla:masterfrom
aardvark179:aardvark179-java-member-refactor

Conversation

@aardvark179
Copy link
Copy Markdown
Contributor

This fixes #2248. It turned out to be much simpler to fix than I had feared as almost everything was already serialisable.

@ZZZank
Copy link
Copy Markdown
Contributor

ZZZank commented Jan 9, 2026

A bit amazed by the fact that this PR didn't cause any additional error. I was expecting some NativeJavaField related errors since NativeJavaField is not serializable

@aardvark179
Copy link
Copy Markdown
Contributor Author

Good point. I'll make that one serialisable too, and add some more to the tests.

@ZZZank
Copy link
Copy Markdown
Contributor

ZZZank commented Jan 9, 2026

I think serializing each NativeJavaXXX object separately is a bad idea, especially considering the raw member objects (Method, Field, etc) are not serializable, we will have to record their information and recreate the raw member manually, causing a huge amount of ''declaring class'' in serialized data.

Actually I think nothing in JavaMembers should be serializable at all, other than the name of the class that this JavaMembers reflects

@aardvark179
Copy link
Copy Markdown
Contributor Author

aardvark179 commented Jan 9, 2026

We have to serialise those things, they can become reachable via multiple routes by assigning them to other variables.

I'd be happy to see a rewrite of JavaMembers that separates the raw members out and never serialises those, but then you'll have to make sure all the NativeJavaMethod/Constructor/etc stuff references things through that, and that none of those mutable JS objects are themselves stored inside JavaMembers

@aardvark179 aardvark179 force-pushed the aardvark179-java-member-refactor branch 2 times, most recently from 2d199e5 to 44c3cd2 Compare January 13, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential JavaMembers deserialisation problem.

2 participants