mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
7064544: (javadoc) miscellaneous fixes requested by netbeans
Contributed by netbeans team, modified to suit by the langtools team. Reviewed-by: jjg, bpatel
This commit is contained in:
parent
4cd6c8c31e
commit
8b16f518cb
5 changed files with 34 additions and 30 deletions
|
@ -744,17 +744,16 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
|
||||||
// search inner classes
|
// search inner classes
|
||||||
//### Add private entry point to avoid creating array?
|
//### Add private entry point to avoid creating array?
|
||||||
//### Replicate code in innerClasses here to avoid consing?
|
//### Replicate code in innerClasses here to avoid consing?
|
||||||
ClassDoc innerClasses[] = innerClasses();
|
for (ClassDoc icd : innerClasses()) {
|
||||||
for (int i = 0; i < innerClasses.length; i++) {
|
if (icd.name().equals(className) ||
|
||||||
if (innerClasses[i].name().equals(className) ||
|
//### This is from original javadoc but it looks suspicious to me...
|
||||||
//### This is from original javadoc but it looks suspicious to me...
|
//### I believe it is attempting to compensate for the confused
|
||||||
//### I believe it is attempting to compensate for the confused
|
//### convention of including the nested class qualifiers in the
|
||||||
//### convention of including the nested class qualifiers in the
|
//### 'name' of the inner class, rather than the true simple name.
|
||||||
//### 'name' of the inner class, rather than the true simple name.
|
icd.name().endsWith("." + className)) {
|
||||||
innerClasses[i].name().endsWith(className)) {
|
return icd;
|
||||||
return innerClasses[i];
|
|
||||||
} else {
|
} else {
|
||||||
ClassDoc innercd = ((ClassDocImpl) innerClasses[i]).searchClass(className);
|
ClassDoc innercd = ((ClassDocImpl) icd).searchClass(className);
|
||||||
if (innercd != null) {
|
if (innercd != null) {
|
||||||
return innercd;
|
return innercd;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,10 +25,7 @@
|
||||||
|
|
||||||
package com.sun.tools.javadoc;
|
package com.sun.tools.javadoc;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import com.sun.javadoc.*;
|
import com.sun.javadoc.*;
|
||||||
|
|
||||||
import com.sun.tools.javac.util.ListBuffer;
|
import com.sun.tools.javac.util.ListBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,7 +112,7 @@ class Comment {
|
||||||
state = TAG_NAME;
|
state = TAG_NAME;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
if (ch == '\n') {
|
if (ch == '\n') {
|
||||||
newLine = true;
|
newLine = true;
|
||||||
} else if (!isWhite) {
|
} else if (!isWhite) {
|
||||||
|
@ -134,7 +131,7 @@ class Comment {
|
||||||
case IN_TEXT:
|
case IN_TEXT:
|
||||||
parseCommentComponent(tagName, textStart, lastNonWhite+1);
|
parseCommentComponent(tagName, textStart, lastNonWhite+1);
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -396,16 +393,15 @@ class Comment {
|
||||||
* else
|
* else
|
||||||
* return -1.
|
* return -1.
|
||||||
*/
|
*/
|
||||||
private static int inlineTagFound(DocImpl holder, String inlinetext, int start) {
|
private static int inlineTagFound(DocImpl holder, String inlinetext, int start) {
|
||||||
DocEnv docenv = holder.env;
|
DocEnv docenv = holder.env;
|
||||||
int linkstart;
|
int linkstart = inlinetext.indexOf("{@", start);
|
||||||
if (start == inlinetext.length() ||
|
if (start == inlinetext.length() || linkstart == -1) {
|
||||||
(linkstart = inlinetext.indexOf("{@", start)) == -1) {
|
|
||||||
return -1;
|
return -1;
|
||||||
} else if(inlinetext.indexOf('}', start) == -1) {
|
} else if (inlinetext.indexOf('}', linkstart) == -1) {
|
||||||
//Missing '}'.
|
//Missing '}'.
|
||||||
docenv.warning(holder, "tag.Improper_Use_Of_Link_Tag",
|
docenv.warning(holder, "tag.Improper_Use_Of_Link_Tag",
|
||||||
inlinetext.substring(linkstart, inlinetext.length()));
|
inlinetext.substring(linkstart, inlinetext.length()));
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return linkstart;
|
return linkstart;
|
||||||
|
@ -425,6 +421,7 @@ class Comment {
|
||||||
/**
|
/**
|
||||||
* Return text for this Doc comment.
|
* Return text for this Doc comment.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import com.sun.tools.javac.util.List;
|
||||||
import com.sun.tools.javac.code.Kinds;
|
import com.sun.tools.javac.code.Kinds;
|
||||||
import com.sun.tools.javac.code.Symbol.*;
|
import com.sun.tools.javac.code.Symbol.*;
|
||||||
import com.sun.tools.javac.comp.Enter;
|
import com.sun.tools.javac.comp.Enter;
|
||||||
import com.sun.tools.javac.tree.JCTree;
|
|
||||||
import com.sun.tools.javac.tree.JCTree.*;
|
import com.sun.tools.javac.tree.JCTree.*;
|
||||||
import javax.tools.JavaFileObject;
|
import javax.tools.JavaFileObject;
|
||||||
|
|
||||||
|
@ -65,6 +64,7 @@ public class JavadocEnter extends Enter {
|
||||||
final Messager messager;
|
final Messager messager;
|
||||||
final DocEnv docenv;
|
final DocEnv docenv;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void main(List<JCCompilationUnit> trees) {
|
public void main(List<JCCompilationUnit> trees) {
|
||||||
// count all Enter errors as warnings.
|
// count all Enter errors as warnings.
|
||||||
int nerrors = messager.nerrors;
|
int nerrors = messager.nerrors;
|
||||||
|
@ -73,6 +73,7 @@ public class JavadocEnter extends Enter {
|
||||||
messager.nerrors = nerrors;
|
messager.nerrors = nerrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void visitTopLevel(JCCompilationUnit tree) {
|
public void visitTopLevel(JCCompilationUnit tree) {
|
||||||
super.visitTopLevel(tree);
|
super.visitTopLevel(tree);
|
||||||
if (tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE)) {
|
if (tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE)) {
|
||||||
|
@ -81,10 +82,11 @@ public class JavadocEnter extends Enter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void visitClassDef(JCClassDecl tree) {
|
public void visitClassDef(JCClassDecl tree) {
|
||||||
super.visitClassDef(tree);
|
super.visitClassDef(tree);
|
||||||
if (tree.sym != null && tree.sym.kind == Kinds.TYP) {
|
if (tree.sym == null) return;
|
||||||
if (tree.sym == null) return;
|
if (tree.sym.kind == Kinds.TYP || tree.sym.kind == Kinds.ERR) {
|
||||||
String comment = env.toplevel.docComments.get(tree);
|
String comment = env.toplevel.docComments.get(tree);
|
||||||
ClassSymbol c = tree.sym;
|
ClassSymbol c = tree.sym;
|
||||||
docenv.makeClassDoc(c, comment, tree, env.toplevel.lineMap);
|
docenv.makeClassDoc(c, comment, tree, env.toplevel.lineMap);
|
||||||
|
@ -92,6 +94,7 @@ public class JavadocEnter extends Enter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Don't complain about a duplicate class. */
|
/** Don't complain about a duplicate class. */
|
||||||
|
@Override
|
||||||
protected void duplicateClass(DiagnosticPosition pos, ClassSymbol c) {}
|
protected void duplicateClass(DiagnosticPosition pos, ClassSymbol c) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -23,9 +23,9 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 4732864 6280605
|
* @bug 4732864 6280605 7064544
|
||||||
* @summary Make sure that you can link from one member to another using
|
* @summary Make sure that you can link from one member to another using
|
||||||
* non-qualified name.
|
* non-qualified name, furthermore, ensure the right one is linked.
|
||||||
* @author jamieh
|
* @author jamieh
|
||||||
* @library ../lib/
|
* @library ../lib/
|
||||||
* @build JavadocTester
|
* @build JavadocTester
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
public class TestLinkTaglet extends JavadocTester {
|
public class TestLinkTaglet extends JavadocTester {
|
||||||
|
|
||||||
//Test information.
|
//Test information.
|
||||||
private static final String BUG_ID = "4732864-6280605";
|
private static final String BUG_ID = "4732864-6280605-7064544";
|
||||||
|
|
||||||
//Javadoc arguments.
|
//Javadoc arguments.
|
||||||
private static final String[] ARGS = new String[] {
|
private static final String[] ARGS = new String[] {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -34,6 +34,11 @@ package pkg;
|
||||||
public class C {
|
public class C {
|
||||||
|
|
||||||
public InnerC MEMBER = new InnerC();
|
public InnerC MEMBER = new InnerC();
|
||||||
|
/**
|
||||||
|
* A red herring inner class to confuse the matching, thus to
|
||||||
|
* ensure the right one is linked.
|
||||||
|
*/
|
||||||
|
public class RedHerringInnerC {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Link to member in outer class: {@link #MEMBER} <br/>
|
* Link to member in outer class: {@link #MEMBER} <br/>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue