jnr / jnr-unixsocket

UNIX domain sockets (AF_UNIX) for Java
Apache License 2.0
278 stars 75 forks source link

jnr-unixsocket v0.23 and above forces osgi.ee;filter:="(&(osgi.e e=JavaSE)(version=9.0))" #77

Open nvatvani opened 4 years ago

nvatvani commented 4 years ago

When using JDK1.8, jnr-unixsocket v0.22 and below correctly sets osgi.ee;filter:="(&(osgi.e e=JavaSE)(version=1.8))" but v0.23 and above forces osgi.ee;filter:="(&(osgi.e e=JavaSE)(version=9.0))".

Given that JDK1.8 is still supported, can jnr-unixsocket v0.25-SNAPSHOT have its dependencies adjusted so that osgi.ee;filter:="(&(osgi.e e=JavaSE)(version=1.8))" persists and one is not forced to upgrade to JDK9?

The dependency involved that forces osgi.ee;filter:="(&(osgi.e e=JavaSE)(version=9.0))" is described here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=537751

.. specifically "org.objectweb.asm" which is a transitive dependency of jnr-enxio.

It is "org.objectweb.asm" that forces JDK9.

headius commented 4 years ago

Hmm...so how do I fix this?

nvatvani commented 4 years ago

Hmm...so how do I fix this?

You hack it by specifying <_noee>true under instruction tag of the maven-bundle-plugin

The _noee tag removes all minimum versioning enforcement of the runtime JRE.

headius commented 4 years ago

Ok I tried this patch but I did not see any difference in the MANIFEST. I also did not see any Require-Capability in the MANIFEST before I made the change, so I'm confused about how to proceed.

diff --git a/pom.xml b/pom.xml
index f5070ff..6bf0e1f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -179,6 +179,7 @@
         <configuration>
           <instructions>
             <_nouses>true</_nouses>
+            <_noee>true</_noee>
             <Import-Package>*,jnr.ffi.mapper,jnr.ffi.provider.converters,jnr.ffi.provider.jffi,com.kenai.jffi</Import-Package>
             <Automatic-Module-Name>jnr.unixsocket</Automatic-Module-Name>
           </instructions>

Unpatched MANIFEST.MF:

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven Bundle Plugin
Built-By: headius
Build-Jdk: 1.8.0_222
Automatic-Module-Name: jnr.unixsocket
Bnd-LastModified: 1578673603363
Bundle-Description: Native I/O access for java
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-ManifestVersion: 2
Bundle-Name: jnr-unixsocket
Bundle-SymbolicName: com.github.jnr.unixsocket
Bundle-Version: 0.26.0.SNAPSHOT
Export-Package: jnr.unixsocket;version="0.26.0.SNAPSHOT"
Import-Package: com.kenai.jffi,jnr.constants.platform;version="[0.9,1)
 ",jnr.enxio.channels;version="[0.23,1)",jnr.ffi;version="[2.1,3)",jnr
 .ffi.annotations;version="[2.1,3)",jnr.ffi.byref;version="[2.1,3)",jn
 r.ffi.mapper;version="[2.1,3)",jnr.ffi.provider.converters;version="[
 2.1,3)",jnr.ffi.provider.jffi;version="[2.1,3)",jnr.ffi.types;version
 ="[2.1,3)",jnr.posix;version="[3.0,4)"
Tool: Bnd-1.50.0