Replace map + filterNotNull -> mapNotNull in project

This commit is contained in:
Alexander Udalov
2016-02-20 17:33:39 +03:00
parent 61f5e2f9cf
commit 1a5a077bd6
19 changed files with 52 additions and 54 deletions
@@ -470,9 +470,9 @@ class LazyJavaClassMemberScope(
simpleFunctionDescriptor: SimpleFunctionDescriptor
): Boolean {
val candidatesToOverride =
getFunctionsFromSupertypes(simpleFunctionDescriptor.name).map {
getFunctionsFromSupertypes(simpleFunctionDescriptor.name).mapNotNull {
BuiltinMethodsWithSpecialGenericSignature.getOverriddenBuiltinFunctionWithErasedValueParametersInJava(it)
}.filterNotNull()
}
return candidatesToOverride.any {
candidate ->
@@ -40,11 +40,10 @@ class LazyJavaPackageFragment(
}
internal val kotlinBinaryClasses by c.storageManager.createLazyValue {
val simpleNames = c.components.packageMapper.findPackageParts(fqName.asString())
simpleNames.map {
c.components.packageMapper.findPackageParts(fqName.asString()).mapNotNull {
val classId = ClassId(fqName, Name.identifier(it))
c.components.kotlinClassFinder.findKotlinClass(classId)
}.filterNotNull()
}
}
internal fun resolveTopLevelClass(javaClass: JavaClass) = topLevelClasses(javaClass)
@@ -132,7 +132,7 @@ fun KotlinType.computeIndexedQualifiersForOverride(fromSupertypes: Collection<Ko
assert(isHeadTypeConstructor || !onlyHeadTypeConstructor) { "Only head type constructors should be computed" }
val qualifiers = indexedThisType[index]
val verticalSlice = indexedFromSupertypes.map { it.getOrElse(index, { null }) }.filterNotNull()
val verticalSlice = indexedFromSupertypes.mapNotNull { it.getOrNull(index) }
// Only the head type constructor is safely co-variant
qualifiers.computeQualifiersForOverride(verticalSlice, isCovariant && isHeadTypeConstructor)
@@ -142,8 +142,8 @@ fun KotlinType.computeIndexedQualifiersForOverride(fromSupertypes: Collection<Ko
}
private fun KotlinType.computeQualifiersForOverride(fromSupertypes: Collection<KotlinType>, isCovariant: Boolean): JavaTypeQualifiers {
val nullabilityFromSupertypes = fromSupertypes.map { it.extractQualifiers().nullability }.filterNotNull().toSet()
val mutabilityFromSupertypes = fromSupertypes.map { it.extractQualifiers().mutability }.filterNotNull().toSet()
val nullabilityFromSupertypes = fromSupertypes.mapNotNull { it.extractQualifiers().nullability }.toSet()
val mutabilityFromSupertypes = fromSupertypes.mapNotNull { it.extractQualifiers().mutability }.toSet()
val own = extractQualifiersFromAnnotations()