关于Class中的Signature属性
1、Signature属性:https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.9
2、ClassSignature、FieldTypeSignature、MethodTypeSignature说明:
https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.2-200
3、JLS:https://docs.oracle.com/javase/specs/index.html
举个例子,如下:
interface IA{} interface IB{} class CA{} class TP extends CA implements IA,IB{} class ParentClass<T>{} interface ParentIA{} interface ParentIB{} // 出现在ClassFile的attributes属性中的Signature属性 // <T:Lcom/test18/CA;:Lcom/test18/IA;:Lcom/test18/IB;E:TT;> // Lcom/test18/ParentClass<Ljava/lang/String;>; // Lcom/test18/ParentIA;Lcom/test18/ParentIB; public class TestClass<T extends CA&IA&IB,E extends T> extends ParentClass<String> implements ParentIA,ParentIB{ // 出现在methods属性的attributes的Signature属性 // <A:Lcom/test18/CA;:Lcom/test18/IA;:Lcom/test18/IB;B:TA;> // (TA;Ljava/util/List<+TB;>;) // V public <A extends CA&IA&IB,B extends A> void mymethod(A a,List<? extends B> list){ // 仅出现在常量池中,为什么? // Ljava/util/List<Ljava/io/InputStream;>; List<InputStream> x = null; // Ljava/util/List<-Ljava/io/InputStream;>; List<? super InputStream> y = null; } }
通过javap -verbose TestClass查看Class文件的结构:
Classfile /C:/TestClass.class Last modified 2018-7-5; size 1058 bytes MD5 checksum d9dc89733c2ea9a57bbced4b4c20f998 Compiled from "TestClass.java" public class com.test18.TestClass<T extends com.test18.CA & com.test18.IA & com.test18.IB, E extends T> extends com.test18.ParentClass<java.lang.String> implements com.test18.ParentIA, com.test18.ParentIB Signature: #29 // <T:Lcom/test18/CA;:Lcom/test18/IA;:Lcom/test18/IB;E:TT;>Lcom/test18/ParentClass<Ljava/lang/String;>;Lcom/test18/ParentIA;Lcom/test18/ParentIB; SourceFile: "TestClass.java" minor version: 0 major version: 51 flags: ACC_PUBLIC, ACC_SUPER Constant pool: #1 = Methodref #3.#32 // com/test18/ParentClass."<init>":()V #2 = Class #33 // com/test18/TestClass #3 = Class #34 // com/test18/ParentClass #4 = Class #35 // com/test18/ParentIA #5 = Class #36 // com/test18/ParentIB #6 = Utf8 <init> #7 = Utf8 ()V #8 = Utf8 Code #9 = Utf8 LineNumberTable #10 = Utf8 LocalVariableTable #11 = Utf8 this #12 = Utf8 Lcom/test18/TestClass; #13 = Utf8 LocalVariableTypeTable #14 = Utf8 Lcom/test18/TestClass<TT;TE;>; #15 = Utf8 mymethod #16 = Utf8 (Lcom/test18/CA;Ljava/util/List;)V #17 = Utf8 a #18 = Utf8 Lcom/test18/CA; #19 = Utf8 list #20 = Utf8 Ljava/util/List; #21 = Utf8 x #22 = Utf8 y #23 = Utf8 TA; #24 = Utf8 Ljava/util/List<+TB;>; #25 = Utf8 Ljava/util/List<Ljava/io/InputStream;>; #26 = Utf8 Ljava/util/List<-Ljava/io/InputStream;>; #27 = Utf8 Signature #28 = Utf8 <A:Lcom/test18/CA;:Lcom/test18/IA;:Lcom/test18/IB;B:TA;>(TA;Ljava/util/List<+TB;>;)V #29 = Utf8 <T:Lcom/test18/CA;:Lcom/test18/IA;:Lcom/test18/IB;E:TT;>Lcom/test18/ParentClass<Ljava/lang/String;>;Lcom/test18/ParentIA;Lcom/test18/ParentIB; #30 = Utf8 SourceFile #31 = Utf8 TestClass.java #32 = NameAndType #6:#7 // "<init>":()V #33 = Utf8 com/test18/TestClass #34 = Utf8 com/test18/ParentClass #35 = Utf8 com/test18/ParentIA #36 = Utf8 com/test18/ParentIB { public com.test18.TestClass(); flags: ACC_PUBLIC Code: stack=1, locals=1, args_size=1 0: aload_0 1: invokespecial #1 // Method com/test18/ParentClass."<init>":()V 4: return LineNumberTable: line 53: 0 LocalVariableTable: Start Length Slot Name Signature 0 5 0 this Lcom/test18/TestClass; LocalVariableTypeTable: Start Length Slot Name Signature 0 5 0 this Lcom/test18/TestClass<TT;TE;>; public <A extends com/test18/CA & com/test18/IA & com/test18/IB, B extends A> void mymethod(A, java.util.List<? extends B>); flags: ACC_PUBLIC Code: stack=1, locals=5, args_size=3 0: aconst_null 1: astore_3 2: aconst_null 3: astore 4 5: return LineNumberTable: line 60: 0 line 61: 2 line 62: 5 LocalVariableTable: Start Length Slot Name Signature 0 6 0 this Lcom/test18/TestClass; 0 6 1 a Lcom/test18/CA; 0 6 2 list Ljava/util/List; 2 4 3 x Ljava/util/List; 5 1 4 y Ljava/util/List; LocalVariableTypeTable: Start Length Slot Name Signature 0 6 0 this Lcom/test18/TestClass<TT;TE;>; 0 6 1 a TA; 0 6 2 list Ljava/util/List<+TB;>; 2 4 3 x Ljava/util/List<Ljava/io/InputStream;>; 5 1 4 y Ljava/util/List<-Ljava/io/InputStream;>; Signature: #28 // <A:Lcom/test18/CA;:Lcom/test18/IA;:Lcom/test18/IB;B:TA;>(TA;Ljava/util/List<+TB;>;)V }
关于Class中的Signature属性的更多相关文章
- 在实体对象中访问导航属性里的属性值出现异常“There is already an open DataReader associated with this Command which must be closed first”
在实体对象中访问导航属性里的属性值出现异常“There is already an open DataReader associated with this Command which must be ...
- 借助JavaScript中的Dom属性改变Html中Table边框的颜色
借助JavaScript中的Dom属性改变Html中Table边框的颜色 -------------------- <html> <head> <title>我是页 ...
- CSS 中关于background 属性功能
background 是 css中的核心属性,我们对他应该充分了解. background-image 定义背景图像 这个属性是我们用的最多的属性 设置背景图像有两个方式 background: ...
- android中xml tools属性详解
第一部分 安卓开发中,在写布局代码的时候,ide可以看到布局的预览效果. 但是有些效果则必须在运行之后才能看见,比如这种情况:TextView在xml中没有设置任何字符,而是在activity中设置了 ...
- echarts中显示效果option中必有的属性
写一个最简单的效果让option中不可缺少的属性. var option = { xAxis:[ //x轴,数组对象,其下至少有一个对象 {.....} ], yAxis:[//y轴,数组对象,其下可 ...
- Vue - 在v-repeat中使用计算属性
1.从后端获取JSON数据集合后,对单条数据应用计算属性,在Vue.js 0.12版本之前可以在v-repeat所在元素上使用v-component指令 在Vue.js 0.12版本之后使用自定义元素 ...
- DataGrid中的常用属性
DataGrid中的常用属性 $('#dg').datagrid({ url:'datagrid_data.json', columns:[[ {field:'code',title:'Code',w ...
- meta标签中的http-equiv属性使用介绍(转载)
meta是html语言head区的一个辅助性标签.也许你认为这些代码可有可无.其实如果你能够用好meta标签,会给你带来意想不到的效果,meta标签的作用有:搜索引擎优化(SEO),定义页面使用语言, ...
- Don’t Use Accessor Methods in Initializer Methods and dealloc 【初始化和dealloc方法中不要调用属性的存取方法,而要直接调用 _实例变量】
1.问题: 在dealloc方法中使用[self.xxx release]和[xxx release]的区别? 用Xcode的Analyze分析我的Project,会列出一堆如下的提示:Inco ...
随机推荐
- sqlite3数据库,增删改查
搜索libsql //由于文件读写,归档,NSUserDefault,做持久存储的时候,是一个覆盖的过程,效率太低,更多的时候使用数据库来做持久化存储 //鉴于手机的硬件配置,使用轻量 ...
- 阿里Sophix热修复
阿里巴巴对Android热修复技术已经进行了长达多年的探索. 最开始,是手淘基于Xposed进行了改进,产生了针对Android Dalvik虚拟机运行时的Java Method Hook技术,Dex ...
- hdu 4995 离线处理+模拟
http://acm.hdu.edu.cn/showproblem.php?pid=4995 给定一维坐标下的n个点,以及每个点的权值,有m次查询,每次将查询的x点上的权值修改为离x最近的k个点权值的 ...
- 17、docker多机网络通信overlay
理论上来说多台宿主机之间的docker容器之间是无法通讯的,但是多台宿主机之间的docker容器之间是可以通讯的,主要是通过VXLAN技术来实现的. GitHub上对于docker-overl ...
- java实现WC项目
个人项目:WC wc.exe 是一个常见的工具,它能统计文本文件的字符数.单词数和行数.这个项目要求写一个命令行程序,模仿已有wc.exe 的功能,并加以扩充,给出某程序设计语言源文件的字符数.单 ...
- eclipse中java build path下 allow output folders for source folders 无法勾选,该如何解决 eclipse中java build path下 allow output folders for source folders 无法勾选,
在创建maven工程时,在设置output folders时,总是勾选以后,老是自动恢复到原来的状态,对比其他的maven的工程发现是在创建maven时候选择的项目为pom,而不是war或者jar,将 ...
- R12_专题知识总结提炼-AP模块
应付模块业务操作流程 供应商管理 供应商概述 在您使用 Oracle Purchasing 之前,需要定义供应商.供应商site,以及供应商联系人, 供应商主数据(SUPPLIER MASTER D ...
- Oracle SQL Trace 和 10046 事件
http://blog.csdn.net/tianlesoftware/article/details/5857023 一. SQL_TRACE 当SQL语句出现性能问题时,我们可以用SQL_TRAC ...
- 【算法33】LRU算法
题目来源 LeetCode: https://leetcode.com/problems/lru-cache/ LRU简介 LRU (Least Recently Used,最近最少使用)算法是操作系 ...
- 【转】Swig Getting Started
Installation Via NPM: $ npm install swig --save Basic Usage Swig has multiple ways to compile and re ...