Skip to content

Commit a0f45a1

Browse files
authored
Add minimal OSGi metadata as per #768 (#805)
1 parent bc48353 commit a0f45a1

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

pom.xml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,16 @@
3838
still use Moditect to get JDK9+ module info support; need newer bundle plugin as well
3939
(can just defaults from `jackson-parent`)
4040
-->
41-
4241
<osgi.export>com.fasterxml.jackson.core;version=${project.version},
4342
com.fasterxml.jackson.core.*;version=${project.version}
4443
</osgi.export>
4544

4645
<!-- Generate PackageVersion.java into this directory. -->
4746
<packageVersion.dir>com/fasterxml/jackson/core/json</packageVersion.dir>
4847
<packageVersion.package>${project.groupId}.json</packageVersion.package>
48+
49+
<!-- Bnd annotations for generating extra OSGi metadata. -->
50+
<version.bnd.annotation>6.3.1</version.bnd.annotation>
4951
</properties>
5052

5153
<!-- Alas, need to include snapshot reference since otherwise can not find
@@ -142,6 +144,16 @@ com.fasterxml.jackson.core.*;version=${project.version}
142144
</build>
143145

144146
<dependencies>
147+
<!-- 31-Jul-2022, tatu: [core#768] OSGi metadata -->
148+
<dependency>
149+
<groupId>biz.aQute.bnd</groupId>
150+
<artifactId>biz.aQute.bnd.annotation</artifactId>
151+
<version>${version.bnd.annotation}</version>
152+
<optional>true</optional>
153+
<scope>provided</scope>
154+
</dependency>
155+
156+
<!-- plus test dependencies -->
145157
<dependency>
146158
<groupId>org.junit.vintage</groupId>
147159
<artifactId>junit-vintage-engine</artifactId>

src/main/java/com/fasterxml/jackson/core/JsonFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import java.lang.ref.SoftReference;
99
import java.net.URL;
1010

11+
import aQute.bnd.annotation.spi.ServiceProvider;
12+
1113
import com.fasterxml.jackson.core.format.InputAccessor;
1214
import com.fasterxml.jackson.core.format.MatchStrength;
1315
import com.fasterxml.jackson.core.io.*;
@@ -42,6 +44,7 @@
4244
* @author Tatu Saloranta
4345
*/
4446
@SuppressWarnings("resource")
47+
@ServiceProvider(JsonFactory.class) // will be `TokenStreamFactory` in 3.x
4548
public class JsonFactory
4649
extends TokenStreamFactory
4750
implements Versioned,

0 commit comments

Comments
 (0)