PsiClassType (@NotNull GroovyScriptClass scriptClass) { PsiClassType type = CachedValuesManager.getCachedValue(scriptClass, () -> CachedValueProvider.Result.create( getSuperClassTypeFromBaseScriptAnnotation(scriptClass), scriptClass.getContainingFile() )); if (type != null) { PsiClass resolved = type.resolve(); if (resolved instanceof GrTypeDefinition && reachableInHierarchy(new HashSet<>(List.of(scriptClass)), (GrTypeDefinition)resolved)) { return TypesUtil.createTypeByFQClassName(GroovyCommonClassNames.GROOVY_LANG_SCRIPT, scriptClass); } return type; } final PsiClassType superClassFromDSL = GroovyDslFileIndex.processScriptSuperClasses(scriptClass.getContainingFile()); if (superClassFromDSL != null) return superClassFromDSL; return TypesUtil.createTypeByFQClassName(GroovyCommonClassNames.GROOVY_LANG_SCRIPT, scriptClass); }