关于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 ...
随机推荐
- wordpaster更新说明
官方网站:http://www.ncmem.com/ 产品首页:http://www.ncmem.com/webapp/wordpaster/index.aspx 在线演示:FCKEditor2x示例 ...
- hdu1080 Human Gene Functions() 2016-05-24 14:43 65人阅读 评论(0) 收藏
Human Gene Functions Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- hdu2571 命运 2016-09-11 16:54 53人阅读 评论(0) 收藏
命运 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submiss ...
- Mongodb 存储日志信息
线上运行的服务会产生大量的运行及访问日志,日志里会包含一些错误.警告.及用户行为等信息,通常服务会以文本的形式记录日志信息,这样可读性强,方便于日常定位问题,但当产生大量的日志之后,要想从大量日志里挖 ...
- oracle只导出触发器
只要触发器,其他都不要 方法1:plsql develop调用exp:tools->export object—>trigger 方法2:select dbms_metadata.get_ ...
- bootstrap-treeview + angular 使用
bootstrap-treeview是什么 bootstrap-treeview是一款效果非常酷的基于bootstrap的jQuery多级列表树插件. 怎样使用bootstrap-treeview 插 ...
- ADO.NET操作PostgreSQL:数据库操作类(已封装)
1.增.删.改通用方法 /// <summary> /// 增.删.改通用方法 /// </summary> /// <param name="commandT ...
- artdialog(4.1.7)弹出框
artDialog弹出框 <link href="/js/artDialog/skins/default.css" rel="stylesheet" /& ...
- 基于MVC框架Aspose.Words打印到Word中写法
控件bin文件下载地址:https://download.csdn.net/download/u012949335/10610726 //前端打印写法 @{ ViewBag.Title = " ...
- Java基础学习篇---------封装
一.类和对象分配内存 二.Java中的内部类 : 可以直接去访问外部类的所有属性(包括私有成员) 1.Java中成员内部类 (1).内部类的方法可以直接访问外部类的类中的所有成员变量 (2).外部类 ...