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字符集 解读:万国码,无需转码,无乱码风险,节省 ...
随机推荐
- mysql-5.7.10普通安装
这里安装的是最新的MySQL 5.7.10,下载网址为:http://dev.mysql.com/downloads/mysql/,本文选择是的"Linux - Generic"下 ...
- Global Mapper
https://blog.csdn.net/mrib/article/details/75116373 http://www.bluemarblegeo.com/products/global-map ...
- 【PAT Advanced Level】1015. Reversible Primes (20)
转换进制&&逆序可以在一起进行,有一点技巧,不要用十进制数来表示低进制,容易溢出. #include <iostream> #include <vector> ...
- ORACLE EBS xml publisher 报表输出字符字段前部"0"被EXCEL自动去掉问题
http://www.cnblogs.com/lzsu1989/archive/2012/10/17/2728528.html Oracle EBS 提供多种报表的开发和输出形式,由于MS Ex ...
- Android adb获取屏幕分辨率
获取Android设备屏幕分辨率,可以采用最快捷的方式,使用ADB命令获取即可: 打印详细方式: adb shell dumpsys window displays 执行结果: Dump time : ...
- sklearn使用小记GridSearchCV
def test_grid_search(): from sklearn import datasets,svm iris = datasets.load_iris() parameters = {' ...
- Spring Boot 2 实践记录之 封装依赖及尽可能不创建静态方法以避免在 Service 和 Controller 的单元测试中使用 Powermock
在前面的文章中(Spring Boot 2 实践记录之 Powermock 和 SpringBootTest)提到了使用 Powermock 结合 SpringBootTest.WebMvcTest ...
- C#默认以管理员身份运行程序实现代码
using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; names ...
- 解决DbContext对象创建问题
解决DbContext对象创建问题 方法一: 使用CallContext public class BaseController : Controller { public MyContext db ...
- docker rpm 下载地址
http://yum.dockerproject.org/repo/main/centos/7/Packages/