MockReferenceType (Class<?> type) { MockReferenceType refType = myCachedClasses.get(type); // Do not use computeIfAbsent as concurrent update is possible if (refType == null) { refType = type.isArray() ? new MockArrayType(MockType.createType(this, type.getComponentType())) : type.isInterface() ? new MockInterfaceType(this, type) : new MockClassType(this, type); myCachedClasses.put(type, refType); } return refType; }