aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist
diff options
context:
space:
mode:
authorShigeru Chiba <chibash@users.noreply.github.com>2021-04-26 02:35:45 +0900
committerGitHub <noreply@github.com>2021-04-26 02:35:45 +0900
commit5fade7ee6e4a75f0100175badfc95cfb36d685da (patch)
treee10a0508c2515574adda80df767208598a6d97d8 /src/main/javassist
parentf0c343a4b53b366f798620a3527f0958e929396f (diff)
parenta30320948978d8d9610c10fce996ee50ff57d553 (diff)
downloadjavassist-5fade7ee6e4a75f0100175badfc95cfb36d685da.tar.gz
javassist-5fade7ee6e4a75f0100175badfc95cfb36d685da.zip
Merge pull request #306 from nschaefe/master
fix issue 305: CodeConverter.replaceArrayAccess leads to java.util.ConcurrentModificationException
Diffstat (limited to 'src/main/javassist')
-rw-r--r--src/main/javassist/bytecode/analysis/Type.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main/javassist/bytecode/analysis/Type.java b/src/main/javassist/bytecode/analysis/Type.java
index db02df35..33dc81f3 100644
--- a/src/main/javassist/bytecode/analysis/Type.java
+++ b/src/main/javassist/bytecode/analysis/Type.java
@@ -15,9 +15,7 @@
*/
package javassist.bytecode.analysis;
-import java.util.HashMap;
-import java.util.IdentityHashMap;
-import java.util.Map;
+import java.util.*;
import javassist.ClassPool;
import javassist.CtClass;
@@ -496,24 +494,26 @@ public class Type {
if (typeMap == null||typeMap.isEmpty())
alterMap.clear();
- for (String name:alterMap.keySet())
+ Iterator<String> it = alterMap.keySet().iterator();
+ while (it.hasNext()) {
+ String name = it.next();
if (!typeMap.containsKey(name))
- alterMap.remove(name);
+ it.remove();
+ }
// Reduce to subinterfaces
// This does not need to be recursive since we make a copy,
// and that copy contains all super types for the whole hierarchy
- for (CtClass intf:alterMap.values()) {
- CtClass[] interfaces;
+ Collection<CtClass> interfaces = new ArrayList<>();
+ for (CtClass intf : alterMap.values()) {
try {
- interfaces = intf.getInterfaces();
+ interfaces.addAll(Arrays.asList(intf.getInterfaces()));
} catch (NotFoundException e) {
throw new RuntimeException(e);
}
-
- for (CtClass c:interfaces)
- alterMap.remove(c.getName());
}
+ for (CtClass c : interfaces)
+ alterMap.remove(c.getName());
return alterMap;
}