Merge pull request #69 from kwin/feature/support-empty-default-values

FELIX-6384 support empty directive values
diff --git a/framework/pom.xml b/framework/pom.xml
index f987bac..a0894ff 100644
--- a/framework/pom.xml
+++ b/framework/pom.xml
@@ -42,6 +42,61 @@
   <build>
     <plugins>
       <plugin>
+        <groupId>org.moditect</groupId>
+        <artifactId>moditect-maven-plugin</artifactId>
+        <version>1.0.0.RC1</version>
+        <executions>
+          <execution>
+            <id>add-module-infos</id>
+            <phase>package</phase>
+            <goals>
+              <goal>add-module-info</goal>
+            </goals>
+            <configuration>
+              <module>
+              <moduleInfoSource>
+                open module org.apache.felix.framework {
+                    requires jdk.unsupported;
+
+                    exports org.apache.felix.framework.ext;
+                    exports org.osgi.dto;
+                    exports org.osgi.framework;
+                    exports org.osgi.framework.connect;
+                    exports org.osgi.framework.dto;
+                    exports org.osgi.framework.hooks.bundle;
+                    exports org.osgi.framework.hooks.resolver;
+                    exports org.osgi.framework.hooks.service;
+                    exports org.osgi.framework.hooks.weaving;
+                    exports org.osgi.framework.launch;
+                    exports org.osgi.framework.namespace;
+                    exports org.osgi.framework.startlevel;
+                    exports org.osgi.framework.startlevel.dto;
+                    exports org.osgi.framework.wiring;
+                    exports org.osgi.framework.wiring.dto;
+                    exports org.osgi.resource;
+                    exports org.osgi.resource.dto;
+                    exports org.osgi.service.condition;
+                    exports org.osgi.service.packageadmin;
+                    exports org.osgi.service.resolver;
+                    exports org.osgi.service.startlevel;
+                    exports org.osgi.service.url;
+                    exports org.osgi.util.tracker;
+                    provides org.osgi.framework.launch.FrameworkFactory with
+                      org.apache.felix.framework.FrameworkFactory;
+                    provides org.osgi.framework.connect.ConnectFrameworkFactory with
+                      org.apache.felix.framework.FrameworkFactory;
+
+                    uses org.apache.felix.framework.ext.ClassPathExtenderFactory;
+                    uses org.osgi.framework.connect.FrameworkUtilHelper;
+                    }
+                </moduleInfoSource>
+              </module>
+              <overwriteExistingFiles>true</overwriteExistingFiles>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
         <version>5.1.1</version>
diff --git a/framework/src/main/java/org/apache/felix/framework/util/Util.java b/framework/src/main/java/org/apache/felix/framework/util/Util.java
index b8618bb..ee25452 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/Util.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/Util.java
@@ -185,8 +185,9 @@
             Class<?> c_Exports = Felix.class.getClassLoader().loadClass("java.lang.module.ModuleDescriptor$Exports");
             Method m_getLayer = c_Module.getMethod("getLayer");
             Method m_getModule = Class.class.getMethod("getModule");
-            Method m_canRead = c_Module.getMethod("canRead", c_Module);
             Method m_getName = c_Module.getMethod("getName");
+            Method isAutomatic = c_Descriptor.getMethod("isAutomatic");
+            Method packagesMethod = c_Descriptor.getMethod("packages");
 
             Object self = m_getModule.invoke(Felix.class);
             Object moduleLayer = m_getLayer.invoke(self);
@@ -198,7 +199,7 @@
 
             for (Object module : ((Iterable) c_ModuleLayer.getMethod("modules").invoke(moduleLayer)))
             {
-                if ((Boolean) m_canRead.invoke(self, module))
+                if (!self.equals(module))
                 {
                     String name = (String) m_getName.invoke(module);
 
@@ -206,13 +207,20 @@
 
                     Object descriptor = c_Module.getMethod("getDescriptor").invoke(module);
 
-                    for (Object export :((Set) c_Descriptor.getMethod("exports").invoke(descriptor)))
+                    if (!((Boolean) isAutomatic.invoke(descriptor)))
                     {
-                        if (((Set) c_Exports.getMethod("targets").invoke(export)).isEmpty())
+                        for (Object export : ((Set) c_Descriptor.getMethod("exports").invoke(descriptor)))
                         {
-                            pkgs.add((String) c_Exports.getMethod("source").invoke(export));
+                            if (((Set) c_Exports.getMethod("targets").invoke(export)).isEmpty())
+                            {
+                                pkgs.add((String) c_Exports.getMethod("source").invoke(export));
+                            }
                         }
                     }
+                    else
+                    {
+                        pkgs.addAll((Set<String>) packagesMethod.invoke(descriptor));
+                    }
                     result.put(name, pkgs);
                 }
             }
