The Java® SE 7 Edition of The Java Language Specification describes all the features that have been added to the Java programming language in Java SE 7. It also integrates changes made to the Java programming language under maintenance since the Third Edition in 2005.
Readers may send feedback about errors and ambiguities in The Java Language Specification
The majority of new features in this edition were specified by JSR 334, Small Enhancements to the Java Programming Language, led by Joe Darcy with an Expert Group of Joshua Bloch, Bruce Chapman, Alexey Kudravtsev, Mark Mahieu, Tim Peierls, and Olivier Thomann. The origins of these features lie in Project Coin, an OpenJDK project started in 2009 with the goal of "Making things programmers do every day easier". The project solicited proposals from the Java community for broadly useful language features that were, in comparison with "large" features like generics, relatively "small" in their specification, implementation, and testing.
Thousands of emails and six dozen proposals later, proposals
were accepted from Joshua Bloch (the
Derek Foster/Bruce Chapman (improvements to literals), Neal Gafter
catch and precise rethrow), Bob Lee (simplified variable
arity method invocation), and Jeremy Manson (improved type inference
for instance creation, a.k.a. the "diamond" syntax). The popular
"strings in switch" feature was also accepted. Special thanks are due
to Tom Ball, Stephen Colebourne, Rémi Forax, Shams Mahmood Imam, James
Lowden, and all those who submitted interesting proposals and
thoughtful comments to Project Coin. Over the course of the project,
there were essential contributions from Mandy Chung, Jon Gibbons,
Brian Goetz, David Holmes, and Dan Smith in areas ranging from library
support to language specification. Stuart Marks led a "coinification"
effort to apply the features to the Oracle JDK codebase, both to
validate their utility and to develop conventions for wider
The "diamond" syntax and precise rethrow give type inference a new visibility in the Java programming language. To a great extent, inference is worthwhile only if it produces types no less specific than those in a manifestly-typed program prior to Java SE 7. Otherwise, new code may find inference insufficient, and migration from manifest to inferred types in existing code will be risky. To mitigate the risk, Joe Darcy and Maurizio Cimadamore measured the effectiveness of different inference schemes on a large corpus of open source Java code. Such "quantitative language design" greatly improves confidence in the suitability and safety of the final feature. The challenge of growing a mature language with millions of developers is partially offset by the ability of language designers to learn from developers' actual code.
The Java SE 7 platform adds features that cater for non-Java languages, effectively expanding the computational model of the platform. Without changes, the Java programming language would be unable to access or even express some of these features. Its static type system comes under particular stress when invoking code written in dynamically typed languages. Consequently, method invocation in the Java programming language has been modified to support method handle invocation as defined by JSR 292, Dynamically Typed Languages on the Java Platform.
The Java Compatibility Kit (JCK) team whose work helps validate this specification are due an enormous vote of thanks: Leonid Arbouzov, Alexey Gavrilov, Yulia Novozhilova, Sergey Reznick, and Victor Rudometov. Many other colleagues at Oracle (past or present) have also given valuable support to this specification: Uday Dhanikonda, Janet Koenig, Adam Messinger, Mark Reinhold, Georges Saab, Bill Shannon, and Bernard Traversat.
The following individuals have all provided many valuable comments which improved this specification: J. Stephen Adamczyk, Peter Ahé, Davide Ancona, Michael Bailey, Dmitry Batrak, Joshua Bloch, Kevin Bourrillion, Richard Bosworth, Martin Bravenboer, Martin Buchholz, Didier Cruette, Glenn Colman, Neal Gafter, Jim Holmlund, Ric Holt, Philippe Mulet, Bill Pugh, Vladimir Reshetnikov, John Spicer, Robert Stroud, and Mattias Ulbrich.
This edition is the first to be written in the DocBook XML format. Metadata in the XML markup forms a kind of static type system, classifying each paragraph by its role, such as a definition or an error. The reward is much crisper conformance testing. Many thanks go to Robert Stayton for sharing his considerable DocBook expertise and for helping to render DocBook in the traditional look and feel of The Java Language Specification.