class SwitchGuard { static boolean check(String s) throws Exception { return s.isEmpty(); } static String classify(Object o) { return switch (o) { case String s when check(s) -> "empty"; default -> "other"; }; } }