Skip to content

Commit e868cd2

Browse files
Treiblesschorlegselzer
authored andcommitted
Avoid duplicate types in TypeVarInfo
1 parent bbff91f commit e868cd2

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
@@ -1300,12 +1300,12 @@ private static class TypeVarInfo {
13001300

13011301
private final TypeVariable<?> var;
13021302
private final Type[] upperBounds;
1303-
private List<Type> types;
1303+
private Set<Type> types;
13041304

13051305
public TypeVarInfo(final TypeVariable<?> var) {
13061306
this.var = var;
13071307
this.upperBounds = var.getBounds();
1308-
this.types = new ArrayList<>();
1308+
this.types = new HashSet<>();
13091309
}
13101310

13111311
/**
@@ -1349,13 +1349,12 @@ public boolean fixBounds(final Type bound) {
13491349

13501350
// make sure that all of the types that already fit in this variable
13511351
// before the variable was fixed still are allowed by the type variable.
1352-
final List<Type> temp = types;
1352+
final Set<Type> temp = types;
13531353
temp.add(bound);
1354-
types = new ArrayList<>();
1354+
types = new HashSet<>();
13551355
for (final Type type : temp) {
13561356
if (!allowType(type)) return false;
13571357
}
1358-
13591358
return true;
13601359
}
13611360

0 commit comments

Comments
 (0)