@@ -887,14 +887,14 @@ public void testClosure5() {
887887 }
888888
889889 @ Test
890- public void testClosure5a () {
890+ public void testClosure6 () {
891891 assumeTrue (isParrotParser ());
892892 String contents = "def fn = String[]::new" ;
893893 assertType (contents , "fn" , "groovy.lang.Closure<java.lang.String[]>" );
894894 }
895895
896896 @ Test
897- public void testClosure6 () {
897+ public void testClosure7 () {
898898 String contents =
899899 "void test(List<String> list) {\n " +
900900 " def array = list.stream().toArray {\n " +
@@ -905,7 +905,7 @@ public void testClosure6() {
905905 }
906906
907907 @ Test
908- public void testClosure6a () {
908+ public void testClosure8 () {
909909 assumeTrue (isParrotParser ());
910910 String contents =
911911 "void test(List<String> list) {\n " +
@@ -916,7 +916,7 @@ public void testClosure6a() {
916916 }
917917
918918 @ Test
919- public void testClosure6b () {
919+ public void testClosure9 () {
920920 assumeTrue (isAtLeastGroovy (30 ));
921921 String contents =
922922 "void test(List<String> list) {\n " +
@@ -927,7 +927,7 @@ public void testClosure6b() {
927927 }
928928
929929 @ Test // incorrect LHS type should not alter RHS type
930- public void testClosure6c () {
930+ public void testClosure10 () {
931931 String contents =
932932 "void test(List<String> list) {\n " +
933933 " Number[] array = list.stream().toArray(String[].&new)\n " +
@@ -937,7 +937,7 @@ public void testClosure6c() {
937937 }
938938
939939 @ Test // GROOVY-9803
940- public void testClosure7 () {
940+ public void testClosure11 () {
941941 for (String toSet : new String [] {"D.&wrap" , "Collections.&singleton" , "{x -> [x].toSet()}" , "{Collections.singleton(it)}" }) {
942942 String contents =
943943 "class C<T> {\n " +
@@ -963,27 +963,27 @@ public void testClosure7() {
963963 }
964964
965965 @ Test // https://github.com/groovy/groovy-eclipse/issues/1194
966- public void testClosure8 () {
966+ public void testClosure12 () {
967967 String contents = "Optional.of(1).map(Arrays.&asList).map{x -> x.first()}\n " ;
968968 assertType (contents , "asList" , "java.util.List<java.lang.Integer>" );
969969 assertType (contents , "x" , "java.util.List<java.lang.Integer>" );
970970 }
971971
972972 @ Test // https://github.com/groovy/groovy-eclipse/issues/1194
973- public void testClosure9 () {
973+ public void testClosure13 () {
974974 String contents = "Optional.of(1).map(Collections.&singletonList).map{x -> x.first()}\n " ;
975975 assertType (contents , "singletonList" , "java.util.List<java.lang.Integer>" );
976976 assertType (contents , "x" , "java.util.List<java.lang.Integer>" );
977977 }
978978
979979 @ Test // https://github.com/groovy/groovy-eclipse/issues/1194
980- public void testClosure10 () {
980+ public void testClosure14 () {
981981 String contents = "void test(Closure<List<Integer>> cl) {}\n " + "test(Arrays.&asList)\n " ;
982982 assertType (contents , "asList" , "java.util.List<java.lang.Integer>" );
983983 }
984984
985985 @ Test // https://github.com/groovy/groovy-eclipse/issues/1194
986- public void testClosure11 () {
986+ public void testClosure15 () {
987987 String contents = "import groovy.transform.stc.*\n " +
988988 "def m(@ClosureParams(value=SimpleType,options='java.lang.Integer') Closure c) {}\n " +
989989 "def <T> String test(T t) {}\n " +
@@ -996,22 +996,25 @@ public void testClosure11() {
996996 }
997997
998998 @ Test // https://github.com/groovy/groovy-eclipse/issues/1198
999- public void testClosure12 () {
999+ public void testClosure16 () {
10001000 assumeTrue (isParrotParser ());
10011001 String contents = "Optional.of(21).map(num -> num * 2).get()\n " ;
10021002 assertType (contents , "get" , "java.lang.Integer" );
10031003 assertDeclaringType (contents , "get" , "java.util.Optional<java.lang.Integer>" );
10041004 }
10051005
10061006 @ Test // https://github.com/groovy/groovy-eclipse/issues/1199
1007- public void testClosure13 () {
1007+ public void testClosure17 () {
10081008 String contents = "java.util.function.Function<Integer, List<Integer>> f = Arrays.&asList\n " ;
10091009 assertType (contents , "asList" , "java.util.List<java.lang.Integer>" );
10101010 }
10111011
10121012 @ Test // https://github.com/groovy/groovy-eclipse/issues/1199
1013- public void testClosure14 () {
1014- String contents = "def <T> String test(T t) {}\n " + "java.util.function.Function<Integer, String> f = this.&test\n " ;
1013+ public void testClosure18 () {
1014+ String contents =
1015+ "def <T> String test(T t) {}\n " +
1016+ "java.util.function.Function<Integer, String> f = this.&test\n " ;
1017+
10151018 int offset = contents .lastIndexOf ("test" );
10161019
10171020 MethodNode m = assertDeclaration (contents , offset , offset + 4 , "Search" , "test" , DeclarationKind .METHOD );
@@ -1020,16 +1023,44 @@ public void testClosure14() {
10201023 }
10211024
10221025 @ Test // https://github.com/groovy/groovy-eclipse/issues/1282
1023- public void testClosure15 () {
1026+ public void testClosure19 () {
10241027 String contents =
10251028 "def <T> void test(Iterator<T> it) {\n " +
1026- " it.forEachRemaining{e->}\n " +
1029+ " it.forEachRemaining{t->}\n " +
1030+ "}\n " ;
1031+ assertType (contents , "t" , "T" );
1032+ }
1033+
1034+ @ Test // https://github.com/groovy/groovy-eclipse/issues/1000
1035+ public void testClosure20 () {
1036+ String contents =
1037+ "void test(Collection<Integer> c) {\n " +
1038+ " boolean b = c.removeIf{i->false}\n " +
1039+ "}\n " ;
1040+ assertType (contents , "i" , "java.lang.Integer" );
1041+ }
1042+
1043+ @ Test // https://github.com/groovy/groovy-eclipse/issues/1000
1044+ public void testClosure21 () {
1045+ assumeTrue (isParrotParser ());
1046+ String contents =
1047+ "void test(Collection<Integer> c) {\n " +
1048+ " boolean b = c.removeIf(i->false)\n " +
10271049 "}\n " ;
1028- assertType (contents , "e " , "T " );
1050+ assertType (contents , "i " , "java.lang.Integer " );
10291051 }
10301052
10311053 @ Test
1032- public void testClosure16 () {
1054+ public void testClosure22 () {
1055+ String contents =
1056+ "void test(Collection<Integer> c) {\n " +
1057+ " boolean b = c.removeIf{Number n->}\n " +
1058+ "}\n " ;
1059+ assertType (contents , "n" , "java.lang.Number" );
1060+ }
1061+
1062+ @ Test
1063+ public void testClosure23 () {
10331064 String contents =
10341065 "void test(List list) {\n " +
10351066 " list.stream().map{e->}\n " +
0 commit comments