News for hackers. Stuff that matters.
Re:JEP draft: Exception handling in switch by grishka on Friday April 19, 2024 @05:14PM (#40091980)
English isn't my native language but I read that as "in case it throws this type of exception" so "case throws" makes perfect sense to me.
Re:JEP draft: Exception handling in switch by NoahKAndrews on Saturday April 20, 2024 @11:19AM (#40098029)
But the throws keyword means "this can throw", it's not used to actually handle exceptions at all. Exception handling always uses catch. I think breaking that pattern would be a terrible idea, even if you can make sense if it with English grammar
Re:JEP draft: Exception handling in switch by grishka on Monday April 22, 2024 @06:04AM (#40112845)
Make it "case threw" then lol. But then this isn't the first time a keyword in Java means different things in different contexts. Like "final", which means that a field or variable can't be modified but on a class it means it can't be extended and on a method that it can't be overridden.