Look into supporting type aliases
starksm64 opened this issue · comments
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.