langtools/test/tools/javap/T6729471.java
changeset 27323 babdaa819add
parent 27234 f3f667e5870c
child 27579 d1a63c99cdd5
equal deleted inserted replaced
27322:14c8294d03a4 27323:babdaa819add
    23 
    23 
    24 
    24 
    25 /*
    25 /*
    26  * @test
    26  * @test
    27  * @bug 6729471
    27  * @bug 6729471
    28  * @summary javap should accept class files on the command line
    28  * @summary javap does not output inner interfaces of an interface
    29  * @library /tools/lib
       
    30  * @build ToolBox
       
    31  * @run main T6729471
       
    32  */
    29  */
    33 
    30 
    34 import java.io.*;
    31 import java.io.*;
    35 import java.net.*;
    32 import java.net.*;
    36 import java.util.*;
    33 import java.util.*;
    58 
    55 
    59         // file url
    56         // file url
    60         verify(new File(testClasses, "T6729471.class").toURI().toString(),
    57         verify(new File(testClasses, "T6729471.class").toURI().toString(),
    61                 "public static void main(java.lang.String...)");
    58                 "public static void main(java.lang.String...)");
    62 
    59 
    63         // jar url
    60         // jar url: rt.jar
    64         // Create a temp jar
    61         File java_home = new File(System.getProperty("java.home"));
    65         ToolBox tb = new ToolBox();
    62         if (java_home.getName().equals("jre"))
    66         tb.new JavacTask()
    63             java_home = java_home.getParentFile();
    67           .sources("class Foo { public void sayHello() {} }")
    64         File rt_jar = new File(new File(new File(java_home, "jre"), "lib"), "rt.jar");
    68           .run();
       
    69         String foo_jar = "foo.jar";
       
    70         tb.new JarTask(foo_jar)
       
    71           .files("Foo.class")
       
    72           .run();
       
    73         File foo_jarFile = new File(foo_jar);
       
    74 
       
    75         // Verify
       
    76         try {
    65         try {
    77             verify("jar:" + foo_jarFile.toURL() + "!/Foo.class",
    66             verify("jar:" + rt_jar.toURL() + "!/java/util/Map.class",
    78                 "public void sayHello()");
    67                 "public abstract boolean containsKey(java.lang.Object)");
    79         } catch (MalformedURLException e) {
    68         } catch (MalformedURLException e) {
    80             error(e.toString());
    69             error(e.toString());
    81         }
    70         }
       
    71 
       
    72         // jar url: ct.sym, if it exists
       
    73         File ct_sym = new File(new File(java_home, "lib"), "ct.sym");
       
    74         if (ct_sym.exists()) {
       
    75             try {
       
    76                 verify("jar:" + ct_sym.toURL() + "!/META-INF/sym/rt.jar/java/util/Map.class",
       
    77                     "public abstract boolean containsKey(java.lang.Object)");
       
    78             } catch (MalformedURLException e) {
       
    79                 error(e.toString());
       
    80             }
       
    81         } else
       
    82             System.err.println("warning: ct.sym not found");
    82 
    83 
    83         if (errors > 0)
    84         if (errors > 0)
    84             throw new Error(errors + " found.");
    85             throw new Error(errors + " found.");
    85     }
    86     }
    86 
    87