Skip to content

Commit

Permalink
perf: handle some concurrency in ModelSet (#3736)
Browse files Browse the repository at this point in the history
  • Loading branch information
dya-tel authored Dec 22, 2020
1 parent b6ec8a3 commit 3435fac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/spoon/support/util/ModelSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.Serializable;
import java.util.AbstractSet;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashSet;
Expand All @@ -35,7 +36,7 @@ public abstract class ModelSet<T extends CtElement> extends AbstractSet<T> imple
private final Set<T> set;

protected ModelSet(Comparator<? super CtElement> comparator) {
set = new TreeSet<>(comparator);
set = Collections.synchronizedSet(new TreeSet<>(comparator));
}

protected abstract CtElement getOwner();
Expand Down

0 comments on commit 3435fac

Please sign in to comment.