Live data from Hacker News

Java 9 features announced

jaxenter.com

201–210 of 228 posts

Re: Java 9 features announced

#201
post #76
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.

There is an official JSON API: https://jcp.org/en/jsr/detail?id=353 But it is unclear how many of the existing implementations conform to it, and it definitely doesn't work toward your misguided One True JSON Implementation goal.

That's a Java EE API. I've been working with the Java SE and Java EE folks to make sure that a new version of that will sit on top of the core JDK 9 one.

Re: Java 9 features announced

#202

My Wishlist: 1. Fix Daemonization! Publish an official blessed and supported way of daemonizing processes. Yeah sure, you can use Apache commons-daemon and others of it's ilk. And it will work. But it will feel hacked together (at least it does to me). 2. Fix Dependency hell! Publish a blessed / supported / standard of supporting / managing different classloaders. Java has this great mostly unused mechanism (classloa…

Project Jigsaw (modularising Java itself and introducing a module system) will be a serious attempt at solving a part of this problem but may not land in its entirety for Java 9 (modularising the source code landed today on trunk). OSGi claims to solve the application layer part, but many developers I speak to have mixed results, primarily due tooling support etc.

Re: Java 9 features announced

#203
post #59
post #55

I thought one of the things promised in Java 9 was to finally fix the primitive mess, including all of the boxing and pointer chasing. Yet I can't find that here. I also thought that type reification was being researched. Does anyone know if either of these is still a thing?

Yes, they are both being worked on. They're just not sure they'll be ready in time for 9.

The project to watch here is project Valhalla - valhalla-dev AT openjdk DOT java DOT net. Indeed the full solution of value types will not land until Java 10, but Java 9 will hopefully contain the very useful Collection of primitives enhancement (you can currently only have Collections of Objects, primitives are auto boxed into their Object equivalents at much greater overhead).

Re: Java 9 features announced

#204
post #85

Earlier quoted context omitted.

Sorry to ask, but as a noob who just picked up Java, how do other languages address this issue? What's wrong with getters and setters?

To add another example to the list, Ruby lets you list which attributes can be read/written and which ones can only be read on top. Something like. class Car attr_reader :model, :company # only read attr_accessor :color # read and write end

It's worth noting that in Ruby the difference between attr_reader and attr_writer is not the same as read only and write only. You can write to something set with attr_reader. All attr_writer does is allow complete reassignment of that particular instance variable.

This is pretty trivial so bear with me... If you have something that looks like this...

    class Person
      attr_reader :children

      def initialize
        @children = []
      end
    end
You can then do this...

    x = Person.new
    x 
You will have then altered the value of @children without completely reassigning it.

Re: Java 9 features announced

#205
post #5

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

ZeroTurnaround have a payware product (that's highly acclaimed in this space) called JRebel. It swaps out bytecode directly as opposed to using Java's (somewhat broken) classloader mechanism.

Re: Java 9 features announced

#206
post #107

Earlier quoted context omitted.

ah, understood. have you been tracking shenandoah? http://openjdk.java.net/jeps/189

I have heard of it but haven't read up. I think it's great that someone is stepping up to address the issue. Interesting that both the authors listed in the JEP work for Red Hat.

Shenandoah is unlikely to see the light of production release until Java 10. I ran a very early piece on this - http://www.jclarity.com/2014/03/12/shenandoah-experiment-1-w... - really glad to see more experiments in this space. I'll add that G1 from Java 8u5 onwards is pretty darn good out of the box.

Re: Java 9 features announced

#207

Earlier quoted context omitted.

What particularly is your issue around GC fragmentation? I ask because I had issues previously, but it was "solved" by moving to the G1 GC, I didn't know if you have considered the same.

G1 still fragments and does long compacting stop the world GCs. G1 pause times are still too long. G1 still doesn't have enough throughput. It's bad enough that people who care aren't using G1 yet. They still use CMS and small heaps and are careful to prevent promotion and fragmentation. You basically end up benefiting from GC for short lived allocations, but pay dearly for using Java when managing state the collecto…

I'd be cautious of a 2013 report. G1 has had significant work put into it over the past year and is much improved in its latest incarnations. We've seen best results with Java 8u5+ (Disclaimer: I run a company that sells a GC analysis tool).

Re: Java 9 features announced

#208

Earlier quoted context omitted.

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?

Likely delivery timeframe for value types in Java 10. Definitely not Java 9. Source - many conversations with Brian Goetz et al.

Re: Java 9 features announced

#209

Does anyone know if project jigsaw will improve the startup time for JVM languages?

It will depend on howe small a profile the JVM language can run on. In theory you could run some JVM languages on the compact profile resulting in a n overall faster startup time.

Re: Java 9 features announced

#210
post #26

No language features?

There maybe some small ones, but the (and I think correct) decision was made to focus on the JVM for Java 9. Java 8 bought in enough language features to keep Joe/Jane Java developers happy (most bleeding edge folks moved to Scala or other languages).
Post reply on HN