Minor changes after code review

This commit is contained in:
Valentin Kipyatkov
2014-11-10 22:07:32 +03:00
parent bf38da7bb1
commit 048d34b964
3 changed files with 7 additions and 2 deletions
@@ -28,7 +28,7 @@ import com.intellij.psi.search.GlobalSearchScope
public class JavaPackageImpl(psiPackage: PsiPackage, private val scope: GlobalSearchScope) : JavaElementImpl<PsiPackage>(psiPackage), JavaPackage {
override fun getClasses(nameFilter: (Name) -> Boolean): MutableCollection<JavaClass> {
override fun getClasses(nameFilter: (Name) -> Boolean): Collection<JavaClass> {
val psiClasses = getPsi().getClasses(scope).filter {
val name = it.getName()
name != null && nameFilter(Name.identifier(name))
@@ -49,6 +49,8 @@ public abstract class LazyJavaMemberScope(
protected val c: LazyJavaResolverContextWithTypes,
private val containingDeclaration: DeclarationDescriptor
) : JetScope {
// this lazy value is not used at all in LazyPackageFragmentScopeForJavaPackage because we do not use caching there
// but is placed in the base class to not duplicate code
private val allDescriptors = c.storageManager.createRecursionTolerantLazyValue<Collection<DeclarationDescriptor>>(
{ computeDescriptors(JetScope.ALL_KINDS_MASK, JetScope.ALL_NAME_FILTER) },
// This is to avoid the following recursive case:
@@ -280,6 +282,8 @@ public abstract class LazyJavaMemberScope(
}
override fun getProperties(name: Name): Collection<VariableDescriptor> = properties(name)
// we do not have nameFilter here because it only makes sense in package but java package does not contain any properties
protected open fun getAllPropertyNames(): Collection<Name> = memberIndex().getAllFieldNames()
override fun getLocalVariable(name: Name): VariableDescriptor? = null
@@ -63,7 +63,8 @@ public class StubBasedPackageMemberDeclarationProvider(
.stream()
.map { FqName(it) }
.filter { !it.isRoot() && it.parent() == fqName && nameFilter(it.shortName()) }
.flatMapTo(this) { index[it.asString(), project, searchScope].stream() }
.toSet()
.flatMapTo(this) { index[it.asString(), project, searchScope] }
}
override fun getClassOrObjectDeclarations(name: Name): Collection<JetClassLikeInfo> {