8062336: Revert tools/javap/T6729471.java to original test code
authorsogoel
Thu, 30 Oct 2014 15:21:42 -0700
changeset 27323 babdaa819add
parent 27322 14c8294d03a4
child 27324 f54441c74373
8062336: Revert tools/javap/T6729471.java to original test code Reviewed-by: jjg
langtools/test/tools/javap/T6729471.java
--- a/langtools/test/tools/javap/T6729471.java	Thu Oct 30 13:55:51 2014 -0700
+++ b/langtools/test/tools/javap/T6729471.java	Thu Oct 30 15:21:42 2014 -0700
@@ -25,10 +25,7 @@
 /*
  * @test
  * @bug 6729471
- * @summary javap should accept class files on the command line
- * @library /tools/lib
- * @build ToolBox
- * @run main T6729471
+ * @summary javap does not output inner interfaces of an interface
  */
 
 import java.io.*;
@@ -60,26 +57,30 @@
         verify(new File(testClasses, "T6729471.class").toURI().toString(),
                 "public static void main(java.lang.String...)");
 
-        // jar url
-        // Create a temp jar
-        ToolBox tb = new ToolBox();
-        tb.new JavacTask()
-          .sources("class Foo { public void sayHello() {} }")
-          .run();
-        String foo_jar = "foo.jar";
-        tb.new JarTask(foo_jar)
-          .files("Foo.class")
-          .run();
-        File foo_jarFile = new File(foo_jar);
-
-        // Verify
+        // jar url: rt.jar
+        File java_home = new File(System.getProperty("java.home"));
+        if (java_home.getName().equals("jre"))
+            java_home = java_home.getParentFile();
+        File rt_jar = new File(new File(new File(java_home, "jre"), "lib"), "rt.jar");
         try {
-            verify("jar:" + foo_jarFile.toURL() + "!/Foo.class",
-                "public void sayHello()");
+            verify("jar:" + rt_jar.toURL() + "!/java/util/Map.class",
+                "public abstract boolean containsKey(java.lang.Object)");
         } catch (MalformedURLException e) {
             error(e.toString());
         }
 
+        // jar url: ct.sym, if it exists
+        File ct_sym = new File(new File(java_home, "lib"), "ct.sym");
+        if (ct_sym.exists()) {
+            try {
+                verify("jar:" + ct_sym.toURL() + "!/META-INF/sym/rt.jar/java/util/Map.class",
+                    "public abstract boolean containsKey(java.lang.Object)");
+            } catch (MalformedURLException e) {
+                error(e.toString());
+            }
+        } else
+            System.err.println("warning: ct.sym not found");
+
         if (errors > 0)
             throw new Error(errors + " found.");
     }