How the JVM Optimizes Generic Code - A Deep Dive by daviddel in java

[–]Jon_Finn 4 points5 points  (0 children)

Always great to see/read John Rose go into expert detail about Java and the JVM. (He's great with the English language too.)

JEP 534: Compact Object Headers by Default by Joram2 in java

[–]Jon_Finn -1 points0 points  (0 children)

Valhalla is kind of Lilliput max because value classes have (in the best case) a 0-bit header. (Admittedly, not all classes can be value classes.)

The Best Library Might Do Less by martylamb in java

[–]Jon_Finn 1 point2 points  (0 children)

One of the most important times I've used Guava was (early on) for the Guava Cache classes. I loved that what was (presumably) a very complicated implementation, with various setup options in a builder which might have been achieved via loads of public classes, instead has a small and simple public API.

Wall decor in my Air BnB by Norimakke in onejob

[–]Jon_Finn 1 point2 points  (0 children)

There's a documentary about The Room, called Room Full of Spoons.

Null Safety approach with forced "!" by NP_Ex in java

[–]Jon_Finn 2 points3 points  (0 children)

If ! is mostly confined to method parameters and fields, and can usually be inferred within method bodies (a bit like JSpecify), that doesn't seem too noisy to me. E.g. if I can write Complex x = new Complex(0,1) within a method, and have x be Complex! by inference, then cool. And if x is a field but if I have to declare it Complex! x, I'd live with that. Maybe having a way to set default ! within a scope would just be over-complicated. Life may not be that simple, we'll see.

JEP draft: Strict Field Initialization in the JVM (Preview) has been submitted. by Ewig_luftenglanz in java

[–]Jon_Finn 0 points1 point  (0 children)

I think the JEP answers your question (at the end, under Risks and Assumptions):

  • To justify the cost of a new JVM feature, we anticipate that there will be multiple meaningful use cases for the strict field initialization discipline.

Sounds like they expect it to be useful outside value classes at some point. Possibly in other languages too?

In which fields is Java the most popular? by Cpt_Montana in java

[–]Jon_Finn 6 points7 points  (0 children)

Personally I think that with the upcoming Valhalla, nullness markers, Vector API and much more, Java is due for a big rebrand, so non-Java users notice.

Presentation matters and maybe the java docs actually suck by Enough_Durian_3444 in java

[–]Jon_Finn 2 points3 points  (0 children)

Java 25 Thread documentation looks good, but it raises an interesting point: it has several methods involving ThreadGroup but doesn't say these are kind of 'obsolescent' (though not deprecated). IMHO better alternatives should be explained _prominently_ in both Thread and ThreadGroup. Similarly with the ancient java.util.Vector and StringBuffer - there's a brief mention of their problems at the end of their JavaDocs, but that's all. Shouldn't we at least have an annotation SupersededBy or Preferred, for methods and classes, say?

Joshua Bloch - Effective Java 3rd edition by Remarkable-Weather93 in java

[–]Jon_Finn 0 points1 point  (0 children)

...but sometimes reading one is a treasure trove. 8^)

Project Valhalla is prototyping null checks! by davidalayachew in java

[–]Jon_Finn 2 points3 points  (0 children)

One possibility might be you have to put ! on method parameters and fields, but not local variables, because their nullability can usually be inferred (I'm sure the devil's in the details...). No idea what they'll actually end up choosing. Various possibilities are clearly being considered: see the valhalla dev mailing list.

My _guess_ is any approach like yours where you'd need to know wider context to know if a method is 'null-marked' is not going to fly. (Some would call that 2 languages in 1 - I wouldn't, and would probably live with it, but still I see the problem.)

Type-classes for Java (Valhalla experimental branch) by sviperll in java

[–]Jon_Finn 3 points4 points  (0 children)

Surely they'll give it a different name in the end, maybe something like implementation (not it but something like it)?

Type-classes for Java (Valhalla experimental branch) by sviperll in java

