Files
openide/java/java-tests/testData/inspection/dataFlow/fixture/BoxedBooleanMethodWithCast.java
T
Tagir Valeevandintellij-monorepo-bot 7b77a3c1ad [java-dfa] Correctly unbox variables for contract check
Fixes IDEA-343951 Warning about boolean value is always true is wrong

GitOrigin-RevId: 365f32fc0ff0fc293bf2608e3b0ad1bb3b58f040
2024-01-26 22:01:45 +00:00

19 lines
550 B
Java

public class BoxedBooleanMethodWithCast {
// IDEA-343951
public static boolean checkObjectType(Object object) {
if (object instanceof Boolean) {
final boolean booleanValue = meansTrue((Boolean) object);
return booleanValue;
}
return false;
}
public static void main(String[] args) {
System.out.println("True = " + checkObjectType(Boolean.TRUE));
System.out.println("False = " + checkObjectType(Boolean.FALSE));
}
public static boolean meansTrue(Boolean bool) {
return Boolean.TRUE.equals(bool);
}
}