Live data from Hacker News

Java 9 features announced

jaxenter.com

51–60 of 228 posts

Re: Java 9 features announced

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

And making your instance variables public doesn't solve that for you?

Re: Java 9 features announced

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

This doesn't solve the problem entirely or address your valid complaint, but it does do a good job of hiding it for now: http://projectlombok.org/features/GetterSetter.html

Re: Java 9 features announced

#54
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?

I'd worry about correctness more than performance. With a parser that's often used on remote documents, you really don't want there to be security flaws.

Re: Java 9 features announced

#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?

Re: Java 9 features announced

#56

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…

Is that not what final does? I'd be interested in seeing C#-like getters and setters. As long as they're just getting and setting, they're implied, but if you want to introduce a check or some other logic, you can do so without changing the signature of the class . Groovy does some of this, but it requires you to use the name of the field - ie. person.age will check for a getAge() method first, then fall back on the…

Methods that actually do something should be verbs, but if it's just reading a property it should look like it's just reading a property. And having all the methods on a class start with get* is a pain for autocompletion.

Re: Java 9 features announced

#57
post #51
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.

And making your instance variables public doesn't solve that for you?

States(properties) should never be public or it breaks encapsulation.That's why a language that allows a property to be a method under the hood is usefull, because the state is still encapsulated.

State changes can have desirable side effects.If you expose an instance variable directly it's harder to encapsulate that.

Of course there are exceptions. If you have a class that is meant to be only a parameter bag(in an rest API for instance),that's ok,imho.

Re: Java 9 features announced

#58
post #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...

No, that's not part of Spring. It would be implemented by a container. OSGi was a sort of failed attempt at standardizing it. Right now you have to pay for something like jrebel (worth it, IMO) to get hot swapping.

Re: Java 9 features announced

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

Re: Java 9 features announced

#60

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.
Post reply on HN