Skip to content

Look into supporting type aliases #86

@starksm64

Description

@starksm64

In the evolution of Jakarta EE 8 to 9 there is a package name change complicates support for the now legacy type, even though there are no semantic differences. In a prototype of arc I was looking at trying to make the minimal changes to have arc support the jakarta.* package while also handling existing code to work. This resulted in duplicate DotName instances and checks like the following:

    public static final DotName PRIORITY = create(jakarta.annotation.Priority.class);
    public static final DotName PRIORITY_JAVAX = create("javax.annotation.Priority");

...
                    } else if (DotNames.PRIORITY.equals(annotation.name())
                            || DotNames.PRIORITY_JAVAX.equals(annotation.name())) {
                        alternativePriority = annotation.value().asInt();
                    } else {

This issue is about whether an alias notion can effectively be added to jandex. It has been pointed out that:

  • DotNames can be created by extensions, and so not all instances will be updated to know about the alias
  • DotNames are not associated with an index, so introducing the alias there will also not handle existing usage without a change to DotName to be index aware.

It seems like what is needed is an alias registry in DotName that is populated by a new factory method, and that all instance would check for an alias.

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