阳光VIP

少壮不努力,老大徒伤悲。平日弗用功,自到临期悔。
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Java 7.0 New Features

Posted on 2012-02-04 22:12  阳光VIP  阅读(206)  评论(0编辑  收藏  举报
转自http://www.javabeat.net/javabeat/java7/index.php。

此篇文章提供了Java 7.0的新的重要特性介绍。 Java 7.0也是自Java 5.0做重大改变(泛型和并发包)后的又一次重大变化。
语言规范将进一步演化(C#演化的太快了)。尤其是闭包(Closures)的引入,使Java语言也能象C# 3.0语言一样便捷的进行Lamda运算。

从语言变化上来看,property关键字可能得到支持. 通过闭包,可以进行lamda运算,并进一步简化匿名类的使用。纯XML支持。

从API来看,NIO得到进一步提升,持久化框架将被加入到JSE,等等。

当然,离Java 7.0发布第一个版本还有些时间,据Danny Coward(制定Java 7.0规范的头)说,他们的目标是在2009年一月份发布第一个版本。让我们等待那一时刻Java带给我们新的惊喜。

Java 7.0 (Dolphin)

Sun is releasing weekly early access snapshots of the complete source, binaries and documentation for JDK 7. These raw snapshot releases let you review and contribute to the Java SE platform as it is being developed.

Some possible language changes being considered for Dolphin include:

  • property support (for getFoo()/setFoo() pattern)
  • method references (a quick way to write an event notification pattern)
  • block closures(collection of statements within a statement)
  • native XML support

 

Java 7.0 New Features

 

  • Closures

    Closures are something like C callbacks, a pointer to a function that you can pass as a parameter. In addition to the method, some context around that method is snapshotted to go along with it in the closure.

    Another way of putting it is a closure is an anonymous function body, that can be declared and passed around as a first-class object, and which can refer to variables from its enclosing scope. The anonymous classes in JDK 1.1 provide closure-like facilities, albeit with tacky syntax. Smalltalk "blocks" are closures.

  • JSR 277 Java Module System

  • JSR 294 Improved Modularity Support

  • JSR 295 Beans Binding

  • JSR 303 Beans Validation

  • JSR 296 Swing Application Framework

  • JSR 203 NIO2

  • JSR 220 Java Persistence APIs

  • JSR 255 JMX 2.0

  • JSR 262 Web Services Connector for JMX

  • JSR 260 Javadoc Technology Update

  • JSR 275 Units and Quantities

  • JSR 310 Date and Time API

  • JSR 308 Annotations on Java Types