gpt4 book ai didi

java - 解释 java.lang.NoSuchMethodError 消息

转载 作者:太空宇宙 更新时间:2023-11-04 10:59:11 25 4
gpt4 key购买 nike

我收到以下运行时错误消息(以及堆栈跟踪的第一行,它指向第 94 行)。我试图弄清楚为什么它说不存在这样的方法。

java.lang.NoSuchMethodError: 
com.sun.tools.doclets.formats.html.SubWriterHolderWriter.printDocLinkForMenu(
ILcom/sun/javadoc/ClassDoc;Lcom/sun/javadoc/MemberDoc;
Ljava/lang/String;Z)Ljava/lang/String;
at com.sun.tools.doclets.formats.html.AbstractExecutableMemberWriter.writeSummaryLink(
AbstractExecutableMemberWriter.java:94)

writeSummaryLink 的第 94 行如下所示。

问题
“ILcom”或“Z”是什么意思?
为什么括号里有四种类型 (ILcom/sun/javadoc/ClassDoc;Lcom/sun/javadoc/MemberDoc;Ljava/lang/String;Z)以及括号后的一位 Ljava/lang/字符串;当 printDocLinkForMenu 方法明显有五个参数时?

代码详细信息
writeSummaryLink方法是:

protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
String name = emd.name();
writer.strong();
writer.printDocLinkForMenu(context, cd, (MemberDoc) emd, name, false); // 94
writer.strongEnd();
writer.displayLength = name.length();
writeParameters(emd, false);
}

这是第 94 行正在调用的方法:

public void printDocLinkForMenu(int context, ClassDoc classDoc, MemberDoc doc,
String label, boolean strong) {
String docLink = getDocLink(context, classDoc, doc, label, strong);
print(deleteParameterAnchors(docLink));
}

最佳答案

来自section 4.3.2 JVM 规范:

Character     Type          Interpretation------------------------------------------B             byte          signed byteC             char          Unicode characterD             double        double-precision floating-point valueF             float         single-precision floating-point valueI             int           integerJ             long          long integerL<classname>; reference     an instance of class S             short         signed shortZ             boolean       true or false[             reference     one array dimension

From section 4.3.3, Method descriptors:

A method descriptor represents the parameters that the method takes and the value that it returns:

MethodDescriptor:
( ParameterDescriptor* ) ReturnDescriptor

因此,

(ILcom/sun/javadoc/ClassDoc;Lcom/sun/javadoc/MemberDoc;Ljava/lang/String;Z)
Ljava/lang/String;

翻译为:

intClassDocMemberDocStringboolean 作为参数的方法,并返回 String。请注意,只有引用参数才用分号分隔,因为分号是其字符表示的一部分。

<小时/>

所以,总结一下:

Why there are four types in parentheses (ILcom/sun/javadoc/ClassDoc;Lcom/sun/javadoc/MemberDoc;Ljava/lang/String;Z) and one after the parentheses Ljava/lang/String; when the method printDocLinkForMenu clearly has five parameters?

有五个参数(int、ClassDoc、MemberDoc、String、boolean)和一个返回类型(String)。

关于java - 解释 java.lang.NoSuchMethodError 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47092959/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com