Skip to content

fix(java): define generated serializers as normal classes#3791

Draft
mandrean wants to merge 2 commits into
apache:mainfrom
mandrean:mandrean/fix-hidden-jit-field-access
Draft

fix(java): define generated serializers as normal classes#3791
mandrean wants to merge 2 commits into
apache:mainfrom
mandrean:mandrean/fix-hidden-jit-field-access

Conversation

@mandrean

@mandrean mandrean commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Define generated serializers as normal classes instead of hidden nestmates.

The first commit adds a failing regression test for async serializer JIT with an allow-all TypeChecker. The fix updates neighbor-based codegen to use the normal class definition path and adjusts the JDK 25 class-shape assertion.

Closes #3790

Validation

  • Java 25 focused JITContextTest
  • Java 25 focused CodecUtilsTest
  • Java 25 focused ObjectCodecBuilderTest
  • Java 17 focused JITContextTest
  • spotless:check
  • checkstyle:check

@mandrean mandrean requested a review from chaokunyang as a code owner June 25, 2026 11:49
@chaokunyang

Copy link
Copy Markdown
Collaborator

Could you check whether fory 1.3.0 still have this issue? I released 1.3.0 today

@chaokunyang

Copy link
Copy Markdown
Collaborator

And I think we should not define generated serializer as hidden class, define it as normal class is enough. I define it as hidden class to access private fields directly, but janino can't compile it. With #3778, field access on jdk25 is not a performance issue anymore.

@mandrean mandrean force-pushed the mandrean/fix-hidden-jit-field-access branch from c75c0b8 to 5c94ebc Compare June 25, 2026 13:05
@mandrean mandrean changed the title fix(java): avoid unsafe offsets for hidden serializer fields fix(java): define generated serializers as normal classes Jun 25, 2026
@mandrean mandrean force-pushed the mandrean/fix-hidden-jit-field-access branch from 5c94ebc to 6310e6c Compare June 25, 2026 13:47
@mandrean mandrean marked this pull request as draft June 25, 2026 13:58
@mandrean

mandrean commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Could you check whether fory 1.3.0 still have this issue? I released 1.3.0 today

1.3.0 actually fails to deserialize some of our 1.2.0 binary blobs altogether... Seems like there is a binary incompatible breaking change in 1.3.0? I'll see if I can come up with a minimal reproducible for that, and create a separate issue.

I moved back the PR to draft, I'll refine it a bit before turning it ready for review again

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.

Java hidden-class field access can fail during async serializer JIT callback

2 participants