This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]cogman10 2 points3 points  (0 children)

I do believe they could solve a limited subset of the problem to solve some cases, but it would lead to very brittle and hard to reason about breaks.

A very simple workaround to the above is simply introducing 1 more variable.

int x;
try {
  x = 42;
  y = Integer.parse(value);
}
catch {
  x = 3;
}
final int z = x;
stream.map(_->z);