mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
refactor [jvm]: Simplify call chains
GitOrigin-RevId: ed33660bc3bd21d007755bce22761ebf4bcd0368
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a980499bbc
commit
942006ab33
@@ -1060,9 +1060,7 @@ class TaintAnalyzer(private val myTaintValueFactory: TaintValueFactory) {
|
||||
.getCachedValue(parentSourcePsiForCache, CachedValueProvider {
|
||||
val uClass = parentSourcePsiForCache.toUElement() as? UClass
|
||||
val uMethods = if (uClass != null) {
|
||||
listOf(uClass, *uClass.innerClasses)
|
||||
.map { it.methods.toList() }
|
||||
.flatten()
|
||||
listOf(uClass, *uClass.innerClasses).flatMap { it.methods.toList() }
|
||||
}
|
||||
else {
|
||||
listOf()
|
||||
|
||||
@@ -170,8 +170,7 @@ class TaintValueFactory(private val myConfiguration: UntaintedConfiguration) {
|
||||
if (allowSecond) {
|
||||
info = context.secondaryItems().asSequence()
|
||||
.flatMap { listOf(fromElementInner(CustomContext(it, context.place, null), false), fromAnnotationOwner(it.modifierList)) }
|
||||
.filter { it != null && it !== TaintValue.UNKNOWN }
|
||||
.firstOrNull() ?: info
|
||||
.firstOrNull { it != null && it !== TaintValue.UNKNOWN } ?: info
|
||||
}
|
||||
}
|
||||
if (info == TaintValue.UNKNOWN) {
|
||||
@@ -196,10 +195,7 @@ class TaintValueFactory(private val myConfiguration: UntaintedConfiguration) {
|
||||
}
|
||||
val annotationsManager = ExternalAnnotationsManager.getInstance(owner.project)
|
||||
val annotations = annotationsManager.findExternalAnnotations(owner)
|
||||
return annotations.asSequence()
|
||||
.map { fromAnnotation(it) }
|
||||
.filterNotNull()
|
||||
.firstOrNull() ?: TaintValue.UNKNOWN
|
||||
return annotations.asSequence().firstNotNullOfOrNull { fromAnnotation(it) } ?: TaintValue.UNKNOWN
|
||||
}
|
||||
|
||||
private fun of(annotationOwner: PsiModifierListOwner): TaintValue {
|
||||
@@ -305,8 +301,7 @@ class TaintValueFactory(private val myConfiguration: UntaintedConfiguration) {
|
||||
val target = context.target
|
||||
if (target is PsiMethod) {
|
||||
val result = customReturnFactories.asSequence()
|
||||
.map { it.invoke(target, context.targetClass) }
|
||||
.filterNotNull()
|
||||
.mapNotNull { it.invoke(target, context.targetClass) }
|
||||
.reduceOrNull { acc, returnFactoriesResult -> acc.reduce(returnFactoriesResult) }
|
||||
if (result?.taintValue != null) {
|
||||
return result.taintValue
|
||||
|
||||
Reference in New Issue
Block a user