diff --git a/main/pom.xml b/main/pom.xml
index 9cc2536..e84ed78 100644
--- a/main/pom.xml
+++ b/main/pom.xml
@@ -20,7 +20,7 @@
  <parent>
     <groupId>org.apache.felix</groupId>
     <artifactId>felix-parent</artifactId>
-    <version>5</version>
+    <version>6</version>
     <relativePath>../pom/pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>
@@ -43,6 +43,7 @@
   </dependencies>
   <properties>
     <log.level>4</log.level>
+    <felix.java.version>8</felix.java.version>
     <dollar>$</dollar>
     <gogo.runtime.version>1.1.4</gogo.runtime.version>
     <gogo.jline.shell.version>1.1.8</gogo.jline.shell.version>
@@ -63,18 +64,72 @@
   <build>
     <plugins>
       <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>animal-sniffer-maven-plugin</artifactId>
         <configuration>
-          <target>1.5</target>
-          <source>1.5</source>
+          <skip>true</skip>
         </configuration>
-      </plugin>
+     </plugin>
+     <plugin>
+        <groupId>org.moditect</groupId>
+        <artifactId>moditect-maven-plugin</artifactId>
+        <version>1.0.0.RC1</version>
+        <executions>
+          <execution>
+            <id>add-module-infos</id>
+            <phase>package</phase>
+            <goals>
+              <goal>add-module-info</goal>
+            </goals>
+            <configuration>
+              <module>
+              <moduleInfoSource>
+                open module org.apache.felix.main {
+                    requires jdk.unsupported;
 
+                    exports org.apache.felix.framework.ext;
+                    exports org.osgi.dto;
+                    exports org.osgi.framework;
+                    exports org.osgi.framework.connect;
+                    exports org.osgi.framework.dto;
+                    exports org.osgi.framework.hooks.bundle;
+                    exports org.osgi.framework.hooks.resolver;
+                    exports org.osgi.framework.hooks.service;
+                    exports org.osgi.framework.hooks.weaving;
+                    exports org.osgi.framework.launch;
+                    exports org.osgi.framework.namespace;
+                    exports org.osgi.framework.startlevel;
+                    exports org.osgi.framework.startlevel.dto;
+                    exports org.osgi.framework.wiring;
+                    exports org.osgi.framework.wiring.dto;
+                    exports org.osgi.resource;
+                    exports org.osgi.resource.dto;
+                    exports org.osgi.service.condition;
+                    exports org.osgi.service.packageadmin;
+                    exports org.osgi.service.resolver;
+                    exports org.osgi.service.startlevel;
+                    exports org.osgi.service.url;
+                    exports org.osgi.util.tracker;
+                    provides org.osgi.framework.launch.FrameworkFactory with
+                      org.apache.felix.framework.FrameworkFactory;
+                    provides org.osgi.framework.connect.ConnectFrameworkFactory with
+                      org.apache.felix.framework.FrameworkFactory;
+
+                    uses org.apache.felix.framework.ext.ClassPathExtenderFactory;
+                    uses org.osgi.framework.connect.FrameworkUtilHelper;
+                    }
+                </moduleInfoSource>
+                <mainClass>org.apache.felix.main.Main</mainClass>
+              </module>
+              <overwriteExistingFiles>true</overwriteExistingFiles>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
       <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
-        <version>2.5.0</version>
+        <version>5.1.1</version>
         <extensions>true</extensions>
         <configuration>
           <instructions>
@@ -84,7 +139,7 @@
             <Bundle-Name>Apache Felix</Bundle-Name>
             <Bundle-Description>OSGi R6 framework.</Bundle-Description>
             <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
-            <Embed-Dependency>*;artifactId=org.apache.felix.framework;inline=true</Embed-Dependency>
+            <Embed-Dependency>*;artifactId=org.apache.felix.framework;inline=default.properties|org/**|META-INF/services/**</Embed-Dependency>
             <Private-Package>org.apache.felix.main.*</Private-Package>
             <Export-Package>!org.osgi.service.log, !org.osgi.service.obr, org.osgi.*</Export-Package>
             <Import-Package>!*</Import-Package>
@@ -190,11 +245,11 @@
         </executions>
       </plugin>
       <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-javadoc-plugin</artifactId>
-            <configuration>
-                <failOnError>false</failOnError>
-            </configuration>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <failOnError>false</failOnError>
+        </configuration>
       </plugin>
     </plugins>
     <resources>