Skip to content

🐛 Bug Report: @amplication/java-ast duplicates imports when references are used #9845

@TimothyJones

Description

@TimothyJones

What happened?

When References are used in a Class (as happens automatically for annotations etc), the import statement is incorrectly duplicated.

You can see this in the complex snapshot, which has several duplicated imports.

This is because the references are de-duplicated in a set, but javascript sets use reference equality.

I've got a fix, PR incoming.

What you expected to happen

Repeat types in imports and references appear only once in the import list.

How to reproduce

Run the snapshot test.

Amplication version

@amplication/java-ast@0.0.2

Environment

Node: v24.11.1
npm: 11.6.2

Are you willing to submit PR?

Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions