Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When it comes to popular languages on the JVM, it doesn't go before Kotlin as Scala was never a popular language to begin with.

One thing I and a lot of people are missing is annotations, with them data classes in Kotlin are useful for JPA/REST/AMQP/etc DTOs. Another convenience would be the ability to add at least mapping methods like in Kotlin or implement interfaces (Serializable anyone?)

Java records are going to be yet another barely used feature.



Record are product types, with union types (sealed types in Java speak) you get algebraic data type, you can take a look to SML to understand why there will be used a lot.

Record have an automatic way to propagate annotations from the record component to the generated methods/fields and comes with native support of serialization (like enums).


Could you show an example of it? In none of the materials published so far there is anything even remotely similar to what you are suggesting.


http://cr.openjdk.java.net/~briangoetz/amber/datum.html

There you can read about algebraic data types in java, in Java 14 you get preview for records in Java 15 probably you'll get preview for sealed types - they were developed together for some time, only recently there was a split.


Where did you get the idea that records can't use annotations, have methods, or implement interfaces?:

"Beyond the restrictions above, records behave like normal classes: they can be declared top level or nested, they can be generic, they can implement interfaces, and they are instantiated via the new keyword. The record's body may declare static methods, static fields, static initializers, constructors, instance methods, and nested types. The record, and the individual components in a state description, may be annotated."

https://openjdk.java.net/jeps/359


Scala is still far more more popular than Kotlin. https://redmonk.com/sogrady/2019/07/18/language-rankings-6-1...

Scala 13th, Kotlin 20th.


I know Redmonk has reasonably believable language rankings, but a recent JVM ecosystem survey says otherwise - https://snyk.io/blog/kotlin-overtakes-scala-and-clojure-to-b...


I highly doubt they are going to be an unused feature, as Java is full of POJO's

I expect the current annotation-based libraries will start supporting record classes too.


It is full of ANNOTATED POJOs. Those records in their current form are useless for 95% of POJO use cases.


records can have annotations


Are you saying that Scala isn't popular, but Kotlin is? If so, what threshold are you using for "popular", that you think Kotlin exceeds but Scala doesn't?



Interesting survey, any ideas about what the audience of the survey was? (For trying to understand what kind of biases it might have in regards to non-Java languages)


I think being the recommended language for Android development makes it pretty popular.


Replying late, so you probably won't see this. Replying anyway, so I look less stupid in the future.

The survey SureshG put forward (in a post parallel to yours) shows Kotlin twice the size of Scala (which surprised me), and Java something like 15 times the size of Kotlin. So to say that Kotlin is popular, but Scala isn't, seems to me to be drawing the line in a fairly arbitrary place. It seems more reasonable to say that neither is popular, or that both are.

"But Android" you say. Well, that will make Kotlin pretty popular, but it hasn't yet. In the future, you'll be right. That's why I added this. In the future, my post is going to look pretty silly without this context.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: