I have written some code that I believe is likely to throw an exception. But an IDEA Ide #IC-231.8109.175 surprisingly show me warning Condition 'id != Thread.currentThread().threadId()' is always 'false'
.
I am doubtful about the accuracy of this warning and interested why it really always evaluates to false.
import java.util.stream.IntStream;
public class Main {
public static void main(String[] args) {
final long id = Thread.currentThread().threadId();
var g = IntStream.range(0, 100_000_000).boxed()
.parallel()
.map(k -> {
if (id != Thread.currentThread().threadId()) {
throw new RuntimeException();
}
return k + 1;
}).findAny();
System.out.println(g);
}
}