Fri, 05 Aug 2011 19:41:05 -0700
7064544: (javadoc) miscellaneous fixes requested by netbeans
Summary: Contributed by netbeans team, modified to suit by the langtools team.
Reviewed-by: jjg, bpatel
1.1 --- a/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Fri Aug 05 15:57:59 2011 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Fri Aug 05 19:41:05 2011 -0700 1.3 @@ -744,17 +744,16 @@ 1.4 // search inner classes 1.5 //### Add private entry point to avoid creating array? 1.6 //### Replicate code in innerClasses here to avoid consing? 1.7 - ClassDoc innerClasses[] = innerClasses(); 1.8 - for (int i = 0; i < innerClasses.length; i++) { 1.9 - if (innerClasses[i].name().equals(className) || 1.10 - //### This is from original javadoc but it looks suspicious to me... 1.11 - //### I believe it is attempting to compensate for the confused 1.12 - //### convention of including the nested class qualifiers in the 1.13 - //### 'name' of the inner class, rather than the true simple name. 1.14 - innerClasses[i].name().endsWith(className)) { 1.15 - return innerClasses[i]; 1.16 + for (ClassDoc icd : innerClasses()) { 1.17 + if (icd.name().equals(className) || 1.18 + //### This is from original javadoc but it looks suspicious to me... 1.19 + //### I believe it is attempting to compensate for the confused 1.20 + //### convention of including the nested class qualifiers in the 1.21 + //### 'name' of the inner class, rather than the true simple name. 1.22 + icd.name().endsWith("." + className)) { 1.23 + return icd; 1.24 } else { 1.25 - ClassDoc innercd = ((ClassDocImpl) innerClasses[i]).searchClass(className); 1.26 + ClassDoc innercd = ((ClassDocImpl) icd).searchClass(className); 1.27 if (innercd != null) { 1.28 return innercd; 1.29 }
2.1 --- a/src/share/classes/com/sun/tools/javadoc/Comment.java Fri Aug 05 15:57:59 2011 -0700 2.2 +++ b/src/share/classes/com/sun/tools/javadoc/Comment.java Fri Aug 05 19:41:05 2011 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -25,10 +25,7 @@ 2.11 2.12 package com.sun.tools.javadoc; 2.13 2.14 -import java.util.Locale; 2.15 - 2.16 import com.sun.javadoc.*; 2.17 - 2.18 import com.sun.tools.javac.util.ListBuffer; 2.19 2.20 /** 2.21 @@ -115,7 +112,7 @@ 2.22 state = TAG_NAME; 2.23 } 2.24 break; 2.25 - }; 2.26 + } 2.27 if (ch == '\n') { 2.28 newLine = true; 2.29 } else if (!isWhite) { 2.30 @@ -134,7 +131,7 @@ 2.31 case IN_TEXT: 2.32 parseCommentComponent(tagName, textStart, lastNonWhite+1); 2.33 break; 2.34 - }; 2.35 + } 2.36 } 2.37 2.38 /** 2.39 @@ -396,16 +393,15 @@ 2.40 * else 2.41 * return -1. 2.42 */ 2.43 - private static int inlineTagFound(DocImpl holder, String inlinetext, int start) { 2.44 + private static int inlineTagFound(DocImpl holder, String inlinetext, int start) { 2.45 DocEnv docenv = holder.env; 2.46 - int linkstart; 2.47 - if (start == inlinetext.length() || 2.48 - (linkstart = inlinetext.indexOf("{@", start)) == -1) { 2.49 + int linkstart = inlinetext.indexOf("{@", start); 2.50 + if (start == inlinetext.length() || linkstart == -1) { 2.51 return -1; 2.52 - } else if(inlinetext.indexOf('}', start) == -1) { 2.53 + } else if (inlinetext.indexOf('}', linkstart) == -1) { 2.54 //Missing '}'. 2.55 docenv.warning(holder, "tag.Improper_Use_Of_Link_Tag", 2.56 - inlinetext.substring(linkstart, inlinetext.length())); 2.57 + inlinetext.substring(linkstart, inlinetext.length())); 2.58 return -1; 2.59 } else { 2.60 return linkstart; 2.61 @@ -425,6 +421,7 @@ 2.62 /** 2.63 * Return text for this Doc comment. 2.64 */ 2.65 + @Override 2.66 public String toString() { 2.67 return text; 2.68 }
3.1 --- a/src/share/classes/com/sun/tools/javadoc/JavadocEnter.java Fri Aug 05 15:57:59 2011 -0700 3.2 +++ b/src/share/classes/com/sun/tools/javadoc/JavadocEnter.java Fri Aug 05 19:41:05 2011 -0700 3.3 @@ -31,7 +31,6 @@ 3.4 import com.sun.tools.javac.code.Kinds; 3.5 import com.sun.tools.javac.code.Symbol.*; 3.6 import com.sun.tools.javac.comp.Enter; 3.7 -import com.sun.tools.javac.tree.JCTree; 3.8 import com.sun.tools.javac.tree.JCTree.*; 3.9 import javax.tools.JavaFileObject; 3.10 3.11 @@ -65,6 +64,7 @@ 3.12 final Messager messager; 3.13 final DocEnv docenv; 3.14 3.15 + @Override 3.16 public void main(List<JCCompilationUnit> trees) { 3.17 // count all Enter errors as warnings. 3.18 int nerrors = messager.nerrors; 3.19 @@ -73,6 +73,7 @@ 3.20 messager.nerrors = nerrors; 3.21 } 3.22 3.23 + @Override 3.24 public void visitTopLevel(JCCompilationUnit tree) { 3.25 super.visitTopLevel(tree); 3.26 if (tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE)) { 3.27 @@ -81,10 +82,11 @@ 3.28 } 3.29 } 3.30 3.31 + @Override 3.32 public void visitClassDef(JCClassDecl tree) { 3.33 super.visitClassDef(tree); 3.34 - if (tree.sym != null && tree.sym.kind == Kinds.TYP) { 3.35 - if (tree.sym == null) return; 3.36 + if (tree.sym == null) return; 3.37 + if (tree.sym.kind == Kinds.TYP || tree.sym.kind == Kinds.ERR) { 3.38 String comment = env.toplevel.docComments.get(tree); 3.39 ClassSymbol c = tree.sym; 3.40 docenv.makeClassDoc(c, comment, tree, env.toplevel.lineMap); 3.41 @@ -92,6 +94,7 @@ 3.42 } 3.43 3.44 /** Don't complain about a duplicate class. */ 3.45 + @Override 3.46 protected void duplicateClass(DiagnosticPosition pos, ClassSymbol c) {} 3.47 3.48 }
4.1 --- a/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java Fri Aug 05 15:57:59 2011 -0700 4.2 +++ b/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java Fri Aug 05 19:41:05 2011 -0700 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -23,9 +23,9 @@ 4.11 4.12 /* 4.13 * @test 4.14 - * @bug 4732864 6280605 4.15 + * @bug 4732864 6280605 7064544 4.16 * @summary Make sure that you can link from one member to another using 4.17 - * non-qualified name. 4.18 + * non-qualified name, furthermore, ensure the right one is linked. 4.19 * @author jamieh 4.20 * @library ../lib/ 4.21 * @build JavadocTester 4.22 @@ -36,7 +36,7 @@ 4.23 public class TestLinkTaglet extends JavadocTester { 4.24 4.25 //Test information. 4.26 - private static final String BUG_ID = "4732864-6280605"; 4.27 + private static final String BUG_ID = "4732864-6280605-7064544"; 4.28 4.29 //Javadoc arguments. 4.30 private static final String[] ARGS = new String[] {
5.1 --- a/test/com/sun/javadoc/testLinkTaglet/pkg/C.java Fri Aug 05 15:57:59 2011 -0700 5.2 +++ b/test/com/sun/javadoc/testLinkTaglet/pkg/C.java Fri Aug 05 19:41:05 2011 -0700 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -34,6 +34,11 @@ 5.11 public class C { 5.12 5.13 public InnerC MEMBER = new InnerC(); 5.14 + /** 5.15 + * A red herring inner class to confuse the matching, thus to 5.16 + * ensure the right one is linked. 5.17 + */ 5.18 + public class RedHerringInnerC {} 5.19 5.20 /** 5.21 * Link to member in outer class: {@link #MEMBER} <br/>