Java 7

Java 7 has officially been released today, July 28, 2011.

A list of all new features is here:
http://www.oracle.com/technetwork/java/javase/jdk7-relnotes-418459.html

Thoughts/Discussions?

oh love major java releases, tons of performance improvements without making any changes to code.

Too bad that Eclipse will only get support for Java 7 language features in 3.7.1 (due in September 2011), so gonna wait for that before moving development over to JDK 7.

I just noticed it as well, you beat me to it ra4king!
http://blogs.oracle.com/java/entry/java_se_7_is_here

I am very excited about some of the performance and other changes that are behind the scene.

http://www.eweek.com/c/a/Application-Development/Oracle-and-Java-7-The-Top-10-Developer-Features-626145/?kc=EWKNLEDP07282011A

I am excited about
Xrender Java2D pipeline and fork/join changes

some other things I think are neat.

underscores for numerical separation

int billion = 1_000_000_000;

billion is still equal to 1000000000

Strings in switches, (they are more efficient than equivalent if else sequence because of back end optimizations.

String availability = "available";
switch(availability) {
 case "available":
    //code
    break;
  case "unavailable":
    //code
    break;
  case "merged":
    //code
} 

You can create binary literals using the 0b prefix

int binary = 0b1001_1001; 

Can somebody explain what is so great with “Type Inference for Generic Instance Creation”.

Why is

List<String> strings = new ArrayList<>();

better than what I usually do

List<String> strings = new ArrayList();

Yours creates a raw-typed ArrayList and assigns it to a generically typed List. For various reasons, raw types have slightly different semantics and need to stick around (I’ve found its usually when Java’s type inference doesn’t work in complicated situations, or via reflection). Because of this, raw types generate compiler warnings and you have to suppress them with the @SuppressWarnings annotation.

With the <> syntax, you declare something that is just as short as the raw type declaration, but its equivalent to writing new ArrayList()

OOh joy! I can re-release all my games with Java 7 in them now :slight_smile:

Cas :slight_smile:

I’m excited for the Strings in switch, the Xrender pipeline, fork/split, NIO.2, and the pretty new javadoc look ;D

SDP networking looks interesting :slight_smile: anyone care to do some benchmarks?

Thanks for clearing this up. I was under the impression that all type information was removed after compiling because of type erasure. And that creating a raw typed ArrayList would end up being the same. However it seems that generics information is kept on fields, return types and parameters.

However I think I will stick to creating raw type objects until we switch to Java 7 because defining the type twice is just god damn ugly and I can not thing of a real world situation where it will hurt.

FINALLY. God finally
But they still use frames… I mean frames are so bad, they are actually not even valid anymore in html5, or so I’ve heard

That’s TERRIBLE! That’s as if Java 7 shipped in September instead of today T_T

Jizzzzz in my pants!

I will stick with J2ME / 1.4.2 for games. :slight_smile:

I can’t wait to use it for a server deployment when AppEngine supports it.

I know right?!? NetBeans supported Java 7 before Java 7 was even released. Unfortunately I don’t use NetBeans so that doesn’t help me xD Right now I just have jre 7 and jdk 7 installed and eclipse opens and works fine, but I haven’t tried any of the new language features with it yet.

1.4.2!?!?!?!?

Is there at least a beta I can use so I can calm my quivering and anticipating fingers?

That is a good question… TO GOOGLE!

EDIT: Couldn’t find one :confused:

There is a beta.

http://wiki.eclipse.org/JDT/Eclipse_Java_7_Support_(BETA)

I tried that and I couldn’t get it to work… ლ(ಠ益ಠლ) Eclipse y u no support Java 7

Because that would make sense :confused:

More likely because they have to implement their own compiler to work with it.

Oh my god! <3 the cute face :stuck_out_tongue: