Skip to content

Commit 226e4a3

Browse files
committed
Reduce chances of CME when iterating class info cache
1 parent ddffe93 commit 226e4a3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

common/src/main/java/org/embeddedt/modernfix/util/ClassInfoManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ private static void doClear() {
7070
MixinEnvironment.getDefaultEnvironment().audit();
7171
try {
7272
ClassNode emptyNode = new ClassNode();
73-
classInfoCache.entrySet().removeIf(entry -> {
73+
List<Map.Entry<String, ClassInfo>> entries = new ArrayList<>(classInfoCache.entrySet());
74+
entries.stream().filter(entry -> {
7475
if(entry.getKey().equals("java/lang/Object"))
7576
return false;
7677
ClassInfo mixinClz = entry.getValue();
@@ -88,7 +89,7 @@ private static void doClear() {
8889
e.printStackTrace();
8990
}
9091
return true;
91-
});
92+
}).forEach(entry -> classInfoCache.remove(entry.getKey()));
9293
} catch (RuntimeException e) {
9394
e.printStackTrace();
9495
}

0 commit comments

Comments
 (0)