Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support replacement of enum types in osgi.annotation #5088

Merged

Conversation

bjhargrave
Copy link
Member

Using enum types in the CLASS retention bundle annotations is causing
issues for those using the annotations. Various tools, such as javadoc,
attempt to reify the elements in the annotations and since the
osgi.annotation jar is generally a scope=provided dependency, the enum
types are not available to downstream users of the jars using the
OSGi annotations and so tools generates an annoying warning.

See quarkusio/quarkus#19970 and
eclipse/microprofile-config#716.

We support the use of enum values or string values as the annotation
element value through existing conversion support. The OSGi change in
osgi/osgi#404 will move from using enum types
to use string values which are case-insensitive equivalent to the
enum value names.

We seamlessly handle old and new annotations using the old enum values
or the new string values. Prior to this fix, Bnd already handled the
change through a fallback in Converter which uppercased the string value
before converting to an internal enum value. This change avoids the
internal enum type and processes the string value or string name of the
enum value when processing older versions of the OSGi annotations.

When we convert program information strings, like URI schemes, XML tags,
enum value names, to upper or lower case, we need to specify Locale.ROOT
as the locale to avoid unexpected conversion issues in some locales.

Signed-off-by: BJ Hargrave <bj@hargrave.dev>
Using enum types in the CLASS retention bundle annotations is causing
issues for those using the annotations. Various tools, such as javadoc,
attempt to reify the elements in the annotations and since the
osgi.annotation jar is generally a scope=provided dependency, the enum
types are not available to downstream users of the jars using the
OSGi annotations and so tools generates an annoying warning.

See quarkusio/quarkus#19970 and
eclipse/microprofile-config#716.

We support the use of enum values or string values as the annotation
element value through existing conversion support. The OSGi change in
osgi/osgi#404 will move from using enum values
to use string values which are equivalent to the former enum value
names.

We seamlessly handle old and new annotations using the old enum values
or the new string values. Prior to this fix, Bnd already handled the
change through the Converter which converts the string value to an
internal enum value. This change avoids the internal enum type and
processes the string value or string name of the enum value when
processing older versions of the OSGi annotations.

Signed-off-by: BJ Hargrave <bj@hargrave.dev>
@bjhargrave bjhargrave force-pushed the replace-enum-in-osgi.annotation branch from 56d1103 to 70eae7e Compare February 7, 2022 23:31
@bjhargrave bjhargrave merged commit 828a8a3 into bndtools:master Feb 8, 2022
@bjhargrave bjhargrave deleted the replace-enum-in-osgi.annotation branch February 8, 2022 00:33
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