Skip to content

Commit

Permalink
Fix ConcurrentModificationException in TestMethodController
Browse files Browse the repository at this point in the history
  • Loading branch information
lkishalmi committed Nov 13, 2023
1 parent 7f6f105 commit 843fc08
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ private static void setTestMethodsImpl(StyledDocument doc, List<TestMethod> meth
doc.putProperty(TestMethodAnnotation.DOCUMENT_ANNOTATION_LINES_KEY, annotationLines);
}

Map<TestMethod, TestMethodAnnotation> removed = new HashMap<>(annotations);

methods.forEach(tm -> removed.remove(tm));

Set<TestMethod> added = new HashSet<>(methods);
Map<TestMethod, TestMethodAnnotation> removed = new HashMap<>(annotations);

removed.keySet().removeAll(added);
added.removeAll(annotations.keySet());

for (TestMethod method : added) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public void run(CompilationInfo info) throws Exception {
}

if (!cancel.get()) {
WORKER.post(() -> TestMethodController.setTestMethods(doc, methods));
List<TestMethod> updateMethods = new ArrayList<>(methods);
WORKER.post(() -> TestMethodController.setTestMethods(doc, updateMethods));
}
}
}
Expand Down

0 comments on commit 843fc08

Please sign in to comment.