Live data from Hacker News

Java 9 features announced

jaxenter.com

21–30 of 228 posts

Re: Java 9 features announced

#21

I had heard a rumor that there ware talks of user defined value types. Does anyone know if there is any hope for this?

It seems that it is almost in prototyping stage, the usual suspects have already written a sketch of a future proposal:

http://cr.openjdk.java.net/~jrose/values/values.html

Re: Java 9 features announced

#22
post #2

The lack of an official JSON API has been a huge sore point for quite some time and has spawned dozens of libraries re-implementing the same thing over and over (GSON, Jackson, and even my own nanojson). I do hope that we avoid the DocumentBuilderFactory mistakes of XML and just end up with One True JSON implementation this time.

I really don't see any benefit of introducing a JSON API into the JDK. Jackson works great already. Are they really going to make something that much better?

Re: Java 9 features announced

#23
post #9

a new json api to be released 2016. Hopefully by that time json is still relevant. I know most likely it will but at the pace of change that tech has, im not betting. is there any contender to json at the moment?

I don't think we'll be looking at a contender to JSON for quite some time (at least, for frontend/web consumable APIs). Being able to use it in JS directly pretty much guarantees its stability.

For other message protocols it's a different story. Each system has its own needs, so it's much harder to say.

Re: Java 9 features announced

#24
I see that their "Process API updates" still don't make it possible to get a NIO Pipe object for redirected stdin, stdout or stderr when ProcessBuilder.Redirect.PIPE is used. Maybe they'll fix that some day...

Re: Java 9 features announced

#25
post #5

I'm deeply missing hot swapping. I believed it could be included in java 9 but i think we have to wait...

Isn't this basically what Spring is for? I get that it's not included in the language itself, but that seems more like a feature that should be provided by a framework rather than the language itself...

Re: Java 9 features announced

#27
post #9

a new json api to be released 2016. Hopefully by that time json is still relevant. I know most likely it will but at the pace of change that tech has, im not betting. is there any contender to json at the moment?

JSON likely will be around as it is extremely simple (technologically) and extremely light (in terms of network usage). In order for a JSON killer to appear it would inherently have to be superior to JSON, and it is very hard as for what JSON is used for it does very well indeed.

JSON somewhat replaced XML, but that made sense since XML is more complex and a lot more expensive (both in terms of network AND processing).

I can see people building more complex obstractions on top of JSON in the next for years (essentially re-building what XML was, but in JSON) however I cannot really see JSON being entirely dethroned for what it is good at.

Re: Java 9 features announced

#28
post #11

Nothing pollutes java source more than getters and setters. I can't believe this still isn't being address. Wish they'd move in the direction Groovy has in this regard.

Amen. How about some language keywords like "readable" and "writeable"?

public class Foo { public readable int canSeeeMeButCantChange; public writeable int cantReadMe; public int existingBehavior; }

These are pretty simple changes to the compiler and verifier. You would make canSeeeMeButCantChange an invalid "left hand" variable in the compiler, and the verifier would have to check for any writes to the fields. cantReadMe would be an invalid right hand variable, and a similar check for the verifier. Any other public field behaves as normal.

Re: Java 9 features announced

#29

I had heard a rumor that there ware talks of user defined value types. Does anyone know if there is any hope for this?

It seems that it is almost in prototyping stage, the usual suspects have already written a sketch of a future proposal: http://cr.openjdk.java.net/~jrose/values/values.html

Awesome! Thanks. I don't know much about the path from idea to standardized feature with the JVM. Is there hope for it in Java 9 or is this much farther out in the future? Probably first and more importantly, what is the chance for this even ever happening?

Re: Java 9 features announced

#30
post #11

Nothing pollutes java source more than getters and setters. I can't believe this still isn't being address. Wish they'd move in the direction Groovy has in this regard.

Amen. How about some language keywords like "readable" and "writeable"? public class Foo { public readable int canSeeeMeButCantChange; public writeable int cantReadMe; public int existingBehavior; } These are pretty simple changes to the compiler and verifier. You would make canSeeeMeButCantChange an invalid "left hand" variable in the compiler, and the verifier would have to check for any writes to the fields. cantR…

The other "Missing feature" is null safe ".". Other languages have it, but I don't know what the technical name is... basically:

Integer val = some.other.chain.of.objects.value;

In Java, this code has a huge potential for NullPointerExceptions. Instead a new operator (yes, I know) like:

Integer val = some.?other.?chain.?of.?objects.?value;

If any of the intermediate objects are null, the whole assignment becomes null. This could be done with a smarter compiler (easy way), or a new JVM bytecode (probably 'better' but not easy).

Post reply on HN