使用 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/