Live data from Hacker News

Java 16

jdk.java.net

161–170 of 327 posts

Re: Java 16

#161

The language is getting fragmented: value-based classes, records. I wish the features were introduced still keeping one kind of objects, instead of splitting the universe into 3 kinds of objects (usual objects, value-based objects, records). The feature I am awaiting most is the Project Loom.

Yeah, same feeling here. The special-casing feels off. They must have had very good reasons to do that, I just haven't seen them outlined yet.

The new object type being promoted from preview feature is just the record type. Records are still Objects, they just provide a low ceremony way to create an immutable object holding some data.

I see these record classes in the same category as enum objects, an evolution of the language to improve developer ergonomics.

Upcoming is inline-classes (previous called value types.) When this happens we'll have a true "special" kind of Object, one that does not have any identity. The motivation here is mostly performance. The details are available in Brian Goetz "State of Valhalla" update https://cr.openjdk.java.net/~briangoetz/valhalla/sov/01-back...

Re: Java 16

#163
Someone asked where is Java still used. Well, elasticsearch, signal for android, mockito, j-unit.

Closed source projects include Airbnb, Uber, eBay, Pinterest, Groupon, Spotify, Intel, Symantec

Re: Java 16

#164
post #12

Very cool to see that Scala continues to have a huge impact on Java’s roadmap. Records and Sealed Classes are borrowed from Scala. Could be not the best news for new Scala adoption, but good news for developers having better abstractions in Java Edit: Kotlin, and other languages should also mentioned since they also include similar features. I still think Scala has had the most influence over the years.

I spent a few years moving to Scala but have come back as Java really does everything I want now. Just Akka is a bit clunky.

Re: Java 16

#165

Earlier quoted context omitted.

I did, the main issue is that jaotc doesn't do any pruning of the unused methods, so it generates too much assembly code. If i remember correctly, compiling just guava was to close to 1 gig. GraalVM native image is far better, it "compiles" more slowly but the resulting executable is not too big.

I think that is by design due to reflection needs. Hard to prune unused code when it might be called reflectively at any time.

Which is why GraalVM requires you to explicitly mention what types should be available for reflection.

Re: Java 16

#166

As a student most of the way through a Java course, I'm wondering what Java is still used for. Java applets are dead, Android is moving on to Kotlin (apparently Google got in legal trouble with Oracle even though Java is "open source?"), and I can't think of any desktop applications that use Java anymore. Java is supposed to be able to "run anywhere," yet C++ is more portable because it doesn't require the JVM to run…

> C++ is more portable because it doesn't require the JVM to run Java is portable BECAUSE of the JVM. If a new computer architecture hits the scene, once someone writes a JVM for it your .class files will run on it (probably). Your C++ program, however, will definitely not run and you'll need to recompile it with a compiler that targets that new architecture. The same compiled Java code will(should) run on a Mac or a…

For a couple decades, x86 was absolutely dominant and there were no new architectures of any importance outside specific niches. Once you dealt with the OS specific oddities (which java also helped with), C++ was highly portable.

Re: Java 16

#167

Still on Java 8 at work :-/

8 is still “modern” Java right? 11 didn’t add a ton ton for most developers.

I'd say that now with 15 adding records and instanceof pattern, Java 8 is finally looking pretty dated!

You're also missing out on var and switch expressions, which are very visible features (as are records and instanceof patterns), so the difference should be obvious between a Java 8 codebase and a Java 15 one.

Re: Java 16

#168

As a student most of the way through a Java course, I'm wondering what Java is still used for. Java applets are dead, Android is moving on to Kotlin (apparently Google got in legal trouble with Oracle even though Java is "open source?"), and I can't think of any desktop applications that use Java anymore. Java is supposed to be able to "run anywhere," yet C++ is more portable because it doesn't require the JVM to run…

[deleted]

Re: Java 16

#169

Looks like no type aliases still? Does anyone know if type aliases are anywhere on the road map for Java? Is there some philosophical objection to them?

Considering how heavily they have borrowed from Scala lately, I would have expected them to pick this up. I found them quite useful in Scala (and in Golang as well).

Java is not borrowing from just Scala, it's borrowing from all languages and adding its all twists to things, just like Scala itself has always done (it's cleary inspired by Java itself, ML and Haskell, probably more).

Re: Java 16

#170

Earlier quoted context omitted.

> As a student most of the way through a Java course, I'm wondering what Java is still used for. A huge majority of all code behind services, websites, and businesses you interact with every day. From Google, Facebook, Apple, and Twitter to your bank, and from Android to you favorite new unicorn. Of the top 25 unicorns "20 use Python; 19 use Java; eight use Kotlin. Coinbase was the only top-ten unicorn found to use S…

> Java applets have been dead on arrival The only successful Java applet I know was Runescape (if that was an applet? it ran in browser), an RPG game that ran in Java in the browser, for 15 years or so roughly afaik, today they switched to a non browser based client instead. Other Java applets almost never worked for some reason. Like, sometimes I'd visit a website about some mathematical topic, and the whole browser…

The only applet I know of outside the early few years of hype that still works and does something useful is Falstad's circuit simulator. https://www.falstad.com/circuit/
Post reply on HN