KT-48822: Fixes ConcurrentModificationException in AsmTypes

AsmTypes#getType() could be called from multiple threads, which causes CME sometimes.
Should guard TYPES_MAP modification.
This commit is contained in:
Aleksandr Kutashov
2022-08-18 12:53:55 +03:00
committed by Alexander Udalov
parent 79686ba242
commit a74f289844
@@ -14,9 +14,10 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class AsmTypes {
private static final Map<Class<?>, Type> TYPES_MAP = new HashMap<>();
private static final Map<Class<?>, Type> TYPES_MAP = new ConcurrentHashMap<>();
public static final Type OBJECT_TYPE = getType(Object.class);
public static final Type JAVA_STRING_TYPE = getType(String.class);