[Analysis API, FIR] migrate ::class.java -> ::class inside error messages

They seem to provide similar results and the `.java` part is redundant
This commit is contained in:
Ilya Kirillov
2023-07-17 12:08:12 +02:00
committed by Space Team
parent 24db4e62f5
commit 08400d930f
10 changed files with 11 additions and 11 deletions
@@ -1283,7 +1283,7 @@ internal class KtFirCallResolver(
action()
} catch (e: Exception) {
rethrowExceptionWithDetails(
"Error during resolving call ${element::class.java.name}",
"Error during resolving call ${element::class}",
exception = e,
) {
withPsiEntry("psi", element, analysisSession::getModule)
@@ -29,7 +29,7 @@ object KtFirReferenceResolver : ResolveCache.PolyVariantResolver<KtReference> {
} catch (e: Exception) {
if (shouldIjPlatformExceptionBeRethrown(e)) throw e
errorWithAttachment("Unable to resolve reference ${ref.element::class.java}", cause = e) {
errorWithAttachment("Unable to resolve reference ${ref.element::class}", cause = e) {
withPsiEntry("reference", ref.element)
}
}
@@ -31,7 +31,7 @@ abstract class AbstractHLExpressionTypeTest : AbstractAnalysisApiSingleFileTest(
is KtExpression -> selected
is KtValueArgument -> selected.getArgumentExpression()
else -> null
} ?: error("expect an expression but got ${selected.text}, ${selected::class.java}")
} ?: error("expect an expression but got ${selected.text}, ${selected::class}")
val type = executeOnPooledThreadInReadAction {
analyseForTest(expression) { expression.getKtType()?.render(renderer, position = Variance.INVARIANT) }
}
@@ -25,7 +25,7 @@ abstract class AbstractAnalysisApiExpressionPsiTypeProviderTest : AbstractAnalys
val declarationAtCaret = when (val element = testServices.expressionMarkerProvider.getSelectedElement(ktFile)) {
is KtExpression -> element
is KtValueArgument -> element.getArgumentExpression()!!
else -> error("Unexpected element: $element of ${element::class.java}")
else -> error("Unexpected element: $element of ${element::class}")
}
val containingDeclaration = declarationAtCaret.parentOfType<KtDeclaration>()
?: error("Can't find containing declaration for $declarationAtCaret")
@@ -42,7 +42,7 @@ internal fun KtAnalysisSession.stringRepresentation(any: Any): String = with(any
is KtConstructorSymbol -> "<constructor>"
is KtPropertyGetterSymbol -> callableIdIfNonLocal ?: "<getter>"
is KtPropertySetterSymbol -> callableIdIfNonLocal ?: "<setter>"
else -> error("unexpected symbol kind in KtCall: ${this@with::class.java}")
else -> error("unexpected symbol kind in KtCall: ${this@with::class}")
}
)
append("(")
@@ -187,7 +187,7 @@ public class DebugSymbolRenderer(
is KtClassLikeSymbol -> renderId(symbol.classIdIfNonLocal, symbol)
is KtCallableSymbol -> renderId(symbol.callableIdIfNonLocal, symbol)
is KtNamedSymbol -> renderValue(symbol.name, renderSymbolsFully = false)
else -> error("Unsupported symbol ${symbol::class.java.name}")
else -> error("Unsupported symbol ${symbol::class}")
}
append(")")
}
@@ -34,6 +34,6 @@ fun FirElementWithResolveState.getContainingFile(): FirFile? {
moduleComponents.cache.getCachedFirFile(ktFile)
?: error("Fir file for dandling modifier list cannot be null")
}
else -> errorWithFirSpecificEntries("Unsupported declaration ${this::class.java}", fir = this)
else -> errorWithFirSpecificEntries("Unsupported declaration ${this::class}", fir = this)
}
}
@@ -230,7 +230,7 @@ open class AbstractSymbolLightClassesParentingTestBase(
assertions.assertTrue(owner is SymbolLightMemberModifierList<*>)
else ->
throw IllegalStateException("Unexpected annotation owner kind: ${lastDeclaration::class.java}")
throw IllegalStateException("Unexpected annotation owner kind: ${lastDeclaration::class}")
}
}
@@ -90,7 +90,7 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
is ConeClassLikeType -> fullyExpandedType(session)
is ConeSimpleKotlinType -> this
is ConeFlexibleType -> null
else -> errorWithAttachment("Unknown simpleType: ${this::class.java}") {
else -> errorWithAttachment("Unknown simpleType: ${this::class}") {
withConeTypeEntry("type", this@asSimpleType as? ConeKotlinType)
}
}
@@ -1198,7 +1198,7 @@ open class PsiRawFirBuilder(
block = when (file) {
is KtExpressionCodeFragment -> file.getContentElement()?.toFirBlock() ?: buildEmptyExpressionBlock()
is KtBlockCodeFragment -> configureBlockWithoutBuilding(file.getContentElement()).build()
else -> error("Unexpected code fragment type: " + file::class.java)
else -> error("Unexpected code fragment type: ${file::class}")
}
}
}
@@ -2267,7 +2267,7 @@ open class PsiRawFirBuilder(
is KtEscapeStringTemplateEntry -> KtNodeTypes.ESCAPE_STRING_TEMPLATE_ENTRY
is KtSimpleNameStringTemplateEntry -> KtNodeTypes.SHORT_STRING_TEMPLATE_ENTRY
is KtBlockStringTemplateEntry -> KtNodeTypes.LONG_STRING_TEMPLATE_ENTRY
else -> errorWithAttachment("invalid node type ${element::class.java}") {
else -> errorWithAttachment("invalid node type ${element::class}") {
withPsiEntry("element", element)
}
}