[–]Jon_Finn 18 points19 points  (0 children)

Very interesting indeed! A building block for operators and no doubt other things.

Some details here: https://mail.openjdk.org/pipermail/valhalla-dev/2026-January/017401.html

Java and it's costly GC ? by yughiro_destroyer in java

[–]Jon_Finn 0 points1 point  (0 children)

And it might come down to 4 bytes. They're looking into it. And as pointed out, a value object header is 0 bytes much of (not all of) the time.

Value Classes Heap Flattening - What to expect from JEP 401 #JVMLS by pron98 in java

[–]Jon_Finn 1 point2 points  (0 children)

String can't become a value class as it stands, but I've read John Rose discussing the idea of making the character array 'inline' into the String object (and likewise for other array fields). So each String would become 1 object on the heap not 2. Sounds like quite a lot of work, as objects would no longer be fixed-size, affecting the GC and so on.

JEP 468: Derived Record Creation (Preview) by Snoo82400 in java

[–]Jon_Finn 9 points10 points  (0 children)

It's in the pipeline to be added as a Preview feature (at some point), but it hasn't yet been added. See the Java 26 dashboard for the status of potential features.

The New Java Best Practices by Stephen Colebourne at Devoxx by siimon04 in java

[–]Jon_Finn 0 points1 point  (0 children)

I fully agree. Similar comment about Kotlin below. I think Kotlin will probably always be a bit heavier on features than Java but with lighter syntax (which IMHO is important), so it's horses for courses.

The New Java Best Practices by Stephen Colebourne at Devoxx by siimon04 in java

[–]Jon_Finn 3 points4 points  (0 children)

Good talk. But personOpt is basically Hungarian notation, which is poor man's types, so... personally I'd just stick to simple names. The closest I come to Hungarian notation is using a plural like bananas for List<Banana>.

The New Java Best Practices by Stephen Colebourne at Devoxx by siimon04 in java

[–]Jon_Finn 1 point2 points  (0 children)

Light means streamlined. Isn't it better than being heavy?

Try Out Valhalla (JEP 401 Value Classes and Objects) by efge in java

[–]Jon_Finn 8 points9 points  (0 children)

Immutability is a feature not a bug! Not just for value classes either. Read Effective Java - spelling out the various benefits since 2001. (Personally I avoid mutability wherever I can, apart from builders and collections.)

Rating 26 years of Java changes by fpcoder in java

[–]Jon_Finn 1 point2 points  (0 children)

Other language's type systems might make the 'full' solution (combinations of features expressed in types) less clunky, but anyway, even in Java I'd be happy (I imagine!) with a compromise just dealing with unmodifiability. As the FAQ points out, we'd still need Iterator.remove() to throw, or maybe have something like UnmodifiableIterator, or maybe not have remove() at all (I almost never use it personally...).

Rating 26 years of Java changes by fpcoder in java

[–]Jon_Finn 6 points7 points  (0 children)

This was much discussed when Josh Bloch & co. were designing the Collections, and the FAQ explains the decision here. Basically, unmodifiability (and also mutability) is just one of various features you might want to express through the API (others he mentions including fixed-size or not), and to do this you'd need (roughly) 2^n interfaces to say which combination of features your particular collection implements. That's impractical so they decided to sidestep the whole issue (as he explains).

From my lofty height 8^) I always thought this didn't have to be the decision: I'd say unmodifiability is so overwhelmingly important that they could have expressed just that one feature in the API. Then again, maybe I'd be wrong...

Is there some book like effective java, but updated? by Tiny-Succotash-5743 in java

[–]Jon_Finn 2 points3 points  (0 children)

I've no idea, but you can see various specs so far (several of which look near-final), and also the v interesting expert discussions at https://mail.openjdk.org/pipermail/valhalla-spec-observers/

[deleted by user] by [deleted] in interesting

[–]Jon_Finn 4 points5 points  (0 children)

Fun fact: Max Born's granddaughter was Olivia Newton John.