You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2018/09/22 08:53:33 UTC

[GitHub] geertjanw closed pull request #11: Allow building on JDK 11

geertjanw closed pull request #11: Allow building on JDK 11
URL: https://github.com/apache/incubator-netbeans-html4j/pull/11
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.travis.yml b/.travis.yml
index 2e63b0f..332ce3a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,15 +17,18 @@
 # under the License.
 #
 language: java
+jdk:
+ - oraclejdk8
+ - openjdk11
 before_script:
   - export DISPLAY=:99.0
   - sh -e /etc/init.d/xvfb start || echo No X11
   - sleep 3
 script:
-  - jdk_switcher use oraclejdk8 || java -version
   - java -version
   - mvn install -DskipTests
   - mvn verify
+
 os:
   - linux
 
diff --git a/boot-agent-test/pom.xml b/boot-agent-test/pom.xml
index 40d5a65..d070c90 100644
--- a/boot-agent-test/pom.xml
+++ b/boot-agent-test/pom.xml
@@ -79,6 +79,11 @@
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.openjfx</groupId>
+            <artifactId>javafx-web</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.ow2.asm</groupId>
             <artifactId>asm</artifactId>
diff --git a/boot-fx/pom.xml b/boot-fx/pom.xml
index 6e7e3fd..f486bc4 100644
--- a/boot-fx/pom.xml
+++ b/boot-fx/pom.xml
@@ -55,13 +55,6 @@
       </plugins>
   </build>
   <dependencies>
-    <dependency>
-        <groupId>com.oracle</groupId>
-        <artifactId>javafx</artifactId>
-        <version>2.2</version>
-        <scope>system</scope>
-        <systemPath>${jfxrt.jar}</systemPath>
-    </dependency>
     <dependency>
       <groupId>org.netbeans.api</groupId>
       <artifactId>org-openide-util-lookup</artifactId>
