Skip to content

Optimize MapperGenerator class so that there will be no method code length limit #393

@Rayti

Description

@Rayti

Hello! Recently I encountered a problem with defining mapping for large legacy classes with many nested fields.

Class MapperGenerator in method
private Set<FieldMap> addMapMethod(SourceCodeContext code, boolean aToB, ClassMap<?, ?> classMap, StringBuilder logDetails) combines all class map field mappings into one method. So when there are many field mappings and fields have long names there might occur an "Method code too large exception" during initializing generated mapping classes at runtime. The standard limit in JDK for method length is 64k.

I looked up one of the generated mapping class in my code and it's method has almost 7k lines :).
Is there any workaround for this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions