access property stubs safely (EA-72410 - CCE: UnusedPropertyInspection.getWidestUseScope)

This commit is contained in:
peter
2015-09-08 19:06:19 +02:00
parent 8a3a075b24
commit 761e1447f4
@@ -19,10 +19,15 @@
*/
package com.intellij.lang.properties.psi;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.stubs.StringStubIndexExtension;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.psi.stubs.StubIndexKey;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
public class PropertyKeyIndex extends StringStubIndexExtension<Property> {
public static final StubIndexKey<String, Property> KEY = StubIndexKey.createIndexKey("properties.index");
@@ -36,4 +41,9 @@ public class PropertyKeyIndex extends StringStubIndexExtension<Property> {
public StubIndexKey<String, Property> getKey() {
return KEY;
}
@Override
public Collection<Property> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
return StubIndex.getElements(getKey(), s, project, scope, Property.class);
}
}