Skip to content

Commit 8041542

Browse files
committed
Java: Make sure that IterableTypes has a unique iterator.
1 parent 2f12ccc commit 8041542

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

java/ql/src/utils/modelgenerator/internal/CaptureTypeBasedSummaryModels.qll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ private class IterableClass extends Class {
1212
private Type elementType;
1313

1414
IterableClass() {
15-
exists(Method m, RefType return, GenericType t, Type et, int position |
16-
m.getDeclaringType() = t
17-
|
18-
return = m.getReturnType() and
19-
return.getSourceDeclaration().hasQualifiedName("java.util", "Iterator") and
20-
et = return.(ParameterizedType).getTypeArgument(0) and
21-
t.getTypeParameter(position) = et and
22-
instantiates(this, t, position, elementType)
23-
)
15+
elementType =
16+
unique(Type et |
17+
exists(Method m, RefType return, GenericType t, int position | m.getDeclaringType() = t |
18+
return = m.getReturnType() and
19+
return.getSourceDeclaration().hasQualifiedName("java.util", "Iterator") and
20+
t.getTypeParameter(position) = return.(ParameterizedType).getTypeArgument(0) and
21+
instantiates(this, t, position, et)
22+
)
23+
)
2424
}
2525

2626
/**

0 commit comments

Comments
 (0)