List<PsiClass> (@NotNull PsiClass trait) { return CachedValuesManager.getCachedValue(trait, () -> { List<PsiClass> result = new ArrayList<>(); InheritanceUtil.processSupers(trait, true, clazz -> { if (isTrait(clazz)) { PsiAnnotation annotation = AnnotationUtil.findAnnotation(clazz, "groovy.transform.SelfType"); if (annotation != null) { result.addAll( GrAnnotationUtil.getClassArrayValue(annotation, "value", false) ); } } return true; }); return CachedValueProvider.Result.create(result, PsiModificationTracker.MODIFICATION_COUNT); }); }