fix ‘String index out of range: -1’ (issue #3) in classRelativeIdentifier()

This commit is contained in:
stfm
2017-11-24 09:32:26 +01:00
parent 507b9092be
commit 44253ec6ba

View File

@@ -2135,7 +2135,9 @@ public class TeXDoclet extends Doclet {
* The identifier to be made relative. * The identifier to be made relative.
*/ */
static String classRelativeIdentifier(ClassDoc doc, String str) { static String classRelativeIdentifier(ClassDoc doc, String str) {
if (str.startsWith(doc.name())) { if (str.equals(doc.name())) {
return "";
} else if (str.startsWith(doc.name())) {
// This is a member or a method of the same class // This is a member or a method of the same class
return str.substring(doc.name().length() + 1); return str.substring(doc.name().length() + 1);
} else if (str.startsWith(doc.containingPackage().name())) { } else if (str.startsWith(doc.containingPackage().name())) {