Skip to content

Commit d95f2e2

Browse files
Treiblesschorlectrueden
authored andcommitted
Avoid duplicate types in TypeVarInfo
1 parent 8cbe0d1 commit d95f2e2

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/main/java/org/scijava/util/Types.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,12 +1302,12 @@ private static class TypeVarInfo {
13021302

13031303
private final TypeVariable<?> var;
13041304
private final Type[] upperBounds;
1305-
private List<Type> types;
1305+
private Set<Type> types;
13061306

13071307
public TypeVarInfo(final TypeVariable<?> var) {
13081308
this.var = var;
13091309
this.upperBounds = var.getBounds();
1310-
this.types = new ArrayList<>();
1310+
this.types = new HashSet<>();
13111311
}
13121312

13131313
/**
@@ -1351,13 +1351,12 @@ public boolean fixBounds(final Type bound) {
13511351

13521352
// make sure that all of the types that already fit in this variable
13531353
// before the variable was fixed still are allowed by the type variable.
1354-
final List<Type> temp = types;
1354+
final Set<Type> temp = types;
13551355
temp.add(bound);
1356-
types = new ArrayList<>();
1356+
types = new HashSet<>();
13571357
for (final Type type : temp) {
13581358
if (!allowType(type)) return false;
13591359
}
1360-
13611360
return true;
13621361
}
13631362

0 commit comments

Comments
 (0)