The latest update of the final release of the Java platform is expected to be significant and expected this fall. Although the Java 7 Platform Java Specification Request (JSR) has not been formally created through the Java Community Process (JCP), and the final feature set is still unknown, Oracle's Early Access The download and the Oracle team's public statements provide some help in understanding the content of Java SE 7.
The expected characteristics are grouped into the following four categories:
Non-Java language support
"Easy to develop" update
Modular support
Scalability Updates
Non-Java language support and JSR 292
Java 7 will provide enhancements that allow compiler implementations of dynamic type languages to more easily build implementations for Java runtime and allow these implementations to run at higher performance. JSR 292 is the driving force of change. It introduces new bytecode and a series of new Java classes.
In most cases, the Java language is strongly typed, which requires specifying the type of parameters that are passed or returned in the method. However, at the byte level, Java tends to be more weakly typed: the variables in the operand stack need to be specified only if they belong to the relevant original type or are generally object references. In almost all cases, the byte level uses a weak type. A method call is an exception that enforces the use of a strong type-that is, when the method is invoked, its full signature is used, which includes the parameter and the return type. In this case, the Java method needs to be invoked using a known Java type. This can cause problems with dynamic languages, such as Ruby, Python, and Groovy, because they are dynamic types (types are only known at run time).
Some mechanisms, usually based on reflection or using generated callers, can be used to avoid these problems and allow dynamic languages to run on the JVM, but they are subject to significant performance impact. The introduction of JSR 292 is designed to address these problems by adding new Java bytecode invokedynamic to invoke dynamic methods and combining the Java Language Association mechanism to allow the method structure to be overridden at run time.
"Easy to develop" feature
As with the previous release of the Java platform, many of the new language features will help simplify the syntax required for common structures.
Project Coin
Project Coin covers a number of small changes (coins) designed to reduce the complexity of writing simple tasks and improve the readability of your generated code.
String in a switch statement
In a release prior to Java 7, you cannot use String or Object in a switch statement. This means that the only way to execute a switch statement against string is to use a series of if-then-else statements or to convert a string to the original type or enum type. The use of String in a switch statement means that the following simple structure is now legal:
switch (myString) {
case "one": <do something>; break;
case "red": <do something else>; break;
Default: <do something generic>;
}
Improving type inference for generic instance creation
Java 5 introduces generics, which enables it to apply parameterized types to generic collection classes during instantiation, thus enabling compile-time security checks. However, in an implementation, type parameters can be unnecessarily duplicated, for example:
Map<String, List<String>> anagrams = new HashMap<String,
List<String>>();
Improved type setting changes allow inference of a second <> structure:
map<string, list<string>> anagrams = new hashmap< ();