langtools/test/tools/javac/modules/DoclintOtherModules.java
changeset 36778 e04318f39f92
parent 36526 3b41f1c69604
child 37758 3ecf9b414e05
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.
    26  * @summary Verify that DocLint does not cause unnecessary (and potentially dangerous) implicit compilation
    26  * @summary Verify that DocLint does not cause unnecessary (and potentially dangerous) implicit compilation
    27  * @library /tools/lib
    27  * @library /tools/lib
    28  * @modules
    28  * @modules
    29  *      jdk.compiler/com.sun.tools.javac.api
    29  *      jdk.compiler/com.sun.tools.javac.api
    30  *      jdk.compiler/com.sun.tools.javac.main
    30  *      jdk.compiler/com.sun.tools.javac.main
    31  *      jdk.jdeps/com.sun.tools.javap
    31  * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
    32  * @build ToolBox ModuleTestBase
       
    33  * @run main DoclintOtherModules
    32  * @run main DoclintOtherModules
    34  */
    33  */
    35 
    34 
    36 import java.nio.file.Files;
    35 import java.nio.file.Files;
    37 import java.nio.file.Path;
    36 import java.nio.file.Path;
       
    37 
       
    38 import toolbox.JavacTask;
       
    39 import toolbox.Task;
       
    40 import toolbox.ToolBox;
    38 
    41 
    39 public class DoclintOtherModules extends ModuleTestBase {
    42 public class DoclintOtherModules extends ModuleTestBase {
    40 
    43 
    41     public static void main(String... args) throws Exception {
    44     public static void main(String... args) throws Exception {
    42         DoclintOtherModules t = new DoclintOtherModules();
    45         DoclintOtherModules t = new DoclintOtherModules();
    55                           "module m2 { requires m1; exports m2; }",
    58                           "module m2 { requires m1; exports m2; }",
    56                           "package m2; public class B extends Foo {} @Deprecated class Foo {}");
    59                           "package m2; public class B extends Foo {} @Deprecated class Foo {}");
    57         Path classes = base.resolve("classes");
    60         Path classes = base.resolve("classes");
    58         Files.createDirectories(classes);
    61         Files.createDirectories(classes);
    59 
    62 
    60         String log = tb.new JavacTask()
    63         String log = new JavacTask(tb)
    61                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString(), "-Xlint:deprecation", "-Xdoclint:-reference", "-Werror")
    64                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString(), "-Xlint:deprecation", "-Xdoclint:-reference", "-Werror")
    62                 .outdir(classes)
    65                 .outdir(classes)
    63                 .files(findJavaFiles(m1))
    66                 .files(findJavaFiles(m1))
    64                 .run(ToolBox.Expect.SUCCESS)
    67                 .run(Task.Expect.SUCCESS)
    65                 .writeAll()
    68                 .writeAll()
    66                 .getOutput(ToolBox.OutputKind.DIRECT);
    69                 .getOutput(Task.OutputKind.DIRECT);
    67 
    70 
    68         if (!log.isEmpty())
    71         if (!log.isEmpty())
    69             throw new Exception("expected output not found: " + log);
    72             throw new Exception("expected output not found: " + log);
    70     }
    73     }
    71 
    74