From 761e1447f415da23559c11f322f0ad0cf5a19b8a Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 8 Sep 2015 18:01:17 +0200 Subject: [PATCH] access property stubs safely (EA-72410 - CCE: UnusedPropertyInspection.getWidestUseScope) --- .../intellij/lang/properties/psi/PropertyKeyIndex.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/psi/PropertyKeyIndex.java b/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/psi/PropertyKeyIndex.java index fabd11f08760..5f4acef71be1 100644 --- a/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/psi/PropertyKeyIndex.java +++ b/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/psi/PropertyKeyIndex.java @@ -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 { public static final StubIndexKey KEY = StubIndexKey.createIndexKey("properties.index"); @@ -36,4 +41,9 @@ public class PropertyKeyIndex extends StringStubIndexExtension { public StubIndexKey getKey() { return KEY; } + + @Override + public Collection get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) { + return StubIndex.getElements(getKey(), s, project, scope, Property.class); + } }