Skip to content

FQN of LocalDateTime is used when a simple name is possible #1576

Description

@filiphr

When using the JavaLocalDateToDateConversion we generate a code that looks like:

if ( as.getPromotionDate() != null ) {
    article.setPromotionDate( java.time.LocalDateTime.ofInstant( as.getPromotionDate().toInstant(), ZoneOffset.UTC ).toLocalDate() );
}

The code should look like:

if ( as.getPromotionDate() != null ) {
    article.setPromotionDate( LocalDateTime.ofInstant( as.getPromotionDate().toInstant(), ZoneOffset.UTC ).toLocalDate() );
}

The java.time.LocalDateTime is not necessary to be FQN, as it is the only LocalDateTime. The actual problem is that when Joda time is present than the Joda types are loaded in the Conversion which leads to them being part of the importedQualifiedTypesBySimpleName in our TypeFactory. Seems that we use the Type in the Conversion Key. However, looking into that code it seems that we can easily use the FQN of the types (without the need to load the Type).

I see 2 ways to solve this:

  • Add a flag to the TypeFactory to load a type without marking it as imported
  • Use String in the Conversion Key

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions