PsiFile (@NotNull final Project project, @Nullable final Location location) { if (location == null) return null; final ReferenceType refType = location.declaringType(); if (refType == null) return null; final String originalQName = refType.name().replace('/', '.'); int dollar = originalQName.indexOf('$'); String runtimeName = dollar >= 0 ? originalQName.substring(0, dollar) : originalQName; String qName = getOriginalQualifiedName(refType, runtimeName); GlobalSearchScope searchScope = myDebugProcess.getSearchScope(); GroovyShortNamesCache cache = GroovyShortNamesCache.getGroovyShortNamesCache(project); try { List<PsiClass> classes = cache.getClassesByFQName(qName, searchScope, true); if (classes.isEmpty()) { classes = cache.getClassesByFQName(qName, searchScope, false); } if (classes.isEmpty()) { classes = cache.getClassesByFQName(qName, GlobalSearchScope.projectScope(project), false); } if (classes.isEmpty()) { classes = cache.getClassesByFQName(qName, addModuleContent(searchScope), false); } if (!classes.isEmpty()) { classes.sort(PsiClassUtil.createScopeComparator(searchScope)); PsiClass clazz = classes.get(0); if (clazz != null) return clazz.getContainingFile(); } } catch (ProcessCanceledException | IndexNotReadyException e) { return null; } return getExtraScriptIfNotFound(project, refType, runtimeName, searchScope); }