@@ -85,6 +78,11 @@
       <version>${project.version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.openjfx</groupId>
+      <artifactId>javafx-web</artifactId>
+      <scope>provided</scope>
+    </dependency>
   </dependencies>
     <description>A presentation provider to show JavaFX WebView 
 when a Java/HTML based application is about to boot.</description>
diff --git a/boot-script/src/test/java/net/java/html/boot/script/KnockoutEnvJSTest.java b/boot-script/src/test/java/net/java/html/boot/script/KnockoutEnvJSTest.java
index 0977c04..4ad97bb 100644
--- a/boot-script/src/test/java/net/java/html/boot/script/KnockoutEnvJSTest.java
+++ b/boot-script/src/test/java/net/java/html/boot/script/KnockoutEnvJSTest.java
@@ -86,13 +86,17 @@ public KnockoutEnvJSTest() {
 
         final Fn.Presenter p = new ScriptPresenter(eng, KOCase.JS);
         try {
-            URL envNashorn = new URL("https://bugs.openjdk.java.net/secure/attachment/11894/env.nashorn.1.2-debug.js");
-            InputStream is = envNashorn.openStream();
-            p.loadScript(new InputStreamReader(is));
-            is.close();
-        } catch (UnknownHostException | ConnectException ex) {
-            ex.printStackTrace();
-            return new Object[0];
+            Class.forName("java.lang.Module");
+        } catch (ClassNotFoundException oldJDK) {
+            try {
+                URL envNashorn = new URL("https://bugs.openjdk.java.net/secure/attachment/11894/env.nashorn.1.2-debug.js");
+                InputStream is = envNashorn.openStream();
+                p.loadScript(new InputStreamReader(is));
+                is.close();
+            } catch (UnknownHostException | ConnectException ex) {
+                ex.printStackTrace();
+                return new Object[0];
+            }
         }
 
         final BrowserBuilder bb = BrowserBuilder.newBrowser(p).
@@ -128,6 +132,12 @@ private static void seekKOTests(Class<?> c, List<Object> res) throws SecurityExc
     }
 
     private static String skipMsg(String methodName) {
+        try {
+            Class.forName("java.lang.Module");
+            return "Don't try the env.js emulation on JDK9 and newer";
+        } catch (ClassNotFoundException oldJDK) {
+            // OK, go on
+        }
         final String ver = System.getProperty("java.runtime.version"); // NOI18N
         if (
             ver.startsWith("1.8.0_25") ||
diff --git a/equinox-agentclass-hook/pom.xml b/equinox-agentclass-hook/pom.xml
index aee2adb..9522247 100644
--- a/equinox-agentclass-hook/pom.xml
+++ b/equinox-agentclass-hook/pom.xml
@@ -41,15 +41,6 @@
                     </instructions>
                 </configuration>
             </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>2.3.2</version>
-                <configuration>
-                    <source>1.5</source>
-                    <target>1.5</target>
-                </configuration>
-            </plugin>
         </plugins>
     </build>
     <dependencies>
diff --git a/equinox-agentclass-hook/src/main/java/java/lang/Module.java b/equinox-agentclass-hook/src/main/java/java/lang/Module.java
new file mode 100644
index 0000000..4b36b26
--- /dev/null
+++ b/equinox-agentclass-hook/src/main/java/java/lang/Module.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package java.lang;
+
+/** Dummy */
+public class Module {
+}
diff --git a/equinox-agentclass-hook/src/main/java/org/netbeans/html/equinox/agentclass/NbInstrumentation.java b/equinox-agentclass-hook/src/main/java/org/netbeans/html/equinox/agentclass/NbInstrumentation.java
index d0c7c45..263651a 100644
--- a/equinox-agentclass-hook/src/main/java/org/netbeans/html/equinox/agentclass/NbInstrumentation.java
+++ b/equinox-agentclass-hook/src/main/java/org/netbeans/html/equinox/agentclass/NbInstrumentation.java
@@ -29,6 +29,7 @@
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.jar.JarFile;
@@ -185,5 +186,11 @@ public boolean isNativeMethodPrefixSupported() {
     public void setNativeMethodPrefix(ClassFileTransformer transformer, String prefix) {
         throw new UnsupportedOperationException();
     }
-    
+
+    public void redefineModule(Module module, Set<Module> extraReads, Map<String, Set<Module>> extraExports, Map<String, Set<Module>> extraOpens, Set<Class<?>> extraUses, Map<Class<?>, List<Class<?>>> extraProvides) {
+    }
+
+    public boolean isModifiableModule(Module module) {
+        return true;
+    }
 }
diff --git a/html4j-maven-plugin/pom.xml b/html4j-maven-plugin/pom.xml
index 8091342..491cb09 100644
--- a/html4j-maven-plugin/pom.xml
+++ b/html4j-maven-plugin/pom.xml
@@ -80,25 +80,6 @@
                <target>1.7</target>
             </configuration>
          </plugin>
-         <plugin>
-             <groupId>org.fortasoft</groupId>
-             <artifactId>gradle-maven-plugin</artifactId>
-             <version>1.0.8</version>
-             <configuration>
-                 <tasks>
-                     <task>build</task>
-                 </tasks>
-                 <gradleProjectDirectory>src/test/resources/org/netbeans/html/mojo/gradle1</gradleProjectDirectory>
-             </configuration>
-             <executions>
-                 <execution>
-                     <phase>generate-test-resources</phase>
-                     <goals>
-                         <goal>invoke</goal>
-                     </goals>
-                 </execution>
-             </executions>
-         </plugin>
       </plugins>
   </build>
 
@@ -154,6 +135,35 @@
       </dependency>
   </dependencies>
   <profiles>
+      <profile>
+          <id>run-gradle</id>
+          <activation>
+              <jdk>[1.8,1.9)</jdk>
+          </activation>
+          <build>
+              <plugins>
+                  <plugin>
+                      <groupId>org.fortasoft</groupId>
+                      <artifactId>gradle-maven-plugin</artifactId>
+                      <version>1.0.8</version>
+                      <configuration>
+                          <tasks>
+                              <task>build</task>
+                          </tasks>
+                          <gradleProjectDirectory>src/test/resources/org/netbeans/html/mojo/gradle1</gradleProjectDirectory>
+                      </configuration>
+                      <executions>
+                          <execution>
+                              <phase>generate-test-resources</phase>
+                              <goals>
+                                  <goal>invoke</goal>
+                              </goals>
+                          </execution>
+                      </executions>
+                  </plugin>
+              </plugins>
+          </build>
+      </profile>
       <profile>
           <id>local-gradle</id>
           <activation>
diff --git a/html4j-maven-plugin/src/test/java/org/netbeans/html/mojo/Gradle1Test.java b/html4j-maven-plugin/src/test/java/org/netbeans/html/mojo/Gradle1Test.java
index 482e529..ba94eb8 100644
--- a/html4j-maven-plugin/src/test/java/org/netbeans/html/mojo/Gradle1Test.java
+++ b/html4j-maven-plugin/src/test/java/org/netbeans/html/mojo/Gradle1Test.java
@@ -26,11 +26,19 @@
 import java.util.concurrent.Callable;
 import org.netbeans.html.boot.spi.Fn;
 import static org.testng.Assert.*;
+import org.testng.SkipException;
 import org.testng.annotations.Test;
 
 public class Gradle1Test {
     @Test
     public void checkTheResultOfTheBuild() throws Exception {
+        try {
+            Class.forName("java.lang.Module");
+            throw new SkipException("Don't test Gradle on new JDKs yet");
+        } catch (ClassNotFoundException ex) {
+            // OK, go on with the test
+        }
+
         URL b = Gradle1Test.class.getResource("gradle1/build.gradle");
         assertNotNull(b, "gradle build script found");
         URL u = Gradle1Test.class.getResource("gradle1/build/libs/gradle1-1.0-SNAPSHOT.jar");
diff --git a/json/src/test/java/net/java/html/json/ModelProcessorTest.java b/json/src/test/java/net/java/html/json/ModelProcessorTest.java
index cf87919..5c39641 100644
--- a/json/src/test/java/net/java/html/json/ModelProcessorTest.java
+++ b/json/src/test/java/net/java/html/json/ModelProcessorTest.java
@@ -23,6 +23,7 @@
 import javax.tools.Diagnostic;
 import javax.tools.JavaFileObject;
 import static org.testng.Assert.*;
+import org.testng.SkipException;
 import org.testng.annotations.Test;
 
 /** Verify errors emitted by the processor.
@@ -415,6 +416,13 @@ private void manyProperties(
     }
 
     @Test public void canWeCompileWithJDK1_5SourceLevel() throws IOException {
+        try {
+            Class.forName("java.lang.Module");
+            throw new SkipException("Cannot use 1.5 source level on new JDKs");
+        } catch (ClassNotFoundException ex) {
+            // OK, go on
+        }
+
         String html = "<html><body>"
             + "</body></html>";
         String code = "package x.y.z;\n"
diff --git a/ko-felix-test/pom.xml b/ko-felix-test/pom.xml
index 06f75f8..6f2a9cd 100644
--- a/ko-felix-test/pom.xml
+++ b/ko-felix-test/pom.xml
@@ -77,13 +77,6 @@
         </plugins>
     </build>
     <dependencies>
-        <dependency>
-            <groupId>com.oracle</groupId>
-            <artifactId>javafx</artifactId>
-            <version>2.2</version>
-            <scope>system</scope>
-            <systemPath>${jfxrt.jar}</systemPath>
-        </dependency>
         <dependency>
             <groupId>com.vaadin.external.google</groupId>
             <artifactId>android-json</artifactId>
@@ -125,6 +118,11 @@
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.openjfx</groupId>
+            <artifactId>javafx-web</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.glassfish.grizzly</groupId>
             <artifactId>grizzly-http-server</artifactId>
diff --git a/ko-osgi-test/pom.xml b/ko-osgi-test/pom.xml
index ae170fb..52af266 100644
--- a/ko-osgi-test/pom.xml
+++ b/ko-osgi-test/pom.xml
@@ -76,13 +76,6 @@
         </plugins>
     </build>
     <dependencies>
-        <dependency>
-            <groupId>com.oracle</groupId>
-            <artifactId>javafx</artifactId>
-            <version>2.2</version>
-            <scope>system</scope>
-            <systemPath>${jfxrt.jar}</systemPath>
-        </dependency>
         <dependency>
             <groupId>com.vaadin.external.google</groupId>
             <artifactId>android-json</artifactId>
@@ -124,6 +117,11 @@
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.openjfx</groupId>
+            <artifactId>javafx-web</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.glassfish.grizzly</groupId>
             <artifactId>grizzly-http-server</artifactId>
@@ -142,7 +140,7 @@
             <artifactId>grizzly-http-servlet</artifactId>
             <version>${grizzly.version}</version>
             <scope>test</scope>
-        </dependency>    
+        </dependency>
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>javax.servlet-api</artifactId>
@@ -161,4 +159,22 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
+    <profiles>
+        <profile>
+            <id>skip.on.jdk9</id>
+            <activation>
+                <jdk>[9,)</jdk>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <configuration>
+                            <skipTests>true</skipTests>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
 </project>
\ No newline at end of file
diff --git a/ko-ws-tyrus/pom.xml b/ko-ws-tyrus/pom.xml
index 9794e2f..9f39a7b 100644
--- a/ko-ws-tyrus/pom.xml
+++ b/ko-ws-tyrus/pom.xml
@@ -146,6 +146,11 @@
         <version>${project.version}</version>
         <scope>test</scope>
     </dependency>
+    <dependency>
+        <groupId>org.openjfx</groupId>
+        <artifactId>javafx-web</artifactId>
+        <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.glassfish.grizzly</groupId>
       <artifactId>grizzly-http-server</artifactId>
diff --git a/ko4j/pom.xml b/ko4j/pom.xml
index 9e61aea..71ac1a2 100644
--- a/ko4j/pom.xml
+++ b/ko4j/pom.xml
@@ -96,6 +96,11 @@
       <version>${project.version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+        <groupId>org.openjfx</groupId>
+        <artifactId>javafx-web</artifactId>
+        <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.glassfish.grizzly</groupId>
       <artifactId>grizzly-http-server</artifactId>
diff --git a/pom.xml b/pom.xml
index 8da5dfb..3e59bab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,11 +26,11 @@
   <version>2.0-SNAPSHOT</version>
   <packaging>pom</packaging>
   <name>HTML APIs via Java</name>
-  <parent> 
+  <parent>
     <groupId>net.java</groupId>
     <artifactId>jvnet-parent</artifactId>
      <version>3</version>
-  </parent>  
+  </parent>
   <properties>
       <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
       <netbeans.version>RELEASE82</netbeans.version>
@@ -139,12 +139,12 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context.
                     <title>Service Provider APIs (not commonly interesting)</title>
                     <packages>org.netbeans.html.*</packages>
                   </group>
-                </groups>   
+                </groups>
                 <links>
                     <link>http://testng.org/javadocs/</link>
                     <link>http://bits.netbeans.org/8.0/javadoc/org-openide-util-lookup/</link>
                     <link>http://docs.oracle.com/javase/8/javafx/api/</link>
-                </links>              
+                </links>
                 <doclet>org.apidesign.javadoc.codesnippet.Doclet</doclet>
                 <docletArtifact>
                     <groupId>org.apidesign.javadoc</groupId>
@@ -154,23 +154,6 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context.
                 <additionalparam>-snippetpath json/src/test -snippetpath boot-fx/src/test ${javadoc.allowjs} -hiddingannotation java.lang.Deprecated</additionalparam>
               </configuration>
             </plugin>
-            <plugin>
-                <groupId>org.netbeans.tools</groupId>
-                <artifactId>sigtest-maven-plugin</artifactId>
-                <version>1.0</version>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>generate</goal>
-                            <goal>check</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <configuration>
-                    <packages>${publicPackages}</packages>
-                    <releaseVersion>1.5.1</releaseVersion>
-                </configuration>
-            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-enforcer-plugin</artifactId>
@@ -307,7 +290,7 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context.
               <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.1</version>
+                <version>2.5.1</version>
                 <configuration>
                     <source>1.6</source>
                     <target>1.6</target>
@@ -374,6 +357,11 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context.
             </exclusion>
           </exclusions>
         </dependency>
+        <dependency>
+            <groupId>org.openjfx</groupId>
+            <artifactId>javafx-web</artifactId>
+            <version>11</version>
+        </dependency>
         <dependency>
             <groupId>com.vaadin.external.google</groupId>
             <artifactId>android-json</artifactId>
@@ -467,7 +455,7 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context.
             <artifactId>javax.servlet-api</artifactId>
             <version>3.1.0</version>
         </dependency>
-        <dependency> 
+        <dependency>
             <groupId>org.netbeans.modules</groupId>
             <artifactId>org-netbeans-modules-web-browser-api</artifactId>
             <version>${netbeans.version}</version>
@@ -517,6 +505,27 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context.
           <properties>
             <jfxrt.jar>${java.home}/lib/ext/jfxrt.jar</jfxrt.jar>
           </properties>
+          <build>
+              <plugins>
+                  <plugin>
+                      <groupId>org.netbeans.tools</groupId>
+                      <artifactId>sigtest-maven-plugin</artifactId>
+                      <version>1.0</version>
+                      <executions>
+                          <execution>
+                              <goals>
+                                  <goal>generate</goal>
+                                  <goal>check</goal>
+                              </goals>
+                          </execution>
+                      </executions>
+                      <configuration>
+                          <packages>${publicPackages}</packages>
+                          <releaseVersion>1.5.1</releaseVersion>
+                      </configuration>
+                  </plugin>
+              </plugins>
+          </build>
       </profile>
       <profile>
           <id>jdk7</id>
diff --git a/sound/pom.xml b/sound/pom.xml
index baf0549..a8041e8 100644
--- a/sound/pom.xml
+++ b/sound/pom.xml
@@ -71,17 +71,24 @@
             <artifactId>net.java.html.boot.script</artifactId>
             <version>${project.version}</version>
             <type>jar</type>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.netbeans.html</groupId>
             <artifactId>net.java.html.boot.fx</artifactId>
             <version>${project.version}</version>
             <type>jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.openjfx</groupId>
+            <artifactId>javafx-web</artifactId>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.netbeans.html</groupId>
             <artifactId>net.java.html.boot</artifactId>
-            <version>2.0-SNAPSHOT</version>
+            <version>${project.version}</version>
             <type>jar</type>
         </dependency>
         <dependency>
diff --git a/xhr4j/pom.xml b/xhr4j/pom.xml
index 917f427..f54df9e 100644
--- a/xhr4j/pom.xml
+++ b/xhr4j/pom.xml
@@ -119,6 +119,11 @@
         <version>${project.version}</version>
         <scope>test</scope>
     </dependency>
+    <dependency>
+        <groupId>org.openjfx</groupId>
+        <artifactId>javafx-web</artifactId>
+        <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.glassfish.grizzly</groupId>
       <artifactId>grizzly-http-server</artifactId>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists