import java.util.function.Function; class Main { private static void localVariableDeclaration() { var a = 1; var b = 2, c; var d[] = new int[4]; var d1 = new int[] {4}; var d2 = new int[4]; var e; var f = { 6 }; var g = (g = 7); var x = (x = 1) + 1; var y = new Object[] {y = null}; var z = baz(z = 1); var zz = zz; zz.hashCode(); } static int baz(Object o) {return 42;} private static void localVariableType() { var a = 1; int al = a; var b = java.util.Arrays.asList(1, 2); Integer bl = b.get(0); var c = "x".getClass(); Class cl = c; var d = new Object() {}; var e = (CharSequence & Comparable) "x"; int el = e.compareTo(""); var f = () -> "hello"; var fp = (() -> "hello"); var m = Main::localVariableDeclaration; var g = null; var runnable = true ? () -> {} : () -> {}; Function f1 = (var var) -> var; var h = localVariableDeclaration(); var cond = true ? null : null; } private void forEachType(String[] strs, Iterable it, Iterable raw) { for (var str: strs) { String s = str; } for (var str: it) { String s = str; str = s; } for (var o: raw) { Object obj = o; } for (var v: ) {} for (var v: null) {} for (var v: (v)) {} } private void tryWithResources(AutoCloseable c) throws Exception { try (var v = null) { } try (var v = c; var v1 = c) { } } class Hello {} private void checkUnresolvedTypeInForEach(String[] iterableStrings, Hello iterableExistingHello, World iterableUnresolvedWorld) { for (String arg: iterableStrings) { } for (String arg: iterableExistingHello) { } for (String arg: iterableUnresolvedWorld) {} } interface A {} interface B {} void test(Object x) { java.util.Optional.of((A & B)x).ifPresent(valueOfAandB -> { for(Object foo : valueOfAandB) { System.out.println(foo); } }); java.util.Optional.of((A & World)x).ifPresent(valueOfAandUnresolvedWorld -> { for(Object foo : valueOfAandUnresolvedWorld) { System.out.println(foo); } }); } }