[java-intentions] Test for intention on guard type mismatch

GitOrigin-RevId: b34a0cd0671483151e4db2e0c14df115d471e108
This commit is contained in:
Tagir Valeev
2025-01-17 10:28:41 +01:00
committed by intellij-monorepo-bot
parent b0d19b0fc2
commit e4d0585b15
2 changed files with 26 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
// "Wrap using 'Boolean.parseBoolean()'" "true-preview"
public class TestGuard {
public void ahem(Object obj) {
switch(obj) {
case String s when Boolean.parseBoolean(foo(s)) -> {}
default -> {}
}
}
private String foo(String s) {
return "false";
}
}

View File

@@ -0,0 +1,13 @@
// "Wrap using 'Boolean.parseBoolean()'" "true-preview"
public class TestGuard {
public void ahem(Object obj) {
switch(obj) {
case String s when <caret>foo(s) -> {}
default -> {}
}
}
private String foo(String s) {
return "false";
}
}