8162576: Missing doclint check missing for modules
authorsadayapalam
Wed, 17 Aug 2016 10:34:48 +0530
changeset 40507 4413083331c7
parent 40506 258ad5fd9b57
child 40508 74ef30d16fb9
8162576: Missing doclint check missing for modules Reviewed-by: jjg, ksrini Contributed-by: lance.andersen@oracle.com, srikanth.adayapalam@oracle.com
langtools/src/java.compiler/share/classes/module-info.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java
langtools/src/jdk.compiler/share/classes/module-info.java
langtools/src/jdk.javadoc/share/classes/module-info.java
langtools/src/jdk.jdeps/share/classes/module-info.java
langtools/test/tools/doclint/moduleTests/bad/module-info.java
langtools/test/tools/doclint/moduleTests/bad/module-info.javac.out
langtools/test/tools/doclint/moduleTests/bad/module-info.out
langtools/test/tools/doclint/moduleTests/good/module-info.java
--- a/langtools/src/java.compiler/share/classes/module-info.java	Tue Aug 16 10:57:13 2016 -0700
+++ b/langtools/src/java.compiler/share/classes/module-info.java	Wed Aug 17 10:34:48 2016 +0530
@@ -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;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java	Tue Aug 16 10:57:13 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java	Wed Aug 17 10:34:48 2016 +0530
@@ -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 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;
@@ -406,6 +407,12 @@
         }
 
         @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());
             return super.visitVariable(tree, ignore);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java	Tue Aug 16 10:57:13 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java	Wed Aug 17 10:34:48 2016 +0530
@@ -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 @@
         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()));
             }
         }
--- a/langtools/src/jdk.compiler/share/classes/module-info.java	Tue Aug 16 10:57:13 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/module-info.java	Wed Aug 17 10:34:48 2016 +0530
@@ -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;
 
--- a/langtools/src/jdk.javadoc/share/classes/module-info.java	Tue Aug 16 10:57:13 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/module-info.java	Wed Aug 17 10:34:48 2016 +0530
@@ -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;
--- a/langtools/src/jdk.jdeps/share/classes/module-info.java	Tue Aug 16 10:57:13 2016 -0700
+++ b/langtools/src/jdk.jdeps/share/classes/module-info.java	Wed Aug 17 10:34:48 2016 +0530
@@ -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;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/moduleTests/bad/module-info.java	Wed Aug 17 10:34:48 2016 +0530
@@ -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 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/moduleTests/bad/module-info.javac.out	Wed Aug 17 10:34:48 2016 +0530
@@ -0,0 +1,4 @@
+module-info.java:13:1: compiler.warn.proc.messager: no comment
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/moduleTests/bad/module-info.out	Wed Aug 17 10:34:48 2016 +0530
@@ -0,0 +1,4 @@
+module-info.java:13: warning: no comment
+module bad {
+^
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/moduleTests/good/module-info.java	Wed Aug 17 10:34:48 2016 +0530
@@ -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 {
+}