Alex Miller has an excellent summarize of the new Java 7 Featuers:
Improved Modularity Support (superpackages)
1. superpackage example.bar.lib {
2.
3. // member packages
4. member package example.bar.lib;
5.
6. // member superpackages
7. member superpackage example.bar.lib.net, example.bar.lib.xml;
8.
9. // list of exported types
10. export example.bar.lib.Table;
11.
12. export superpackage example.bar.lib.net;
13. }
Java Module SystemA distribution format and a repository for collections of Java code and related resources. It also defines the discovery, loading, and integrity mechanisms at runtime. Defines a new deployment archive called a JAM (Java Module). The Java Module is a JAR file that contains other JARs, resources, and metadata. JAMs can specify which portions of the module are public and which are hidden. JAMs can specify dependencies on other modules.
Java KernelImplement Java as a small kernel, then load the rest of the platform and libraries as needed, with the goal of reducing startup time, memory footprint, installation, etc. In the past this has also been referred to as “Java Browser Edition”.
NIO2APIs for filesystem access, scalable asynchronous I/O operations, socket-channel binding and configuration, and multicast datagrams.
Date and Time APIA new and improved date and time API for Java. The main goal is to build upon the lessons learned from the first two APIs (Date and Calendar) in Java SE, providing a more advanced and comprehensive model for date and time manipulation.
Units and Quantitiesone or more Java packages for the programmatic handling of physical quantities and their expression as numbers of units.
JCache APIStandardizes in process caching of Java objects in a way that allows an efficient implementation, and removes from the programmer the burden of implementing cache expiration, mutual exclusion, spooling, and cache consistency.
Concurrency UtilitiesNew kind of BlockingQueue called TransferQueue and a fine-grained parallel computation framework based on divide-and-conquer and work-stealing.
XQuery APIAn API for executing XQuery calls and working with results. XQJ is to XQuery what JDBC is to SQL. At a glance, the XQJ API intentionally shares many high-level concepts from JDBC (DataSource, Connection, etc) but supports XQuery specific concepts such as static and dynamic phases, XML-oriented retrieval, etc.
Resource Consumption Management APIAllow for partitioning resources (constraints, reservations) among Java applications and for querying about resource availability (notifications). It will also provide means of exposing various kinds of resources. Example resources are heap memory size, CPU time, open JDBC connections, etc. The goal is to allow resources to be managed so that multiple applications might run simultaneously in a JVM and be given finite amounts of memory, cpu, etc. This JSR will build on top of JSR 121 Isolates.
Swing Application FrameworkA simple application framework for Swing applications. It will define infrastructure common to most desktop applications. In so doing, Swing applications will be easier to create.
Beans BindingAn API that allows two properties of two beans to stay in sync. Formalizes an API for connecting JavaBeans.
Beans ValidationDefine a meta-data model and API for JavaBeanTM validation based on annotations, with overrides and extended meta-data through the use of XML validation descriptors.
Java Media ComponentsSupport for video to Java. It will initially address playback and ultimately will also cover capture and streaming. Video playback will provide support for both native players and a pure Java player.
JMX 2.0Updates the JMX and JMX Remote APIs to improve usability of existing features and add new functionality such as annotations for ease of development, federated JMX servers, etc.
Web Services Connector for JMXA connector for the JMX Remote API that uses Web Services to make JMX instrumentation available remotely. Clients do not have to be Java applications, but can be.
Javadoc Technology UpdateNew tags and generated Javadoc document representation aimed to increase readability, information richness, and make the Javadoc more approachable to developers learning and using the APIs.
Reified GenericsCurrently, generics are implemented using erasure, which means that the generic type information is not available at runtime, which makes some kind of code hard to write. Generics were implemented this way to support backwards compatibility with older non-generic code. Reified generics would make the generic type information available at runtime, which would break legacy non-generic code. However, Neal Gafter has proposed making types reifiable only if specified, so as to not break backward compatibility.
Type Literals 1. Type<List<String>> x = List<String>.class;
Annotations on Java Typesenriches the Java annotation system. For example, it permits annotations to appear in more places than Java 6 permits; one example is generic type arguments (List<@NonNull Object>). These enhancements to the annotation system require minor, backward-compatible changes to the Java language and classfile format.
Type InferenceConstructor invocation can be changed from:
1. Map<String, List<String>> anagrams = new HashMap<String, List<String>>();
2. to
3. Map<String, List<String>> anagrams = new HashMap<>();
and explicit type references can now be inferred changing:
# timeWaitsFor(Collections.<Man>emptySet());
# to
# timeWaitsFor(Collections.emptySet());
ClosuresA closure is a function that captures the bindings of free variables in its lexical context. Closures support passing functions around and make many anonymous inner class use cases easier to use. In addition, they support additional high-level programming abstractions.
Automatic Resource Block Management 1. // Start a block using two resources, which will automatically
2. // be cleaned up when the block exits scope
3. do (BufferedInputStream bis = ...; BufferedOutputStream bos = ...) {
4. ... // Perform action with bis and bos
5. }
Language level XML support 1. elt.appendChild(
2. <muppet>
3. <name>Kermit</name>
4. </muppet>);
JavaBean Property Support 1. public property String foo;
2. a->Foo = b->Foo;
BigDecimal operator supportSupport for manipulating BigDecimal objects with arithmetic operators (just like other numeric primitives) instead of via method calls.
Strings in switch statements# static boolean booleanFromString(String s) {
# switch(s) {
# case "true":
# return true;
# case "false":
# return false;
# }
# throw new IllegalArgumentException(s);
# }
Comparisons for Enums 1. boolean isRoyalty(Rank r) {
2. return rank >= Rank.JACK && rank != Rank.ACE;
3. }
Chained Invocation 1. class Factory {
2. void setSomething(Something something) { ... }
3. void setOther(Other other) { ... }
4. Thing result() { ... }
5. }
6.
7. Thing thing = new Factory()
8. .setSomething(something)
9. .setOther(other)
10. .result();
Extension methods 1. import static java.util.Collections.sort;
2. List<String> list = ...;
3. list.sort(); // looks like call to List.sort(), but really call to static Collections.sort().
Improved Catch Clause# try {
# return klass.newInstance();
# } catch (InstantiationException | IllegalAccessException e) {
# throw new AssertionError(e);
# }
invokedynamicIntroduces a new bytecode invokedynamic for support of dynamic languages.
Tiered compilationTiered compilation uses a mix of the client (JIT) and server hot spot compilers - the client engine improves startup time by using JIT over interpreted and the server hot spot compiler gives better optimization for hot spots over time.
G1 Garbage CollectorG1 (for “garbage first”) is a single collector that divides the entire space into regions and allows a set of regions to be collected, rather than split the space into an arbitrary young and old generation. Sun intends to make this new collector the default in Java 7. (This applies only to the Sun JDK.)
More Script Engineadditional language interpreters to JSE. The JavaScript Rhino engine was added in Java 6. Leading candidates for Java 7 are: JRuby, Jython, and Beanshell.