解释java.lang.NoSuchMethodError消息 [英] Interpreting java.lang.NoSuchMethodError message

查看:124
本文介绍了解释java.lang.NoSuchMethodError消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I get the following runtime error message (along with the first line of the stack trace, which points to line 94). I'm trying to figure out why it says no such method exists.

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行如下所示。

Line 94 of writeSummaryLink is shown below.

问题

什么ILcom或Z是什么意思?

为什么括号中有四种类型
(ILcom / sun / javadoc / ClassDoc; Lcom / sun / javadoc / MemberDoc; Ljava / lang / String; Z)
和括号后面的一个
Ljava / lang / String;当方法printDocLinkForMenu显然有五个参数时

QUESTIONS
What does "ILcom" or "Z" mean?
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?

代码详细信息

writeSummaryLink方法是:

CODE DETAIL
The writeSummaryLink method is:

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));
}


推荐答案

来自第4.3.2节


Character     Type          Interpretation
------------------------------------------
B             byte          signed byte
C             char          Unicode character
D             double        double-precision floating-point value
F             float         single-precision floating-point value
I             int           integer
J             long          long integer
L<classname>; reference     an instance of class 
S             short         signed short
Z             boolean       true or false
[             reference     one array dimension

来自第4.3节。 3,方法描述符


方法描述符表示方法采用的参数及其返回的值:

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;

转换为:

int ClassDoc 的方法, MemberDoc String boolean 作为参数,以及返回字符串。请注意,只有参考参数用分号分隔,因为分号是其字符表示的一部分。

A method with int, ClassDoc, MemberDoc, String and boolean as parameters, and which returns a String. Note that only reference parameters are separated with a semicolon, since the semicolon is part of their character representation.

所以,总结一下:


为什么括号中有四种类型(ILcom / sun / javadoc / ClassDoc; Lcom / sun / javadoc / MemberDoc; Ljava / lang / String; Z)和一个括号后面的Ljava / lang / String;当方法printDocLinkForMenu显然有五个参数?

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)和一个返回type(String)。

There are five parameters (int, ClassDoc, MemberDoc, String, boolean) and one return type (String).

这篇关于解释java.lang.NoSuchMethodError消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