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
|
||||
//### Add private entry point to avoid creating array?
|
||||
//### Replicate code in innerClasses here to avoid consing?
|
||||
ClassDoc innerClasses[] = innerClasses();
|
||||
for (int i = 0; i < innerClasses.length; i++) {
|
||||
if (innerClasses[i].name().equals(className) ||
|
||||
//### This is from original javadoc but it looks suspicious to me...
|
||||
//### I believe it is attempting to compensate for the confused
|
||||
//### convention of including the nested class qualifiers in the
|
||||
//### 'name' of the inner class, rather than the true simple name.
|
||||
innerClasses[i].name().endsWith(className)) {
|
||||
return innerClasses[i];
|
||||
for (ClassDoc icd : innerClasses()) {
|
||||
if (icd.name().equals(className) ||
|
||||
//### This is from original javadoc but it looks suspicious to me...
|
||||
//### I believe it is attempting to compensate for the confused
|
||||
//### convention of including the nested class qualifiers in the
|
||||
//### 'name' of the inner class, rather than the true simple name.
|
||||
icd.name().endsWith("." + className)) {
|
||||
return icd;
|
||||
} else {
|
||||
ClassDoc innercd = ((ClassDocImpl) innerClasses[i]).searchClass(className);
|
||||
ClassDoc innercd = ((ClassDocImpl) icd).searchClass(className);
|
||||
if (innercd != null) {
|
||||
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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -25,10 +25,7 @@
|
|||
|
||||
package com.sun.tools.javadoc;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
import com.sun.tools.javac.util.ListBuffer;
|
||||
|
||||
/**
|
||||
|
@ -115,7 +112,7 @@ class Comment {
|
|||
state = TAG_NAME;
|
||||
}
|
||||
break;
|
||||
};
|
||||
}
|
||||
if (ch == '\n') {
|
||||
newLine = true;
|
||||
} else if (!isWhite) {
|
||||
|
@ -134,7 +131,7 @@ class Comment {
|
|||
case IN_TEXT:
|
||||
parseCommentComponent(tagName, textStart, lastNonWhite+1);
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -396,16 +393,15 @@ class Comment {
|
|||
* else
|
||||
* 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;
|
||||
int linkstart;
|
||||
if (start == inlinetext.length() ||
|
||||
(linkstart = inlinetext.indexOf("{@", start)) == -1) {
|
||||
int linkstart = inlinetext.indexOf("{@", start);
|
||||
if (start == inlinetext.length() || linkstart == -1) {
|
||||
return -1;
|
||||
} else if(inlinetext.indexOf('}', start) == -1) {
|
||||
} else if (inlinetext.indexOf('}', linkstart) == -1) {
|
||||
//Missing '}'.
|
||||
docenv.warning(holder, "tag.Improper_Use_Of_Link_Tag",
|
||||
inlinetext.substring(linkstart, inlinetext.length()));
|
||||
inlinetext.substring(linkstart, inlinetext.length()));
|
||||
return -1;
|
||||
} else {
|
||||
return linkstart;
|
||||
|
@ -425,6 +421,7 @@ class Comment {
|
|||
/**
|
||||
* Return text for this Doc comment.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
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.Symbol.*;
|
||||
import com.sun.tools.javac.comp.Enter;
|
||||
import com.sun.tools.javac.tree.JCTree;
|
||||
import com.sun.tools.javac.tree.JCTree.*;
|
||||
import javax.tools.JavaFileObject;
|
||||
|
||||
|
@ -65,6 +64,7 @@ public class JavadocEnter extends Enter {
|
|||
final Messager messager;
|
||||
final DocEnv docenv;
|
||||
|
||||
@Override
|
||||
public void main(List<JCCompilationUnit> trees) {
|
||||
// count all Enter errors as warnings.
|
||||
int nerrors = messager.nerrors;
|
||||
|
@ -73,6 +73,7 @@ public class JavadocEnter extends Enter {
|
|||
messager.nerrors = nerrors;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitTopLevel(JCCompilationUnit tree) {
|
||||
super.visitTopLevel(tree);
|
||||
if (tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE)) {
|
||||
|
@ -81,10 +82,11 @@ public class JavadocEnter extends Enter {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitClassDef(JCClassDecl 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);
|
||||
ClassSymbol c = tree.sym;
|
||||
docenv.makeClassDoc(c, comment, tree, env.toplevel.lineMap);
|
||||
|
@ -92,6 +94,7 @@ public class JavadocEnter extends Enter {
|
|||
}
|
||||
|
||||
/** Don't complain about a duplicate class. */
|
||||
@Override
|
||||
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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -23,9 +23,9 @@
|
|||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4732864 6280605
|
||||
* @bug 4732864 6280605 7064544
|
||||
* @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
|
||||
* @library ../lib/
|
||||
* @build JavadocTester
|
||||
|
@ -36,7 +36,7 @@
|
|||
public class TestLinkTaglet extends JavadocTester {
|
||||
|
||||
//Test information.
|
||||
private static final String BUG_ID = "4732864-6280605";
|
||||
private static final String BUG_ID = "4732864-6280605-7064544";
|
||||
|
||||
//Javadoc arguments.
|
||||
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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -34,6 +34,11 @@ package pkg;
|
|||
public class C {
|
||||
|
||||
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/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue