diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/stubs/GroovyShortNamesCache.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/stubs/GroovyShortNamesCache.java index 1aa03eb5abb9..a67f9d19f05a 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/stubs/GroovyShortNamesCache.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/stubs/GroovyShortNamesCache.java @@ -1,19 +1,4 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.stubs; import com.intellij.openapi.project.Project; @@ -42,6 +27,8 @@ import java.util.Collection; import java.util.Collections; import java.util.List; +import static com.intellij.psi.impl.java.stubs.index.JavaStubIndexKeys.CLASS_SHORT_NAMES; + /** * @author ilyas */ @@ -186,6 +173,23 @@ public class GroovyShortNamesCache extends PsiShortNamesCache { @NotNull Processor processor, @NotNull GlobalSearchScope scope, @Nullable IdFilter filter) { + return processClasses(name, processor, scope, filter) && + processScriptClasses(name, processor, scope, filter); + } + + private boolean processClasses(@NotNull String name, + @NotNull Processor processor, + @NotNull GlobalSearchScope scope, + @Nullable IdFilter filter) { + return StubIndex.getInstance().processElements( + CLASS_SHORT_NAMES, name, myProject, new GrSourceFilterScope(scope), filter, PsiClass.class, processor + ); + } + + private boolean processScriptClasses(@NotNull String name, + @NotNull Processor processor, + @NotNull GlobalSearchScope scope, + @Nullable IdFilter filter) { for (GroovyFile file : StubIndex.getElements(GrScriptClassNameIndex.KEY, name, myProject, new GrSourceFilterScope(scope), filter, GroovyFile.class)) { PsiClass aClass = file.getScriptClass();