`new` keyword messes with ternary operator when used in condition
Closed this issue · 2 comments
felixhao28 commented
Description
public class A {
void f() {
String sex = new Random().nextInt(2) == 0 ? "female" : "male";
String sex = new Random().nextInt(2) ? "female" : "male";
String sex = Random().nextInt(2) ? "female" : "male";
String sex = new Random() ? "female" : "male";
}
}
Expected behavior: [What you expect to happen]
The first string in "true branch" should be recognized as string.quoted.double.java
, like in the third line.
sadikovi commented
Can you include the language-java version that you are testing against?
felixhao28 commented