JSR 666: Solving Java's Problems
You may be interested in some new developments in JSR-666 (the JSR from hell). This is an excellent JSR containing many important enhancements for Java. Maybe we can even get it into Java 7.
This JSR contains the following list of recommendations:
- Import on Demand, With Extreme Prejudice. You can get rid of all those pesky imports and instead them with a simple: "import *;".
- Default throws Clause. Treat an omitted throws clause as if "throws Exception" was declared.
- Eliminate NullPointerExceptions. Remove null and require that all variables have a valid value.
- Extended Operator Set. Why waste all those Unicode characters? For example, ∞ should be BigInteger.MAX_INT. Some updates can be found on the post-assignment operator as well.
- The 'that' keyword. For referencing objects that don't exist yet, did exist but were GC'ed, etc.
- SchrödingerException. An exception for dealing with the case where both IllegalArgumentException and NullPointerException seem like good choices. This exception can exist as either till a point where the exception is caught, at which time it collapses to one or the other.
Many props to the JSR 666 expert group: Alan Green, Charles Miller, Mike Cannon-Brookes, and AJ Fitzpatrick.
- Login or register to post comments
- 5800 reads
- Flag as offensive
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)







Comments
cowwoc replied on Wed, 2008/02/13 - 6:22pm
I was about to post a comment telling you off before I clued in ;)
All I've got to say is that it's a good thing that Java doesn't allow identifiers to be declared using Unicode characters. I'll spare you the headache of debugging code with Russian or Japanese comments. I'd hate for the actual code to use these characters :)
Bruno Laturner replied on Wed, 2008/02/13 - 11:25pm
in response to: cowwoc
Actually...
Loren Kratzke replied on Thu, 2008/02/14 - 1:46am
Rick Ross replied on Thu, 2008/02/14 - 9:02am
David Sills replied on Sat, 2008/02/16 - 3:49pm
Alexander Beloturkin replied on Sat, 2008/02/16 - 5:27pm
>> Eliminate NullPointerExceptions. Remove null and require that all variables have a valid value.
I don't think that this is a good idea. Null is very important.
Artur Biesiadowski replied on Sat, 2008/02/16 - 9:21pm
in response to: amigooo
Naaah.
For strings iuse "" instead of null. For primite wrappers, null is just messing around with autoboxing - and double has NaN which can be very well used to represent tricky values. When you have Person class, instead of using null to indicate that Cat has no owner, you can have special marker instances like GENERIC_GRAVEYARD_OLD_LADY to indicate it is fed by unknown person, or FURRY_GRIM_REAPER to indicate it is soon going to die from not being fed.
Obviously removing null won't happen anytime soon, because Java 7 is sponsored by letter N.
Alexander Beloturkin replied on Sun, 2008/02/17 - 5:15am
in response to: abies
"" and null is not the same. This is completly different things. About the null marker, you right, this is one the possible solution, but if for every null in program we start to use some kind of markers, it can make our code unmaintainable. And in reality we will have many problems instead of NPE.
Any way I agree with you that this is not happen in nearest future.
Artur Biesiadowski replied on Sun, 2008/02/17 - 7:21am
in response to: amigooo
I thought that I'm obvious enough, but it seems not.
Alexander, this entire thread is a satire. None of the posts above, including mine, are serious. There are some subtle hints indicating it, including "Geeze, I thought this was serious for a minute" from Loren, but it is probably time to state it yet more clearly.
Alexander Beloturkin replied on Sun, 2008/02/17 - 8:14am
in response to: abies
Yes, I understand this from first post.