关于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 ...
随机推荐
- 14)settings.xml
1. User Level. ${user.home}/.m2/settings.xml 2. Global Level. ${maven.home}/conf/settings.xml <se ...
- MVC 图片上传(转)
转自:http://www.cnblogs.com/Tiramisu/archive/2009/02/06/1385405.html MVC 上传图片 直接上代码: 页面:Index.aspx C ...
- HDU1181 变形课(DFS) 2016-07-24 13:31 73人阅读 评论(0) 收藏
变形课 Problem Description 呃......变形课上Harry碰到了一点小麻烦,因为他并不像Hermione那样能够记住所有的咒语而随意的将一个棒球变成刺猬什么的,但是他发现了变形咒 ...
- 基于注解方式@AspectJ的AOP
启用对@AspectJ的支持 Spring默认不支持@AspectJ风格的切面声明,为了支持需要使用如下配置: <aop:aspectj-autoproxy/> 这样Spring就能发现@ ...
- NLTK之WordNet 接口
WordNet是面向语义的英语词典,类似于传统字典.它是NLTK语料库的一部分,可以被这样调用: 更简洁的写法: 1.单词 查看一个单词的同义词集用synsets(); 它有一个参数pos,可以指定查 ...
- js正则处理千分位
"222212345.098771".replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,');
- 记录.NET Core部署到Linux之发布项目到Linux(2)
1.选择文件夹发布项目到本地,通过Xftp上传文件到/home/wwwroot下:下面具体介绍下 2.通过Xftp直接拖拽压缩包到linux下,通过命令cd /home/wwwroot目录下;然后输入 ...
- 使用.NET Core 2.1的Azure WebJobs
WebJobs不是Azure和.NET中的新事物. Visual Studio 2017中甚至还有一个默认的Azure WebJob模板,用于完整的.NET Framework. 但是,Visual ...
- 修改ActiveReports验证文字“给不能为 null 的参数指定一个 null 值”
转:http://gcdn.gcpowertools.com.cn/showtopic-13759.html ActiveReports官方网站:http://www.gcpowertools.com ...
- selenium下拉框踩坑埋坑
本文来自网易云社区 作者:王利蓉 最近web端全站重构,所有的页面都大大小小都有些变动,UI就全军覆没了,用例从登录改,改到个人信息页面发现根以前的实现方式完全不一样,这可怎么解决 1.以前的实现(o ...