2008/04/22

Incoming new Java 7 Featuers

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 System
A 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 Kernel
Implement 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”.

NIO2
APIs for filesystem access, scalable asynchronous I/O operations, socket-channel binding and configuration, and multicast datagrams.

Date and Time API
A 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 Quantities
one or more Java packages for the programmatic handling of physical quantities and their expression as numbers of units.

JCache API
Standardizes 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 Utilities
New kind of BlockingQueue called TransferQueue and a fine-grained parallel computation framework based on divide-and-conquer and work-stealing.

XQuery API
An 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 API
Allow 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 Framework
A 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 Binding
An API that allows two properties of two beans to stay in sync. Formalizes an API for connecting JavaBeans.

Beans Validation
Define 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 Components
Support 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.0
Updates 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 JMX
A 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 Update
New 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 Generics
Currently, 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 Types
enriches 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 Inference
Constructor 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());

Closures
A 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 support
Support 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);
# }

invokedynamic
Introduces a new bytecode invokedynamic for support of dynamic languages.

Tiered compilation
Tiered 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 Collector
G1 (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 Engine
additional language interpreters to JSE. The JavaScript Rhino engine was added in Java 6. Leading candidates for Java 7 are: JRuby, Jython, and Beanshell.

8 comments:

Alex Miller said...
This comment has been removed by a blog administrator.
J2EE Blogger said...

Oops, was in a hurry and thought that was official Sun document.

Krishna said...

Java 7.0 New Features

Anonymous said...

A new java/J2EE website develope by me please check it out
www.fabgabs.com and join the new social networking sensation with maps and videos

Unknown said...

You made some good points there. I did a search on the topic and found most people will agree with your blog.
Java Training in Chennai

Unknown said...

This information is impressive; I am inspired by your post writing style & how continuously you describe this topic.... Java Training in Chennai | RPA Training in Chennai

Suba said...

This blog shows that you have a great career as a content writer.
JAVA Training in Chennai
Java training institute in chennai
Java Training
Selenium Training in Chennai
Selenium Course in Chennai
Hadoop Training in Chennai
Selenium Training
Big Data Training in Chennai

uok ba 3rd year result subject wise said...

I am very happy with your blog because I have read your entire blog. Your blog is very interesting .. Your style is also very beautiful.

Well well... why another J2EE blog? I benefited from other people's technical blogs, and guess what, it's a good idea to contribute some of my works too. Hope it's helpful and useful, to all of your folks.