Skip to content

The generalized call does not support the serialization and deserialization of LocalTime, LocalDate & LocalDateTime #10631

Closed

Description

@wuwen5
  • I have searched the issues of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.x,3.x
  • Operating System version: mac os
  • Java version: 1.8

Steps to reproduce this issue

@Bean
public GenericService testApi() {
    ReferenceConfig<GenericService> config = new ReferenceConfig<>();
    config.setInterface("com.xxx.TestApi");
    config.setGeneric("true");
    //...
    return config.get()
}


@Autowired
private TestApi testApi;

@Test
void testLocaDateTime() {
    Person obj = testApi.testApiQueryMethod();
}

image

Unit testing for reproducible problems

    @Test
    public void testJava8Time() {
        
        Object localDateTimeGen = PojoUtils.generalize(LocalDateTime.now());
        Object localDateTime = PojoUtils.realize(localDateTimeGen, LocalDateTime.class);
        assertEquals(localDateTimeGen, localDateTime.toString());

        Object localDateGen = PojoUtils.generalize(LocalDate.now());
        Object localDate = PojoUtils.realize(localDateGen, LocalDate.class);
        assertEquals(localDateGen, localDate.toString());

        Object localTimeGen = PojoUtils.generalize(LocalTime.now());
        Object localTime = PojoUtils.realize(localTimeGen, LocalTime.class);
        assertEquals(localTimeGen, localTime.toString());
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugBugs to being fixed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions