Skip to content

Commit

Permalink
Fix for #1249: use type argument(s) given; don't assume matching count
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Apr 19, 2021
1 parent 724f552 commit b7aa3fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,12 @@ public void testStaticMethod12() {
assertEquals("Parameter type should be resolved", "java.util.Collection<? extends java.lang.String>", printTypeName(m.getParameters()[0].getType()));
}

@Test // https://github.com/groovy/groovy-eclipse/issues/1249
public void testStaticMethod13() {
String contents = "Comparator.<String>comparing{it.length()}";
assertType(contents, "comparing", "java.util.Comparator<java.lang.String>");
}

@Test
public void testStaticMethodOverloads1() {
String contents =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ public static GenericsMapper gatherGenerics(final List<ClassNode> argumentTypes,
}
mapper.allGenerics.add(resolved);

if (methodGenerics != null && methodGenerics.length > 0) { assert methodGenerics.length == ugts.length;
if (methodGenerics != null && methodGenerics.length > 0) {
// method generics are explicitly defined
for (int i = 0; i < ugts.length; i += 1) {
for (int i = 0, n = Math.min(ugts.length, methodGenerics.length); i < n; i += 1) {
resolved.put(ugts[i].getName(), methodGenerics[i].getType());
}
} else if (argumentTypes != null) {
Expand Down

0 comments on commit b7aa3fb

Please sign in to comment.