fury icon indicating copy to clipboard operation
fury copied to clipboard

[Java] Support codegen for xlang serialization in java for compatible mode

Open chaokunyang opened this issue 6 months ago • 2 comments

Feature Request

Feature Request

Currently all xlang serialization don't support codegen:


  @Data
  public static class Foo {
    public Integer f1;
    public String f2;
    public List<String> f3;
    public Map<String, Integer> f4;
    public Bar f5;
  }

  @Data
  public static class Bar {
    public Integer f1;
    public String f2;
  }


  @Test
  public void testMetaSharedBasic() {
    Fory fory =
        Fory.builder()
            .withLanguage(Language.XLANG)
            .withCodegen(false)
            .withCompatibleMode(CompatibleMode.COMPATIBLE)
            .build();
    fory.register(Foo.class, "example.foo");
    fory.register(Bar.class, "example.bar");
    serDeCheck(fory, Bar.create());
    serDeCheck(fory, Foo.create());
  }

we should support it for better performance:

  @Test
  public void testMetaSharedBasic() {
    Fory fory =
        Fory.builder()
            .withLanguage(Language.XLANG)
            .withCodegen(true)
            .withCompatibleMode(CompatibleMode.COMPATIBLE)
            .build();
    fory.register(Foo.class, "example.foo");
    fory.register(Bar.class, "example.bar");
    serDeCheck(fory, Bar.create());
    serDeCheck(fory, Foo.create());
  }

Is your feature request related to a problem? Please describe

No response

Describe the solution you'd like

We need to change:

  • BaseObjectCodecBuilder.java
  • ObjectCodecBuilder.java
  • MetaSharedCodecBuilder.java

Describe alternatives you've considered

No response

Additional context

No response

Is your feature request related to a problem? Please describe

No response

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

chaokunyang avatar Jun 03 '25 07:06 chaokunyang

Please assign it to me.

OmCheeLin avatar Jun 09 '25 14:06 OmCheeLin

Assigned, but please note that this feature relies on the implementation of #2286. We may need to wait for some time before we can start tom implement this feature

chaokunyang avatar Jun 09 '25 16:06 chaokunyang