--- a/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java Wed Jul 17 19:12:03 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java Wed Jul 17 19:16:12 2013 -0700
@@ -30,9 +30,10 @@
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
-import java.util.regex.Pattern;
import javax.lang.model.element.Name;
+import javax.tools.Diagnostic;
+import javax.tools.JavaFileObject;
import javax.tools.StandardLocation;
import com.sun.source.doctree.DocCommentTree;
@@ -151,6 +152,18 @@
TreePath p = getCurrentPath();
DocCommentTree dc = env.trees.getDocCommentTree(p);
+ if (p.getLeaf() == p.getCompilationUnit()) {
+ JavaFileObject fo = p.getCompilationUnit().getSourceFile();
+ boolean pkgInfo = fo.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE);
+ if (!pkgInfo) {
+ if (dc == null)
+ return;
+ env.setCurrent(p, dc);
+ env.messages.report(Messages.Group.REFERENCE, Diagnostic.Kind.WARNING, p.getLeaf(),
+ "dc.unexpected.comment");
+ }
+ }
+
checker.scan(dc, p);
}
};
@@ -166,8 +179,8 @@
}
void processArgs(String... args) throws BadArgs {
- javacOpts = new ArrayList<String>();
- javacFiles = new ArrayList<File>();
+ javacOpts = new ArrayList<>();
+ javacFiles = new ArrayList<>();
if (args.length == 0)
needHelp = true;
@@ -214,7 +227,7 @@
}
List<File> splitPath(String path) {
- List<File> files = new ArrayList<File>();
+ List<File> files = new ArrayList<>();
for (String f: path.split(File.pathSeparator)) {
if (f.length() > 0)
files.add(new File(f));
@@ -279,7 +292,6 @@
TaskListener tl = new TaskListener() {
@Override
public void started(TaskEvent e) {
- return;
}
@Override