News for hackers. Stuff that matters.
Re:JVM exceptions are weird: a decompiler perspective by Akronymus on Monday November 10, 2025 @11:07AM (#45877279)
> In this case the surprise factor comes in, because we are used to equating finally block with cleanup and I concur that many would trip on this the first time. But if you gave this exercise some time and asked "what should happen if finally block contains control flow statements?" the reasonable answer should be "take precedence", because the behavior would be surprising/cursed otherwise.

Wouldn't the reasonable behaviour be "throw a compiler error"?

Re:JVM exceptions are weird: a decompiler perspective by friendzis on Monday November 10, 2025 @03:23PM (#45880471)
Can the compiler perform sufficiently deep static analysis to cover all possible cases? At least in Java it is by definition impossible.
Re:JVM exceptions are weird: a decompiler perspective by Akronymus on Monday November 10, 2025 @04:05PM (#45880918)
I don't see why not. If it's in a finally block, disallow control flow. Or am I missing something?
Re:JVM exceptions are weird: a decompiler perspective by taneq on Monday November 10, 2025 @08:08PM (#45882953)
If it's that hard to figure out what the code should do by looking at, then it's probably not a great thing to allow in the language.