Skip to content

remove unused imports from generated code#26

Open
hduelme wants to merge 1 commit intomapstruct:mainfrom
hduelme:remove-unused-imports-from-generated-code
Open

remove unused imports from generated code#26
hduelme wants to merge 1 commit intomapstruct:mainfrom
hduelme:remove-unused-imports-from-generated-code

Conversation

@hduelme
Copy link
Contributor

@hduelme hduelme commented Mar 17, 2026

This PR removes unused imports and simplifies conditional imports in the template.
Changes

  • Removed the following unused imports:
    • java.util.ArrayList;
    • javax.lang.model.element.ElementKind
    • javax.lang.model.element.VariableElement
    • javax.lang.model.util.AbstractAnnotationValueVisitor8
  • he following imports are only required when gemValueInfos contains values. Instead of always including them, they are now conditionally added via an if statement in the FTL template:
    • java.util.HashMap
    • java.util.List
    • java.util.Map
    • javax.lang.model.element.AnnotationValue
    • javax.lang.model.element.ExecutableElement
    • javax.lang.model.type.TypeMirror
    • javax.lang.model.util.ElementFilter;
    • org.mapstruct.tools.gem.GemValue
  • javax.lang.model.type.TypeMirror is already imported elsewhere and has therefore been excluded from the manual import list.

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.

1 participant