question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove OSGi annotations from the API

See original GitHub issue

The OSGi annotations added in https://github.com/eclipse/microprofile-config/pull/381/, cause annoying compiler warnings.

The issue is that we mark the OSGi dependencies as provided and a reference to org.osgi.annotation.bundle.Requirement.Resolution#OPTIONAL is missing from the dependencies when compiling a project that uses @ConfigProperty.

Adding the OSGi dependency as compile does fix the issue, but I believe an MP API should not transitively push this kind of dependency to their consumers (especially if they are not using OSGi).

This can be reproduced just by using the MP Config API JAR, use the @ConfigProperty annotation and compile code with warnings on: -Dmaven.compiler.showWarnings=true. It generates the following warning:

[WARNING] unknown enum constant org.osgi.annotation.bundle.Requirement.Resolution.OPTIONAL
  reason: class file for org.osgi.annotation.bundle.Requirement$Resolution not found

This causes confusion to users, and we should remove this warning.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:9
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
bjhargravecommented, Feb 7, 2022

FYI, I am working a fix to the OSGi annotations to replace use of enum types with String along with a corresponding fix to Bnd to support this change.

1reaction
famodcommented, Feb 7, 2022

FTR, I’m using following workaround in my Quarkus project (in root parent pom.xml):

        <!-- workaround for https://github.com/quarkusio/quarkus/issues/19970 -->
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.annotation</artifactId>
            <version>7.0.0</version>
            <scope>provided</scope>
        </dependency>

This way it at least doesn’t end up in the production jar.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependency Manager Annotations - Apache Felix
Invoke the stop method (annotated wit @Stop), and unregister some OSGi services (if the components provides some services). invoke destroy method (annotated ......
Read more >
Declarative Services — From Felix SCR to OSGi - Medium
Let's start by removing the Maven SCR plugin since OSGi v6 annotations will not be processed by this plugin: <plugin>
Read more >
112 Declarative Services Specification - OSGi Compendium 7
The Reference annotation will use the name of the annotated method, field, or parameter as the default reference name. If the method name...
Read more >
DS Annotations – dependency updates
A bundle with both types of annotations would still be good. Once all the code changes are done, you should remove all felix...
Read more >
OSGi Modularity and Services - Tutorial - Vogella.com
Using the OSGi service low-level API ... The following is an example of using an annotation to define an OSGi service. It provides...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found