Find JSRs
Submit this Search

Ad Banner

JSRs: Java Specification Requests
JSR 334: Small Enhancements to the JavaTM Programming Language

Original Java Specification Request (JSR)

Identification | Request | Contributions

Section 1. Identification

Submitting Member: Oracle

Name of Contact Person: Joe Darcy

E-Mail Address:

Telephone Number: +1 408 276 7053

Fax Number: -

Specification Lead: Joe Darcy

E-Mail Address:

Telephone Number: +1 408 276 7053

Fax Number: -

Initial Expert Group Membership:

Bruce Chapman
Tim Peierls

Supporting this JSR:

Bruce Chapman
Tim Peierls

Section 2: Request

2.1 Please describe the proposed Specification:

This JSR will amend the Java programming language specification and API specification to support the following features:

- Strings in switch
- Binary integral literals and underscores in numeric literals
- Multi-catch and more precise rethrow
- Improved Type Inference for Generic Instance Creation (diamond)
- try-with-resources statement
- Simplified Varargs Method Invocation

Supporting changes may be needed in various reflective APIs, including but not limited to core reflection and javax.lang.model.*. Concomitant changes may be needed other Java SE APIs, including changes in the java.lang package, such as java.lang.Throwable, and the java.util package.

This JSR will cover at most these six specific language changes. If other language change proposals should arise from the work of the expert group, these will be pursued in separate JSRs.

2.2 What is the target Java platform? (i.e., desktop, server, personal, embedded, card, etc.)

The language changes are appropriate for all platforms.

2.3 The Executive Committees would like to ensure JSR submitters think about how their proposed technology relates to all of the Java platform editions. Please provide details here for which platform editions are being targeted by this JSR, and how this JSR has considered the relationship with the other platform editions.

This JSR targets Java SE 7. Therefore, the languages changes will first be available to the SE and EE platforms. We expect that they will eventually be adopted by the ME platforms.

2.4 Should this JSR be voted on by both Executive Committees?

No; SE/EE EC only.

2.5 What need of the Java community will be addressed by the proposed specification?

Making things programmers do everyday easier. By using expanded compiler analysis, unnecessary code can be removed and boilerplate reduced, leading to shorter and more robust programs.

For example, the diamond operator removes the need for explicit type arguments in the majority of constructor calls to generic classes and simplified varargs method invocation removes extraneous warnings introduced by generic erasure. Multi-catch allows duplicated catch blocks to be combined and the try-with-resources statement concisely and correctly represents a much larger, tedious, and error-prone set of statements. Strings in switch improves regularity and the changes in numeric literals can improve readability.

2.6 Why isn't this need met by existing specifications?

Language extensions are needed to address these issues.

2.7 Please give a short description of the underlying technology or technologies:

The main technology in need of modification are compilers from the Java programming language to executable output.

2.8 Is there a proposed package name for the API Specification? (i.e., javapi.something, org.something, etc.)

Not as such; new or modified types are expected in at least the java.lang and javax.lang.model.* packages.

2.9 Does the proposed specification have any dependencies on specific operating systems, CPUs, or I/O devices that you know of?


2.10 Are there any security issues that cannot be addressed by the current security model?

None known.

2.11 Are there any internationalization or localization issues?

None beyond localizing new compiler messages.

2.12 Are there any existing specifications that might be rendered obsolete, deprecated, or in need of revision as a result of this work?

Yes, primarily "The Java Programming Language Specification, 3rd Edition." Changes to the Java SE library APIs are also expected.

2.13 Please describe the anticipated schedule for the development of this specification.

Expert Group formation: December 2010
Early Draft Review: January 2011
Public Review: March 2011
Proposed Final Draft: May 2011
Final Release: July 2011

2.14 Please describe the anticipated working model for the Expert Group working on developing this specification.

A publicly readable mailing list for expert group communication will be the primary working model.

2.15 2.15 Provide detailed answers to the transparency checklist, making sure to include URLs as appropriate:

- The public can read the names of the people on the Expert Group.

We intend this to be the case.

- The Expert Group business is regularly reported on a publicly readable alias.

We intend this to be the case.

- The schedule for the JSR is publicly available, it's current, and I update it regularly.

We intend this to be the case.

- The public can read/write to a wiki for my JSR.

Rather than a wiki which the Expert Group must take time out to visit, we intend to implement a pair of mailing lists following the approach of JSR 294 and JSR 330. First, Expert Group business will be carried out on a mailing list dedicated to Expert Group members. Second, an "observer" mailing list which anyone may join will receive the traffic of the Expert Group list. The observer list allows the public to follow Expert Group business, and is writable to allow the public to make comments for other observers to see and make further comment on. Expert Group members are under no obligation to join the observer list and partake in public discussion. In addition to these lists we will maintain a private Expert-Group-only list for administrative and other non-technical traffic.

- I read and respond to posts on the discussion board for my JSR on

In lieu of tracking the discussion board, and in light of the considerable public attention that the observer list is likely to receive, the Specification Lead (or his designates) will read the observer list and respond directly as appropriate.

- There is an issue-tracker for my JSR that the public can read.

We intend this to be the case.

- I have spoken at conferences and events about my JSR recently.

Yes; Project Coin has been presented at both the JavaOne and Devoxx conferences.

- I am using open-source processes for the development of the RI and/or TCK.

The source code for the Reference Implementation is being developed in the JDK 7 Project within the OpenJDK Community ( Many of the features described here have already been prototyped and are available for anyone to test and review in the weekly and milestone binary releases published at We intend to continue this practice as we move toward the Final Release.

- The Update tab for my JSR has links to and information about all public communication mechanisms and sites for the development of my JSR.

We intend this to be the case.

2.16 Please describe how the RI and TCK will de delivered, i.e. as part of a profile or platform edition, or stand-alone, or both. Include version information for the profile or platform in your answer.

The RI and TCK will be part of the RI and TCK for Java SE 7.

2.17 Please state the rationale if previous versions are available stand-alone and you are now proposing in 2.13 to only deliver RI and TCK as part of a profile or platform edition (See sections 1.1.5 and 1.1.6 of the JCP 2 document).

Not applicable.

2.18 Please provide a description of the business terms for the Specification, RI and TCK that will apply when this JSR is final.

The licenses for the specification, RI, and TCK will be the same as for Java SE 7.

Section 3: Contributions

3.1 Please list any existing documents, specifications, or implementations that describe the technology. Please include links to the documents if they are publicly available.

This JSR builds on the work done in as part of the OpenJDK Project Coin effort:

- Strings in switch
+ Project Coin proposal form:
+ Implementation information:

- Binary integral literals and underscores in numeric literals
+ Grammar changes:

- Multi-catch and more precise rethrow
+ Project Coin proposal form:
+ Current Specification:

- Improved Type Inference for Generic Instance Creation (diamond)
+ "on diamond and evolution,"
+ "diamond operator and non-denotable types,"

- try-with-resources statement
+ Current specification:
+ API support:

- Simplified Varargs Method Invocation
+ Description of prototype:

3.2 Explanation of how these items might be used as a starting point for the work.

The documents developed in Project Coin will serve as the basis for the initial specification for this JSR. Expert group members are expected to be generally familiar with the discussions that have taken place on the Project Coin list.

Existing builds of JDK 7 provide implementations of most of the features, including strings in switch, the diamond operator, multi-catch and more precise rethrow, and the try-with-resources statement.