Java: minor UAST optimization (IDEA-375485)

GitOrigin-RevId: 3551a8a0af9f2eb7428da63a1e5f83aa7bc81778
This commit is contained in:
Bas Leijdekkers
2025-09-18 12:39:58 +02:00
committed by intellij-monorepo-bot
parent 6141932aa7
commit e61cfd625f
4 changed files with 9 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.uast.kotlin
import com.intellij.psi.*
@@ -66,7 +66,7 @@ class KotlinUEnumConstant(
get() = emptyList()
override val valueArgumentCount: Int
get() = psi.argumentList?.expressions?.size ?: 0
get() = psi.argumentList?.expressionCount ?: 0
override val valueArguments: List<UExpression>
get() = valueArgumentsPart.getOrBuild {

View File

@@ -1,5 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.uast.java
import com.intellij.psi.*
@@ -275,7 +274,7 @@ class JavaUEnumConstant(
override val typeArguments: List<PsiType>
get() = emptyList()
override val valueArgumentCount: Int
get() = sourcePsi.argumentList?.expressions?.size ?: 0
get() = sourcePsi.argumentList?.expressionCount ?: 0
override val valueArguments: List<UExpression>
get() = valueArgumentsPart.getOrBuild {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.uast.java
import com.intellij.psi.PsiMethod
@@ -29,7 +29,7 @@ class JavaUObjectLiteralExpression(
}
override val valueArgumentCount: Int
get() = sourcePsi.argumentList?.expressions?.size ?: 0
get() = sourcePsi.argumentList?.expressionCount ?: 0
override val valueArguments: List<UExpression>
get() = valueArgumentsPart.getOrBuild {
@@ -41,7 +41,7 @@ class JavaUObjectLiteralExpression(
override val typeArgumentCount: Int
get() {
if (typeArgumentCountLazy == Int.MIN_VALUE) {
typeArgumentCountLazy = sourcePsi.classReference?.typeParameters?.size ?: 0
typeArgumentCountLazy = sourcePsi.classReference?.typeParameterCount ?: 0
}
return typeArgumentCountLazy
}

View File

@@ -177,7 +177,7 @@ class JavaConstructorUCallExpression(
return when {
initializer != null -> initializer.initializers.size
sourcePsi.arrayDimensions.isNotEmpty() -> sourcePsi.arrayDimensions.size
else -> sourcePsi.argumentList?.expressions?.size ?: 0
else -> sourcePsi.argumentList?.expressionCount ?: 0
}
}
@@ -196,7 +196,7 @@ class JavaConstructorUCallExpression(
override val typeArgumentCount: Int
get() {
if (typeArgumentCountLazy == Int.MIN_VALUE) {
typeArgumentCountLazy = sourcePsi.classReference?.typeParameters?.size ?: 0
typeArgumentCountLazy = sourcePsi.classReference?.typeParameterCount ?: 0
}
return typeArgumentCountLazy