Live data from Hacker News

Java 9 features announced

jaxenter.com

61–70 of 228 posts

Re: Java 9 features announced

#61
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.

Are you sure that's true? As you say, look at the "standard" API for XML parsing: a complete disaster. Dates, similar. Logging was slightly less disastrous because they took so much from Log4j, but they still made it unwieldy enough that the log4j guys ended up writing an API on top of that which everyone uses. Now, props where props are due: Sun crushed the collections APIs compared to other languages at the time. A…

XML parsers are so complicated because XML and the DOM are more complicated. A json parser can be simpler.

Re: Java 9 features announced

#62
A lightweight JSON API? Hopefully they don't consider the XML jdk monstrosity lightweight. Java SDKs haven't produced superior technology to OSS libraries for a decade, so I expect Jackson to still be better.

The http client was so basic in the JDK it has spawned TWO apache HttpClients projects.

Jigsaw... fool me three times? Wasn't this supposed to be in JDK7?

Re: Java 9 features announced

#63
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.

Groovy replaces package-scoped variables with private vars and autogen'd getter/setters. So much nicer.

Re: Java 9 features announced

#64

Still no solution for the GC fragmentation and pauses? Arbitrarily large heaps and data structures? They are going to improve lock performance, but do nothing to help people avoid locking like lightweight threads. Not waking up a thread and not locking is faster... It's weird how so many software projects completely lose sight of the fundamentals. I know I am biased due to how I use Java. I care very little for synta…

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 collector can't handle.

I have not closely reviewed this benchmark but this was one person's experience http://blog.mgm-tp.com/2013/12/benchmarking-g1-and-other-jav...

Re: Java 9 features announced

#65

Earlier quoted context omitted.

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…

Groovy does this, although frustratingly not with array accesses last I checked.

Re: Java 9 features announced

#66
post #40

Is it possible to have native JSON parsing with JNI bindings to make parsing faster, or will the overhead cancel out any boost in performance?

Why wouldn't you be able to write JSON parsing fast in Java natively? Even if you can't, it's precisely the kind of thing that would pay a large JNI penalty.

Re: Java 9 features announced

#67
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.

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?

In python the default is that things that look like attributes/properties REALLY are direct access. If you later need to shim them out into a function you use the @property decorator (and foo.setter if you need read/write)

    class Blah(object):
      foo = 2 # A normal property. Direct access

      @property
      def bar(self):
        return self.some_lookup_method()
    
      @bar.setter
      def bar(self, value):
        self.set_the_bar(value)

Re: Java 9 features announced

#68
post #49

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?

C# introduces the concepts of fields and properties. I dont remember which is which but I think properties are in fact getters and setters,without the verbose "object.getProperty()" syntax , you just write "object.property" and it's call a getter function or a setter function. Basically you keep states encapsulated without have to manually write methods,you just write methods when you need then. Java verbosity on tha…

> C# introduces the concepts of fields and properties.

This goes back to at least Eiffel (1985).

Re: Java 9 features announced

#69
post #16

Earlier quoted context omitted.

Replacing code while it's running. Currently this is possible but quite limited in the official JDK, you can only replace the contents of method bodies. Edit: Demo of it in action here, notch is rapidly developing a game in Eclipse by changing the code while it's running: https://www.youtube.com/watch?v=rhN35bGvM8c

There's always JRebel!

Not really.

http://zeroturnaround.com/blog/goodbye-liverebel/

Post reply on HN