langtools/test/tools/javac/classfiles/attributes/SourceFile/ModuleInfoTest.java
changeset 36778 e04318f39f92
parent 36526 3b41f1c69604
equal deleted inserted replaced
36777:28d33fb9097f 36778:e04318f39f92
     1 /*
     1 /*
     2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 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  * @summary sourcefile attribute test for module-info.
    26  * @summary sourcefile attribute test for module-info.
    27  * @bug 8080878
    27  * @bug 8080878
    28  * @library /tools/lib /tools/javac/lib ../lib
    28  * @library /tools/lib /tools/javac/lib ../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.classfile
    31  *          jdk.jdeps/com.sun.tools.classfile
    33  *          jdk.jdeps/com.sun.tools.javap
    32  * @build toolbox.ToolBox toolbox.JavacTask InMemoryFileManager TestBase SourceFileTestBase
    34  * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
       
    35  * @run main ModuleInfoTest
    33  * @run main ModuleInfoTest
    36  */
    34  */
    37 
    35 
    38 import java.nio.file.Path;
    36 import java.nio.file.Path;
    39 import java.nio.file.Paths;
    37 import java.nio.file.Paths;
       
    38 
       
    39 import toolbox.JavacTask;
       
    40 import toolbox.Task;
       
    41 import toolbox.ToolBox;
    40 
    42 
    41 public class ModuleInfoTest extends SourceFileTestBase {
    43 public class ModuleInfoTest extends SourceFileTestBase {
    42     public static void main(String[] args) throws Exception {
    44     public static void main(String[] args) throws Exception {
    43         Path outdir = Paths.get(".");
    45         Path outdir = Paths.get(".");
    44         ToolBox tb = new ToolBox();
    46         ToolBox tb = new ToolBox();
    45         final Path moduleInfo = Paths.get("module-info.java");
    47         final Path moduleInfo = Paths.get("module-info.java");
    46         tb.writeFile(moduleInfo, "module m1{}");
    48         tb.writeFile(moduleInfo, "module m1{}");
    47         tb.new JavacTask()
    49         new JavacTask(tb)
    48                 .files(moduleInfo)
    50                 .files(moduleInfo)
    49                 .outdir(outdir)
    51                 .outdir(outdir)
    50                 .run(ToolBox.Expect.SUCCESS)
    52                 .run(Task.Expect.SUCCESS)
    51                 .writeAll();
    53                 .writeAll();
    52 
    54 
    53         new ModuleInfoTest().test(outdir.resolve("module-info.class"), "module-info.java");
    55         new ModuleInfoTest().test(outdir.resolve("module-info.class"), "module-info.java");
    54     }
    56     }
    55 }
    57 }