aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/bytecode
diff options
context:
space:
mode:
authorUser <s9nlscha@stud.uni-saarland.de>2020-03-24 16:20:23 +0100
committerUser <s9nlscha@stud.uni-saarland.de>2020-03-24 16:20:23 +0100
commita30320948978d8d9610c10fce996ee50ff57d553 (patch)
tree6200fc08f6bbebc8975cc10c40de818c77751dd6 /src/main/javassist/bytecode
parent44e777f0410d6c968b75f331ba4d82e4288b5ddc (diff)
downloadjavassist-a30320948978d8d9610c10fce996ee50ff57d553.tar.gz
javassist-a30320948978d8d9610c10fce996ee50ff57d553.zip
fix CodeConverter.replaceArrayAccess leads to java.util.ConcurrentModificationException
Diffstat (limited to 'src/main/javassist/bytecode')
-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;
}