Skip to content

ArrayIndexOutOfBoundsException for method call with too few type arguments #1249

@eric-milles

Description

@eric-milles

Consider the following:

void test(Type[] array) {
  array.sort(true, Comparator.<Type>comparing({ it.foo }).reversed())
}

Type inferencing and syntax highlighting break down at "comparing" due to supplying one type argument for a method that expects two.

image

java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at org.eclipse.jdt.groovy.search.GenericsMapper.gatherGenerics(GenericsMapper.java:127)
	at org.eclipse.jdt.groovy.search.TypeLookupResult.resolveTypeParameterization(TypeLookupResult.java:248)
	at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.lookupExpressionType(TypeInferencingVisitorWithRequestor.java:2750)
	at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.handleSimpleExpression(TypeInferencingVisitorWithRequestor.java:2023)
	at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.handleSimpleExpression(TypeInferencingVisitorWithRequestor.java:2028)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions