关于“ Java - Why are only final variables accessible in anonymous class? - Stack Overflow”的疑惑

JasonLaw:在java - Why are only final variables accessible in anonymous class? - Stack Overflow中,Jon Skeet 说了这么一段话:

When you create an instance of an anonymous inner class, any variables which are used within that class have their values copied in via the autogenerated constructor. This avoids the compiler having to autogenerate various extra types to hold the logical state of the "local variables", as for example the C# compiler does... (When C# captures a variable in an anonymous function, it really captures the variable - the closure can update the variable in a way which is seen by the main body of the method, and vice versa.)

我对“This avoids the compiler having to autogenerate various extra types to hold the logical state of the "local variables", as for example the C# compiler does...”的理解是:如果要实现 full closures support,那么就需要产生一个共享的数据结构用来包含外部方法和内部类所共同访问的变量,这样两者都是使用同一个数据源,那么一方对变量的改变就会对另一方可见,类似Ivan Dubrov 所说的。

我不肯定我的理解是否正确,所以我想看一下大家对这句话的理解。

mightofcode:我觉得你的理解没错

lxk11153:好像有点道理 [doge]

关于 apple trade in

ipad418855832:有部闲置 iPhone7 128g 换电池过程大力出奇迹扯断 touch id 排线,马云修理一下一百来块钱,请问这种情况可以 trade in 吗?或者大概扣多少钱?zhaidoudou123:我没记错我上次拿 7p 去换的时候检查了 Touch ID,电源键,音量键,闪光灯 sharpy:我手里的 7 几个月前换电池,就是这玩…

有什么可视化 JVM 加载 class 文件的工具吗?

JasonLaw:Inside the Java Virtual Machine的“Chapter 6 The Java Class File”最后介绍了一个演示 JVM 加载 class 文件的 applet,所以我在想有什么可视化 JVM 加载 class 文件的工具吗? 以下是我找到的相关资料: jvm - Java classloading visu…

如何从jar文件创建C库? - java

我有一个图书馆的jar文件,其中的内容是一堆.class文件spl ├── acm │   ├── graphics │   │   ├── DrawLineElement.class │   │   ├── EndRegionElement.class │   │   ├── FinalPathElement.class │   │   ├── G3DRe…

bulit-in gradle插件的版本号是多少? - java

在我的gradle构建文件中,我有以下插件块plugins { `java-library` jacoco checkstyle } 这些都没有指定版本,但是一切正常。假定一个项目正在使用gradle 6.0和gradle包装器,但是系统已安装gradle 5.0。问题:如果我运行gradle wrapper ./gradlew build,将会执行grad…

如何在实体框架4.0中实现SQL in - c#

如何在实体框架中实现SQL的以下查询。SELECT * FROM Users WHERE UserID in (1,2,3,4)。我正在尝试做var users = from e in context.Users where e.UserId in (list of user ids) 谢谢阿什瓦尼 参考方案 var users = from e in co…