8007610: javadoc doclint does not work with -private
authorjjg
Fri, 08 Feb 2013 17:35:16 -0800
changeset 15713 55f55d4f5f9f
parent 15712 fa256e8cfe33
child 15714 d9a83ab62853
8007610: javadoc doclint does not work with -private Reviewed-by: darcy
langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java
langtools/test/com/sun/javadoc/T6735320/T6735320.java
langtools/test/tools/javadoc/doclint/DocLintTest.java
--- a/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Fri Feb 08 09:21:19 2013 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Fri Feb 08 17:35:16 2013 -0800
@@ -801,7 +801,9 @@
             doclintOpts.add(opt == null ? DocLint.XMSGS_OPTION : DocLint.XMSGS_CUSTOM_PREFIX + opt);
         }
 
-        if (doclintOpts.size() == 1
+        if (doclintOpts.isEmpty()) {
+            doclintOpts.add(DocLint.XMSGS_OPTION);
+        } else if (doclintOpts.size() == 1
                 && doclintOpts.get(0).equals(DocLint.XMSGS_CUSTOM_PREFIX + "none")) {
             return;
         }
--- a/langtools/test/com/sun/javadoc/T6735320/T6735320.java	Fri Feb 08 09:21:19 2013 +0000
+++ b/langtools/test/com/sun/javadoc/T6735320/T6735320.java	Fri Feb 08 17:35:16 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, 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
@@ -47,8 +47,8 @@
 
     public static void main(String... args) {
         T6735320 tester = new T6735320();
-        if (tester.runJavadoc(ARGS) != 0) {
-            throw new AssertionError("non-zero return code from javadoc");
+        if (tester.runJavadoc(ARGS) == 0) {
+            throw new AssertionError("zero return code from javadoc");
         }
         if (tester.getErrorOutput().contains("StringIndexOutOfBoundsException")) {
             throw new AssertionError("javadoc threw StringIndexOutOfBoundsException");
--- a/langtools/test/tools/javadoc/doclint/DocLintTest.java	Fri Feb 08 09:21:19 2013 +0000
+++ b/langtools/test/tools/javadoc/doclint/DocLintTest.java	Fri Feb 08 17:35:16 2013 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8004834
+ * @bug 8004834 8007610
  * @summary Add doclint support into javadoc
  */
 
@@ -157,6 +157,10 @@
                 Main.Result.OK,
                 EnumSet.of(Message.DL_WRN12));
 
+        test(Arrays.asList(rawDiags, "-private"),
+                Main.Result.ERROR,
+                EnumSet.of(Message.DL_ERR6, Message.DL_ERR9, Message.DL_WRN12));
+
         test(Arrays.asList(rawDiags, "-Xdoclint:syntax", "-private"),
                 Main.Result.ERROR,
                 EnumSet.of(Message.DL_ERR6, Message.DL_WRN12));