langtools/test/tools/javac/T6942649.java
changeset 36526 3b41f1c69604
parent 34752 9c262a013456
--- a/langtools/test/tools/javac/T6942649.java	Tue Mar 15 13:48:30 2016 -0700
+++ b/langtools/test/tools/javac/T6942649.java	Thu Mar 17 19:04:28 2016 +0000
@@ -36,11 +36,11 @@
     }
 
     void run() throws Exception {
-        test("-XDshowClass", "com.sun.tools.javac.Main");
-        test("-XDshowClass=com.sun.tools.javac.util.Log", "com.sun.tools.javac.util.Log");
+        test("-XDshowClass", "com.sun.tools.javac.Main", false);
+        test("-XDshowClass=com.sun.tools.javac.util.Log", "com.sun.tools.javac.util.Log", false);
     }
 
-    void test(String opt, String clazz) throws Exception {
+    void test(String opt, String clazz, boolean checkLocation) throws Exception {
         System.err.println("test " + opt);
         StringWriter sw = new StringWriter();
         PrintWriter pw = new PrintWriter(sw);
@@ -48,11 +48,18 @@
         pw.close();
         String out = sw.toString();
         System.err.println("javac rc=" + rc + "\n" + out);
+
         if (!out.contains(clazz))
             throw new Exception("class name not found in output");
-        int lastDot = clazz.lastIndexOf(".");
-        if (!out.contains(clazz.substring(lastDot + 1) + ".class"))
-            throw new Exception("location of class not found in output");
+
+        // (JDK 9) We can no longer guarantee to be able to show a URL for the
+        // location of the class, especially when the class is in the system image
+        if (checkLocation) {
+            int lastDot = clazz.lastIndexOf(".");
+            if (!out.contains(clazz.substring(lastDot + 1) + ".class"))
+                throw new Exception("location of class not found in output");
+        }
+
         if (!out.contains("MD5 checksum: "))
             throw new Exception("checksum not found in output");
     }