8162576: Missing doclint check missing for modules

Co-authored-by: Lance Andersen <lance.andersen@oracle.com>
Reviewed-by: jjg, ksrini
This commit is contained in:
Srikanth Adayapalam 2016-08-17 10:34:48 +05:30
parent f8ab3f84a4
commit 6c2a33a67b
10 changed files with 87 additions and 3 deletions
langtools
src
java.compiler/share/classes
jdk.compiler/share/classes
jdk.javadoc/share/classes
jdk.jdeps/share/classes
test/tools/doclint/moduleTests

@ -23,6 +23,13 @@
* questions.
*/
/**
* Defines the Language Model, Annotation Processing, and Java Compiler APIs.
* <P>
* These APIs model declarations and types of the Java programming language,
* and define interfaces for tools such as compilers which can be invoked
* from a program.
*/
module java.compiler {
exports javax.annotation.processing;
exports javax.lang.model;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,6 +40,7 @@ import javax.tools.StandardLocation;
import com.sun.source.doctree.DocCommentTree;
import com.sun.source.tree.ClassTree;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.ModuleTree;
import com.sun.source.tree.PackageTree;
import com.sun.source.tree.MethodTree;
import com.sun.source.tree.Tree;
@ -405,6 +406,12 @@ public class DocLint implements Plugin {
return null;
}
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitModule(ModuleTree tree, Void ignore) {
visitDecl(tree, null);
return super.visitModule(tree, ignore);
}
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitVariable(VariableTree tree, Void ignore) {
visitDecl(tree, tree.getName());

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -210,7 +210,7 @@ public class Env {
AccessKind ak = AccessKind.PUBLIC;
for (TreePath p = path; p != null; p = p.getParentPath()) {
Element e = trees.getElement(p);
if (e != null && e.getKind() != ElementKind.PACKAGE) {
if (e != null && e.getKind() != ElementKind.PACKAGE && e.getKind() != ElementKind.MODULE) {
ak = min(ak, AccessKind.of(e.getModifiers()));
}
}

@ -23,6 +23,10 @@
* questions.
*/
/** Defines the implementation of the
* {@link javax.tools.ToolProvider#getSystemJavaCompiler system Java compiler}
* and its command line equivalent, <em>javac</em>, as well as <em>javah</em>.
*/
module jdk.compiler {
requires public java.compiler;

@ -23,6 +23,10 @@
* questions.
*/
/** Defines the implementation of the
* {@link javax.tools.ToolProvider#getSystemDocumentationTool system documentation tool}
* and its command line equivalent, <em>javadoc</em>.
*/
module jdk.javadoc {
requires public java.compiler;
requires public jdk.compiler;

@ -23,6 +23,9 @@
* questions.
*/
/** Defines tools for analysing dependencies in Java libraries and programs, including
* the <em>jdeps</em> and <em>javap</em> tools.
*/
module jdk.jdeps {
requires java.base;
requires java.compiler;

@ -0,0 +1,14 @@
/*
* @test /nodynamiccopyright/
* @bug 8162576
* @summary Missing doclint check missing for modules
* @library ../..
* @modules jdk.compiler/com.sun.tools.doclint
* @build DocLintTester
* @run main DocLintTester -ref module-info.out module-info.java
* @compile/fail/ref=module-info.javac.out -XDrawDiagnostics -Werror -Xdoclint:all module-info.java
*/
// missing doc comment
module bad {
}

@ -0,0 +1,4 @@
module-info.java:13:1: compiler.warn.proc.messager: no comment
- compiler.err.warnings.and.werror
1 error
1 warning

@ -0,0 +1,4 @@
module-info.java:13: warning: no comment
module bad {
^
1 warning

@ -0,0 +1,37 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8162576
* @summary Missing doclint check missing for modules
* @library ../..
* @modules jdk.compiler/com.sun.tools.doclint
* @build DocLintTester
* @run main DocLintTester module-info.java
* @compile -Xdoclint:all -Werror module-info.java
*/
/** good module */
module good {
}