diff --git a/annotations/com/intellij/psi/stubs/annotations.xml b/annotations/com/intellij/psi/stubs/annotations.xml
index f8578aa6f5c..37ea858d7d2 100644
--- a/annotations/com/intellij/psi/stubs/annotations.xml
+++ b/annotations/com/intellij/psi/stubs/annotations.xml
@@ -10,7 +10,10 @@
name='com.intellij.psi.stubs.AbstractStubIndex java.util.Collection<Psi> get(Key, com.intellij.openapi.project.Project, com.intellij.psi.search.GlobalSearchScope) 2'>
- -
+
+
+ -
diff --git a/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/PackageIndexUtil.java b/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/PackageIndexUtil.java
deleted file mode 100644
index 21ad2e51ae5..00000000000
--- a/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/PackageIndexUtil.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright 2010-2014 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.
- */
-
-package org.jetbrains.jet.plugin.stubindex;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Ref;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.stubs.StubIndex;
-import com.intellij.psi.stubs.StubIndexKey;
-import com.intellij.util.Processor;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.jet.lang.psi.JetFile;
-import org.jetbrains.jet.lang.resolve.name.FqName;
-
-import java.util.Collection;
-
-public final class PackageIndexUtil {
- @NotNull
- public static Collection getSubPackageFqNames(
- @NotNull FqName packageFqName,
- @NotNull GlobalSearchScope scope,
- @NotNull Project project
- ) {
- return SubpackagesIndexService.OBJECT$.getInstance(project).getSubpackages(packageFqName, scope);
- }
-
- @NotNull
- public static Collection findFilesWithExactPackage(
- @NotNull FqName packageFqName,
- @NotNull GlobalSearchScope searchScope,
- @NotNull Project project
- ) {
- return JetExactPackagesIndex.getInstance().get(packageFqName.asString(), project, searchScope);
- }
-
- public static boolean packageExists(
- @NotNull FqName packageFqName,
- @NotNull GlobalSearchScope searchScope,
- @NotNull Project project
- ) {
- return containsAny(packageFqName, searchScope, project, JetExactPackagesIndex.getInstance().getKey())
- || SubpackagesIndexService.OBJECT$.getInstance(project).hasSubpackages(packageFqName, searchScope);
- }
-
- public static boolean containsAny(
- @NotNull FqName packageFqName,
- @NotNull GlobalSearchScope searchScope,
- @NotNull Project project,
- @NotNull StubIndexKey key
- ) {
- final Ref result = new Ref(false);
- StubIndex.getInstance().processElements(
- key, packageFqName.asString(), project, searchScope, JetFile.class,
- new Processor() {
- @Override
- public boolean process(JetFile file) {
- result.set(true);
- return false;
- }
- });
- return result.get();
- }
-
- private PackageIndexUtil() {
- }
-}
diff --git a/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/PackageIndexUtil.kt b/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/PackageIndexUtil.kt
new file mode 100644
index 00000000000..f11f4e5a1aa
--- /dev/null
+++ b/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/PackageIndexUtil.kt
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2010-2014 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.
+ */
+
+package org.jetbrains.jet.plugin.stubindex
+
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.util.Ref
+import com.intellij.psi.search.GlobalSearchScope
+import com.intellij.psi.stubs.StubIndex
+import com.intellij.psi.stubs.StubIndexKey
+import com.intellij.util.Processor
+import org.jetbrains.jet.lang.psi.JetFile
+import org.jetbrains.jet.lang.resolve.name.FqName
+import kotlin.platform.platformStatic
+
+public object PackageIndexUtil {
+ platformStatic public fun getSubPackageFqNames(
+ packageFqName: FqName,
+ scope: GlobalSearchScope,
+ project: Project
+ ): Collection {
+ return SubpackagesIndexService.getInstance(project).getSubpackages(packageFqName, scope)
+ }
+
+ platformStatic public fun findFilesWithExactPackage(
+ packageFqName: FqName,
+ searchScope: GlobalSearchScope,
+ project: Project
+ ): Collection {
+ return JetExactPackagesIndex.getInstance().get(packageFqName.asString(), project, searchScope)
+ }
+
+ platformStatic public fun packageExists(
+ packageFqName: FqName,
+ searchScope: GlobalSearchScope,
+ project: Project
+ ): Boolean {
+ return containsAny(packageFqName, searchScope, project, JetExactPackagesIndex.getInstance().getKey()) ||
+ SubpackagesIndexService.getInstance(project).hasSubpackages(packageFqName, searchScope)
+ }
+
+ platformStatic public fun containsAny(
+ packageFqName: FqName,
+ searchScope: GlobalSearchScope,
+ project: Project,
+ key: StubIndexKey
+ ): Boolean {
+ var result = false
+ StubIndex.getInstance().processElements(key, packageFqName.asString(), project, searchScope, javaClass()) {
+ result = true
+ false
+ }
+ return result
+ }
+}