src/share/classes/com/sun/tools/doclint/DocLint.java

changeset 1913
1476d54fdc61
parent 1895
37031963493e
child 1915
129751018061
     1.1 --- a/src/share/classes/com/sun/tools/doclint/DocLint.java	Wed Jul 17 19:12:03 2013 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/doclint/DocLint.java	Wed Jul 17 19:16:12 2013 -0700
     1.3 @@ -30,9 +30,10 @@
     1.4  import java.io.PrintWriter;
     1.5  import java.util.ArrayList;
     1.6  import java.util.List;
     1.7 -import java.util.regex.Pattern;
     1.8  
     1.9  import javax.lang.model.element.Name;
    1.10 +import javax.tools.Diagnostic;
    1.11 +import javax.tools.JavaFileObject;
    1.12  import javax.tools.StandardLocation;
    1.13  
    1.14  import com.sun.source.doctree.DocCommentTree;
    1.15 @@ -151,6 +152,18 @@
    1.16                  TreePath p = getCurrentPath();
    1.17                  DocCommentTree dc = env.trees.getDocCommentTree(p);
    1.18  
    1.19 +                if (p.getLeaf() == p.getCompilationUnit()) {
    1.20 +                    JavaFileObject fo = p.getCompilationUnit().getSourceFile();
    1.21 +                    boolean pkgInfo = fo.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE);
    1.22 +                    if (!pkgInfo) {
    1.23 +                        if (dc == null)
    1.24 +                            return;
    1.25 +                        env.setCurrent(p, dc);
    1.26 +                        env.messages.report(Messages.Group.REFERENCE, Diagnostic.Kind.WARNING, p.getLeaf(),
    1.27 +                                "dc.unexpected.comment");
    1.28 +                    }
    1.29 +                }
    1.30 +
    1.31                  checker.scan(dc, p);
    1.32              }
    1.33          };
    1.34 @@ -166,8 +179,8 @@
    1.35      }
    1.36  
    1.37      void processArgs(String... args) throws BadArgs {
    1.38 -        javacOpts = new ArrayList<String>();
    1.39 -        javacFiles = new ArrayList<File>();
    1.40 +        javacOpts = new ArrayList<>();
    1.41 +        javacFiles = new ArrayList<>();
    1.42  
    1.43          if (args.length == 0)
    1.44              needHelp = true;
    1.45 @@ -214,7 +227,7 @@
    1.46      }
    1.47  
    1.48      List<File> splitPath(String path) {
    1.49 -        List<File> files = new ArrayList<File>();
    1.50 +        List<File> files = new ArrayList<>();
    1.51          for (String f: path.split(File.pathSeparator)) {
    1.52              if (f.length() > 0)
    1.53                  files.add(new File(f));
    1.54 @@ -279,7 +292,6 @@
    1.55              TaskListener tl = new TaskListener() {
    1.56                  @Override
    1.57                  public void started(TaskEvent e) {
    1.58 -                    return;
    1.59                  }
    1.60  
    1.61                  @Override

mercurial