LetExpr表达式解读
Integer a = 0; a++;

举个例子,如下:
package com.test19;
public class BugReport<T> {
private T n;
public void error() {
BugReport<Integer> val = new BugReport<Integer>();
val.n = 0;
Integer.toString(val.n++);
}
public static void main(String[] args) {
BugReport.class.getMethods();
}
}
经过反编译后如下:
package com.test19;
public class BugReport<T> {
private T n;
public BugReport() {
}
public void error() {
BugReport var1 = new BugReport();
var1.n = Integer.valueOf(0);
Integer var3 = (Integer)var1.n;
Object var4 = var1.n = Integer.valueOf(((Integer)var1.n).intValue() + 1);
Integer.toString(var3.intValue());
}
public static void main(String[] var0) {
BugReport.class.getMethods();
}
}
生成的class文件格式如下:
Classfile /C:/BugReport.class
Last modified 2018-7-22; size 741 bytes
MD5 checksum 3c3412b5bb98381c1e3035573f40b89c
Compiled from "BugReport.java"
public class com.test19.BugReport<T extends java.lang.Object> extends java.lang.Object
Signature: #22 // <T:Ljava/lang/Object;>Ljava/lang/Object;
SourceFile: "BugReport.java"
minor version: 0
major version: 51
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Methodref #10.#25 // java/lang/Object."<init>":()V
#2 = Class #26 // com/test19/BugReport
#3 = Methodref #2.#25 // com/test19/BugReport."<init>":()V
#4 = Methodref #6.#27 // java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
#5 = Fieldref #2.#28 // com/test19/BugReport.n:Ljava/lang/Object;
#6 = Class #29 // java/lang/Integer
#7 = Methodref #6.#30 // java/lang/Integer.intValue:()I
#8 = Methodref #6.#31 // java/lang/Integer.toString:(I)Ljava/lang/String;
#9 = Methodref #32.#33 // java/lang/Class.getMethods:()[Ljava/lang/reflect/Method;
#10 = Class #34 // java/lang/Object
#11 = Utf8 n
#12 = Utf8 Ljava/lang/Object;
#13 = Utf8 Signature
#14 = Utf8 TT;
#15 = Utf8 <init>
#16 = Utf8 ()V
#17 = Utf8 Code
#18 = Utf8 LineNumberTable
#19 = Utf8 error
#20 = Utf8 main
#21 = Utf8 ([Ljava/lang/String;)V
#22 = Utf8 <T:Ljava/lang/Object;>Ljava/lang/Object;
#23 = Utf8 SourceFile
#24 = Utf8 BugReport.java
#25 = NameAndType #15:#16 // "<init>":()V
#26 = Utf8 com/test19/BugReport
#27 = NameAndType #35:#36 // valueOf:(I)Ljava/lang/Integer;
#28 = NameAndType #11:#12 // n:Ljava/lang/Object;
#29 = Utf8 java/lang/Integer
#30 = NameAndType #37:#38 // intValue:()I
#31 = NameAndType #39:#40 // toString:(I)Ljava/lang/String;
#32 = Class #41 // java/lang/Class
#33 = NameAndType #42:#43 // getMethods:()[Ljava/lang/reflect/Method;
#34 = Utf8 java/lang/Object
#35 = Utf8 valueOf
#36 = Utf8 (I)Ljava/lang/Integer;
#37 = Utf8 intValue
#38 = Utf8 ()I
#39 = Utf8 toString
#40 = Utf8 (I)Ljava/lang/String;
#41 = Utf8 java/lang/Class
#42 = Utf8 getMethods
#43 = Utf8 ()[Ljava/lang/reflect/Method;
{
public com.test19.BugReport();
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
LineNumberTable:
line 3: 0
public void error();
flags: ACC_PUBLIC
Code:
stack=3, locals=5, args_size=1
0: new #2 // class com/test19/BugReport
3: dup
4: invokespecial #3 // Method "<init>":()V
7: astore_1
8: aload_1
9: iconst_0
10: invokestatic #4 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
13: putfield #5 // Field n:Ljava/lang/Object;
16: aload_1
17: astore_2
18: aload_2
19: getfield #5 // Field n:Ljava/lang/Object;
22: checkcast #6 // class java/lang/Integer
25: astore_3
26: aload_2
27: aload_2
28: getfield #5 // Field n:Ljava/lang/Object;
31: checkcast #6 // class java/lang/Integer
34: invokevirtual #7 // Method java/lang/Integer.intValue:()I
37: iconst_1
38: iadd
39: invokestatic #4 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
42: dup_x1
43: putfield #5 // Field n:Ljava/lang/Object;
46: astore 4
48: aload_3
49: invokevirtual #7 // Method java/lang/Integer.intValue:()I
52: invokestatic #8 // Method java/lang/Integer.toString:(I)Ljava/lang/String;
55: pop
56: return
LineNumberTable:
line 8: 0
line 9: 8
line 10: 16
line 11: 56
public static void main(java.lang.String[]);
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=1, locals=1, args_size=1
0: ldc_w #2 // class com/test19/BugReport
3: invokevirtual #9 // Method java/lang/Class.getMethods:()[Ljava/lang/reflect/Method;
6: pop
7: return
LineNumberTable:
line 14: 0
line 15: 7
}
LetExpr表达式解读的更多相关文章
- quartz Cron表达式解读
CronTrigger CronTriggers往往比SimpleTrigger更有用,如果您需要基于日历的概念,而非SimpleTrigger完全指定的时间间隔,复发的发射工作的时间表. CronT ...
- MySQL数据库25条规范解读
一.基础规范 (1)必须使用UTF8字符集 解读:万国码,无需转码,无乱码风险,节省空间(由于移动设备原因最好使用utf8mb4) (2)禁止使用存储过程.视图.触发器.Event 解读:高并发大数据 ...
- 58到家mysql数据库军规及解读分享
一.基础规范 (1)必须使用InnoDB存储引擎 解读:支持事务.行级锁.并发性能更好.CPU及内存缓存页优化使得资源利用率更高 (2)必须使用UTF8字符集 解读:万国码,无需转码,无乱码风险,节省 ...
- MySQL30条规范解读
转载自:https://mp.weixin.qq.com/s?__biz=MjM5ODYxMDA5OQ==&mid=2651959906&idx=1&sn=2cbdc66cfb ...
- 转 SQL 的数据库 架构规范 之 58到家数据库30条军规解读
军规适用场景:并发量大.数据量大的互联网业务 军规:介绍内容 解读:讲解原因,解读比军规更重要 一.基础规范 (1)必须使用InnoDB存储引擎 解读:支持事务.行级锁.并发性能更好.CPU及内存缓存 ...
- js小技巧(一)
事件源对象 event.srcElement.tagName event.srcElement.type 捕获释放 event.srcElement.setCapture(); event.srcE ...
- Mysql 30条军规
一.基础规范 (1)必须使用InnoDB存储引擎 解读:支持事务.行级锁.并发性能更好.CPU及内存缓存页优化使得资源利用率更高 (2)必须使用UTF8字符集 解读:万国码,无需转码,无乱码风险,节省 ...
- jmeter主要函数助手功用说明
jmeter中虽然有很多的插件,但是有些需要安装,有些具有一定的局限性.函数助手是一个快捷的工具库.下面记录一下函数助手中一些主要的函数的使用方法. 注:不内容中所有的实例均基于3.2记录 1._Be ...
- MySQL建表规范
一.基础规范 (1)必须使用InnoDB存储引擎 解读:支持事务.行级锁.并发性能更好.CPU及内存缓存页优化使得资源利用率更高 (2)必须使用UTF8字符集 解读:万国码,无需转码,无乱码风险,节省 ...
随机推荐
- Mouse Touch Stylus
Mouse操作: preview mouse down, StylusDevice:null mouse down,StylusDevice:null preview mouse up, Stylus ...
- (KMP灵活运用 利用Next数组 )Theme Section -- hdu -- 4763
http://acm.hdu.edu.cn/showproblem.php?pid=4763 Theme Section Time Limit: 2000/1000 MS (Java/Others) ...
- git-fork其他人的代码
1. 2. 3.然后在本地创建目录 第一步:mkdir test 第二步:cd test 第三步:git init(初始化) 第五步:git remote ad ...
- shell 脚本 删除文件内容为空的文件
#!/bin/bask # cd /tmp for a in * ;do if [ ! -s $a ] ;then #[ ! -s $a ] 文件为空返回为真 rm -rf $a fi done 测试 ...
- c# 协变和逆变的理解
1. 是什么 1.1 协变 协变指能够使用比原始指定的派生类型的派生程度更小(不太具体的)的类型.如 string 到 object 的转换.多见于类型参数用作方法的返回值. 1.2 逆变 逆变指能够 ...
- Linux测试上行和下载速率
下载安装speedtest-cli测试工具 方法一: pip3 install speedtest-cli 方法二: wget https://github.com/sivel/speedtest-c ...
- java使用properties文件
使用对用的util包下的properties包就可以了,这样我们有配置的话,写到一个properties文件中更直观. 这里写一个比较丑的例子: package com.property; impor ...
- 译:微软发布.NET应用架构指南草案
原文<Microsoft Announces Draft .NET Architecture Guidance> 译注:上周微软发布了全新的<.NET应用架构指南>草案,以征求 ...
- Dalsa线扫相机SDK开发-小试牛刀(1)
拿到了dalsa相机,可以用Sapera软件配置相机,进行图像采集.但是自己开发的话就得撸起袖子写代码了,查了两篇不错的博文,作为指导. Sapera帮助文档 - <好好先生>专栏 - 博 ...
- 常用到的一些js方法,记录一下
获取字符串长度 function GetStringLength(str) { return str.replace(/[^\x00-\xff]/g, "00").length; ...