Improve IterableType implementation.

Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
This commit is contained in:
Michael Nebel
2022-11-07 10:29:07 +01:00
parent d6ae1ef6f2
commit decfcdd82a

View File

@@ -12,9 +12,9 @@ private class IterableType extends Class {
private Type elementType;
IterableType() {
exists(Method m, Type return, GenericType t, Type et, int position | m.getDeclaringType() = t |
exists(Method m, RefType return, GenericType t, Type et, int position | m.getDeclaringType() = t |
return = m.getReturnType() and
return.getName().matches("Iterator%") and
return.getSourceDeclaration().hasQualifiedName("java.util", "Iterator") and
et = return.(ParameterizedType).getTypeArgument(0) and
t.getTypeParameter(position) = et and
instantiates(this, t, position, elementType)