langtools/test/tools/javac/innerClassFile/InnerClassFileTest.java
changeset 36778 e04318f39f92
parent 36526 3b41f1c69604
equal deleted inserted replaced
36777:28d33fb9097f 36778:e04318f39f92
     1 /*
     1 /*
     2  * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    25  * @test
    25  * @test
    26  * @bug 4491755 4785453
    26  * @bug 4491755 4785453
    27  * @summary Prob w/static inner class with same name as a regular class
    27  * @summary Prob w/static inner class with same name as a regular class
    28  * @library /tools/lib
    28  * @library /tools/lib
    29  * @modules jdk.compiler/com.sun.tools.javac.api
    29  * @modules jdk.compiler/com.sun.tools.javac.api
    30  *          jdk.compiler/com.sun.tools.javac.file
       
    31  *          jdk.compiler/com.sun.tools.javac.main
    30  *          jdk.compiler/com.sun.tools.javac.main
    32  *          jdk.jdeps/com.sun.tools.javap
    31  * @build toolbox.ToolBox toolbox.JavacTask
    33  * @build ToolBox
       
    34  * @run main InnerClassFileTest
    32  * @run main InnerClassFileTest
    35  */
    33  */
    36 
    34 
    37 import java.nio.file.Path;
    35 import java.nio.file.Path;
    38 import java.nio.file.Paths;
    36 import java.nio.file.Paths;
       
    37 
       
    38 import toolbox.JavacTask;
       
    39 import toolbox.ToolBox;
    39 
    40 
    40 // Original test: test/tools/javac/innerClassFile/Driver.sh
    41 // Original test: test/tools/javac/innerClassFile/Driver.sh
    41 public class InnerClassFileTest {
    42 public class InnerClassFileTest {
    42 
    43 
    43     private static final String BSrc =
    44     private static final String BSrc =
   106         Path srcDir = Paths.get("src");
   107         Path srcDir = Paths.get("src");
   107         tb.writeJavaFiles(srcDir, BSrc, CSrc, MainSrc, R1Src, R2Src, R3Src);
   108         tb.writeJavaFiles(srcDir, BSrc, CSrc, MainSrc, R1Src, R2Src, R3Src);
   108     }
   109     }
   109 
   110 
   110     void compileFiles() throws Exception {
   111     void compileFiles() throws Exception {
   111         tb.new JavacTask()
   112         new JavacTask(tb)
   112                 .outdir(".")
   113                 .outdir(".")
   113                 .classpath(".")
   114                 .classpath(".")
   114                 .sourcepath("src")
   115                 .sourcepath("src")
   115                 .files("src/x/B.java", "src/x/C.java", "src/y/Main.java")
   116                 .files("src/x/B.java", "src/x/C.java", "src/y/Main.java")
   116                 .run()
   117                 .run()
   117                 .writeAll();
   118                 .writeAll();
   118 
   119 
   119         tb.deleteFiles("y/R3.class");
   120         tb.deleteFiles("y/R3.class");
   120 
   121 
   121         tb.new JavacTask()
   122         new JavacTask(tb)
   122                 .outdir(".")
   123                 .outdir(".")
   123                 .classpath(".")
   124                 .classpath(".")
   124                 .sourcepath("src")
   125                 .sourcepath("src")
   125                 .files("src/y/Main.java")
   126                 .files("src/y/Main.java")
   126                 .run()
   127                 .run()