JDK-4905919 : RFE: Operator overloading
  • Type: Enhancement
  • Component: specification
  • Sub-Component: language
  • Affected Version: 1.4.2,5.0,6
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS:
    generic,linux,windows_2000,windows_xp generic,linux,windows_2000,windows_xp
  • CPU: generic,x86
  • Submitted: 2003-08-13
  • Updated: 2011-10-31
  • Resolved: 2011-10-31
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
Name: rmT116609			Date: 08/13/2003


A DESCRIPTION OF THE REQUEST :
There is an intensive discussion about adding operator overloading to the java language

Please also see:

http://developer.java.sun.com/developer/bugParade/bugs/4087427.html

JUSTIFICATION :
This post is made to give the people the chance to discuss and vote.
(Incident Review ID: 199033) 
======================================================================

Name: rmT116609			Date: 08/12/2004


A DESCRIPTION OF THE REQUEST :
Even though there's a sort of JVM operator overloading (see toString or the == in enum), this language feature is still missing as a general language extension.


JUSTIFICATION :
Operator overloading can be avoided using functions, of course, but there are cases where the code become more readable, simpler and self-documenting.
I do know all the pros and cons about this, but as I heard similar things for some of the new great improvement on the way with 1.5, I don't see why the operator overloading has been left apart.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The behaviour would be much like the normal c++ behaviour.
ACTUAL -
No behaviour can be described as it's a non permitted syntax expression.

---------- BEGIN SOURCE ----------
public class MultiTierApp {
...
}

public class Tier1 implements Tier {
}

public class Tier2 implements Tier {
}

MultiTierApp mta = (new Tier1) + (new Tier2);
---------- END SOURCE ----------
(Review ID: 296755)
======================================================================

Comments
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. Consequently, this specific request to change the Java programming language will not be considered further. 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.
31-10-2011

EVALUATION I have always objected to this, but I'll leave it os people can vote. ###@###.### 2003-08-20
20-08-2003