United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-5014235 Closures support instead of anonymous inner classes
JDK-5014235 : Closures support instead of anonymous inner classes

Details
Type:
Enhancement
Submit Date:
2004-03-16
Status:
Closed
Updated Date:
2011-10-31
Project Name:
JDK
Resolved Date:
2011-10-31
Component:
specification
OS:
linux_redhat_9.0,linux,generic,windows_xp,windows_2000
Sub-Component:
language
CPU:
x86,generic
Priority:
P4
Resolution:
Won't Fix
Affected Versions:
1.2.0,1.3.0,1.4.0,1.4.2,5.0,6
Fixed Versions:

Related Reports
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Duplicate:

Sub Tasks

Description
Look at JSR 241 <http://jcp.org/en/jsr/detail?id=241>.
Particularly to closures <http://groovy.codehaus.org/closures.html>.

I wish I could code this way Runnables, PropertyChangeListeners, ... all typical single method annonymous inner classes that clutter my code.
###@###.### 2004-03-16
###@###.### 2004-03-16

                                    

Comments
EVALUATION

I've been saying this for more than seven years.


Closures are a great thing.  Unfortunately, Java missed the boat in 1997.

Since then, we've added a collections framework without closures (one of the prime uses), built graphics APIs around nested classes etc. We have tons of control constructs that could be defined using closures but aren't (assert 
and foreach, for example).

So the advantage of adding closures now would be relatively small compared
to the huge benefit you get if you add them from day one.

Implementing them is quite painful (though I think I've worked out how to
do it) without VM support. And dealing with all the special cases  around
break, continue etc. is a mess.

So, it's too late for Java - the costs are higher than they should be, the 
benefits lower. Sigh.

In short,
###@###.### 2004-07-09
                                     
2004-07-09
PUBLIC COMMENTS

Too late.
                                     
2004-10-02
EVALUATION

Proposals for new features in the Java programming language are no longer being accepted or maintained in the bug database at http://bugs.sun.com/. This also applies to proposals for new features in the Java Virtual Machine (that is, in the abstract JVM, as opposed to a JVM implementation like HotSpot).

All proposals for new features should be made through the "JDK Enhancement - Proposal & Roadmap Process" described at http://openjdk.java.net/jeps/1.

This specific request to change the Java programming language is related to the work of OpenJDK Project Lambda. It will be considered further by that project, not here.

The bug database continues to accept and maintain submissions about technical errors in the design and specification of the Java programming language and the Java Virtual Machine.
                                     
2011-10-31



Hardware and Software, Engineered to Work Together