boolean (@NotNull final PyClass pyClass) { final VirtualFile virtualFile = pyClass.getContainingFile().getVirtualFile(); if (virtualFile == null) { return false; } final int key = pyClass.hashCode(); final Pair<WeakReference<PyClass>, Boolean> pair = processedElements.get(key); boolean isException; if (pair == null || pair.first.get() != pyClass) { isException = ReadAction.compute(() -> PyUtil.isExceptionClass(pyClass)); processedElements.put(key, Pair.create(new WeakReference<>(pyClass), isException)); } else { isException = pair.second; } return isException; }