gpt4 book ai didi

java - javap -v 中的 "Signature"是什么

转载 作者:行者123 更新时间:2023-11-30 08:30:40 27 4
gpt4 key购买 nike

使用 javap -v,我得到如下输出:

Classfile /C:/temp/classcompare/PartnerRolle.class
Last modified 09.12.2016; size 2880 bytes
MD5 checksum 2deeeaa2734ac86f673bba871c05a997
Compiled from "PartnerRolle.java"
public final class de.continentale.vs.common.model.enums.PartnerRolle extends java.lang.Enum<de.continentale.vs.common.model.enums.PartnerRolle>
Signature: #110 // Ljava/lang/Enum<Lde/continentale/vs/common/model/enums/PartnerRolle;>;
SourceFile: "PartnerRolle.java"
minor version: 0
major version: 51
flags: ACC_PUBLIC, ACC_FINAL, ACC_SUPER, ACC_ENUM

“签名 #110”是什么意思?

背景:在使用 Ant 和 Maven(相同的 Java 版本)进行编译时,我得到了相同 Java 源代码的不同类文件。我正在尝试找出原因。

最佳答案

javap -v 等同于 javap -verbose

类文件格式在 JVM 规范中定义。如果你看部分 4.7.9. The signature attribute你会找到 Signature

的定义

The Signature attribute is a fixed-length attribute in the attributes table of a ClassFile, field_info, or method_info structure. A Signature attribute records a signature for a class, interface, constructor, method, or field whose declaration in the Java programming language uses type variables or parameterized types. [...]

The Signature attribute has the following format:

Signature_attribute { u2 attribute_name_index; u4 attribute_length; u2 signature_index; }

The items of the Signature_attribute structure are as follows:

attribute_name_index

The value of the attribute_name_index item must be a valid index into the constant_pool table. The constant_pool entry at that index must be a CONSTANT_Utf8_info structure (§4.4.7) representing the string "Signature".

attribute_length

The value of the attribute_length item of a Signature_attribute structure must be two.

signature_index

The value of the signature_index item must be a valid index into the constant_pool table. The constant_pool entry at that index must be a CONSTANT_Utf8_info structure (§4.4.7) representing a class signature if this Signature attribute is an attribute of a ClassFile structure; a method signature if this Signature attribute is an attribute of a method_info structure; or a field signature otherwise.

Signature #110 表示您的签名存储在常量池表中的索引 110 处。

关于java - javap -v 中的 "Signature"是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41059979/

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