News for hackers. Stuff that matters.
Re:Java 27 Released by winrid on Tuesday September 15, 2026 @10:45AM (#49713358)
I have a couple 50k+ loc java projects written entirely by LLMs at this point that have never thrown an NPE.
Re:Java 27 Released by what_hn on Tuesday September 15, 2026 @10:54AM (#49713507)
Same here with go, then Again go doesn't throw!
Re:Java 27 Released by xdavidliu on Tuesday September 15, 2026 @11:35AM (#49714153)
surely 'throw a npe' means something very similar to something that Go does
Re:Java 27 Released by mahboi on Tuesday September 15, 2026 @03:08PM (#49717296)
It's a panic in Go, not an exception. In practice that's usually a whole process crash. You can catch panics and kinda use them like exceptions, but it's not conventional.
Re:Java 27 Released by samus on Wednesday September 16, 2026 @03:18AM (#49723083)
So the whole webserver dies instead of just a worker thread unwinding its stack?
Re:Java 27 Released by mahboi on Wednesday September 16, 2026 @01:01PM (#49729866)
Oh, net/http recovers from a panic inside a handler and sends error 500. I don't know if that was always the default. Where I worked before, our own Go servers didn't recover, and it did cause outages.

This is kinda bad practice. Go and Rust panics are similar, they aren't exceptions that you can safely recover from. Say there's a panic in the middle of modifying some global state like a database connection. Hence complaints about the net/http recover like https://github.com/golang/go/issues/25245 . But I guess they decided it's worse to let servers crash from trivial mistakes.

Re:Java 27 Released by samus on Thursday September 17, 2026 @03:08AM (#49737407)
I mean, it's a smaller issue in a K8s environment as it will just spin up a fresh pod.
Re:Java 27 Released by za3faran on Tuesday September 15, 2026 @02:19PM (#49716597)
Re:Java 27 Released by unscaled on Tuesday September 15, 2026 @04:06PM (#49718136)
Sure it does:

https://github.com/uber-go/nilaway

Not exactly the same solution as JSpecify, since it doesn't rely on annotations, but it's also more ergonomic.

I'm not comparing this to "null-restricted types", since that's a draft JEP that hasn't made it even into a preview feature. Go also had multiple proposals for explicit nilability in types, and while they probably have less prospect of ever seeing the light of day compared to Project Valhalla, as things currently stand, Go is in the same position as Java: They are both extremely prone to NEPs out-of-the-box and they both have external tooling that can help you avoid them.

Java null checkers have more comprehensive coverage potential compared to Go, but Go is the more ergonomic one here. You don't need a single extra annotation on your code.

Re:Java 27 Released by samus on Wednesday September 16, 2026 @03:22AM (#49723118)
That one works pretty much the same way as NullAway, which is kinda unsurprising because of the name and because of who made it.
Re:Java 27 Released by unscaled on Tuesday September 15, 2026 @03:53PM (#49717977)
Go panics.
Re:Java 27 Released by gf000 on Wednesday September 16, 2026 @02:09AM (#49722660)
It just swallows errors, so you don't even know about it!
Re:Java 27 Released by mahboi on Wednesday September 16, 2026 @04:02PM (#49732174)
I don't get why they didn't just do !/? syntax like in Rust. Or at least make it a compiler error to ignore err returns.