Cleanup: fix some compiler warnings (mostly deprecations, javaClass)
This commit is contained in:
+2
-2
@@ -260,7 +260,7 @@ class LightClassDataProviderForClassOrObject(private val classOrObject: KtClassO
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return this.javaClass.name + " for " + classOrObject.name
|
||||
return this::class.java.name + " for " + classOrObject.name
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ sealed class LightClassDataProviderForFileFacade private constructor(
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return this.javaClass.name + " for $facadeFqName"
|
||||
return this::class.java.name + " for $facadeFqName"
|
||||
}
|
||||
|
||||
// create delegate by relevant files in project source using LightClassGenerationSupport
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ internal open class KtLightClassForAnonymousDeclaration(classOrObject: KtClassOr
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other == null || javaClass != other.javaClass) return false
|
||||
if (other == null || this::class.java != other::class.java) return false
|
||||
|
||||
val aClass = other as KtLightClassForAnonymousDeclaration
|
||||
|
||||
|
||||
+1
-1
@@ -247,7 +247,7 @@ class KtLightClassForFacade private constructor(
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other == null || javaClass != other.javaClass) {
|
||||
if (other == null || this::class.java != other::class.java) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ open class KtLightClassForLocalDeclaration(
|
||||
if (createWrapper) {
|
||||
return object : LightMethod(myManager, method, containingClass!!, KotlinLanguage.INSTANCE) {
|
||||
override fun getParent(): PsiElement {
|
||||
return getContainingClass()!!
|
||||
return getContainingClass()
|
||||
}
|
||||
|
||||
override fun getName(): String {
|
||||
|
||||
+2
-2
@@ -161,7 +161,7 @@ abstract class KtLightClassForSourceDeclaration(protected val classOrObject: KtC
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other == null || javaClass != other.javaClass) return false
|
||||
if (other == null || this::class.java != other::class.java) return false
|
||||
|
||||
val aClass = other as KtLightClassForSourceDeclaration
|
||||
|
||||
@@ -313,7 +313,7 @@ abstract class KtLightClassForSourceDeclaration(protected val classOrObject: KtC
|
||||
return this
|
||||
}
|
||||
|
||||
override fun toString() = "${this.javaClass.simpleName}:${classOrObject.getDebugText()}"
|
||||
override fun toString() = "${this::class.java.simpleName}:${classOrObject.getDebugText()}"
|
||||
|
||||
override fun getOwnInnerClasses(): List<PsiClass> {
|
||||
val result = ArrayList<PsiClass>()
|
||||
|
||||
@@ -91,7 +91,7 @@ class FilteredJvmDiagnostics(val jvmDiagnostics: Diagnostics, val otherDiagnosti
|
||||
val higherPriority = setOf<DiagnosticFactory<*>>(
|
||||
CONFLICTING_OVERLOADS, REDECLARATION, NOTHING_TO_OVERRIDE, MANY_IMPL_MEMBER_NOT_IMPLEMENTED)
|
||||
return otherDiagnostics.forElement(psiElement).any { it.factory in higherPriority }
|
||||
|| psiElement is KtPropertyAccessor && alreadyReported(psiElement.parent!!)
|
||||
|| psiElement is KtPropertyAccessor && alreadyReported(psiElement.parent)
|
||||
}
|
||||
|
||||
override fun forElement(psiElement: PsiElement): Collection<Diagnostic> {
|
||||
|
||||
+1
-1
@@ -171,7 +171,7 @@ class KtLightAnnotation(
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
if (other == null || other::class.java != this::class.java) return false
|
||||
return kotlinOrigin == (other as KtLightAnnotation).kotlinOrigin
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ sealed class KtLightFieldImpl(
|
||||
|
||||
override fun isValid() = containingClass.isValid
|
||||
|
||||
override fun toString(): String = "${this.javaClass.simpleName}:$name"
|
||||
override fun toString(): String = "${this::class.java.simpleName}:$name"
|
||||
|
||||
override fun equals(other: Any?): Boolean =
|
||||
other is KtLightField &&
|
||||
|
||||
@@ -199,7 +199,7 @@ sealed class KtLightMethodImpl(
|
||||
|
||||
override fun hashCode(): Int = ((name.hashCode() * 31 + (lightMethodOrigin?.hashCode() ?: 0)) * 31 + containingClass.hashCode()) * 31 + clsDelegate.hashCode()
|
||||
|
||||
override fun toString(): String = "${this.javaClass.simpleName}:$name"
|
||||
override fun toString(): String = "${this::class.java.simpleName}:$name"
|
||||
|
||||
private class KtLightMethodForDeclaration(
|
||||
delegate: PsiMethod, origin: LightMemberOrigin?, containingClass: KtLightClass
|
||||
|
||||
@@ -33,8 +33,6 @@ import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.isExtensionDeclaration
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.singletonList
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.singletonOrEmptyList
|
||||
import java.util.*
|
||||
|
||||
fun KtClassOrObject.toLightClass(): KtLightClass? = LightClassGenerationSupport.getInstance(project).getLightClass(this)
|
||||
@@ -47,11 +45,11 @@ fun KtFile.findFacadeClass(): KtLightClass? {
|
||||
|
||||
fun KtElement.toLightElements(): List<PsiNamedElement> =
|
||||
when (this) {
|
||||
is KtClassOrObject -> toLightClass().singletonOrEmptyList()
|
||||
is KtClassOrObject -> listOfNotNull(toLightClass())
|
||||
is KtNamedFunction,
|
||||
is KtSecondaryConstructor -> LightClassUtil.getLightClassMethods(this as KtFunction)
|
||||
is KtProperty -> LightClassUtil.getLightClassPropertyMethods(this).allDeclarations
|
||||
is KtPropertyAccessor -> LightClassUtil.getLightClassAccessorMethod(this).singletonOrEmptyList()
|
||||
is KtPropertyAccessor -> listOfNotNull(LightClassUtil.getLightClassAccessorMethod(this))
|
||||
is KtParameter -> ArrayList<PsiNamedElement>().let { elements ->
|
||||
toPsiParameters().toCollection(elements)
|
||||
LightClassUtil.getLightClassPropertyMethods(this).toCollection(elements)
|
||||
@@ -60,7 +58,7 @@ fun KtElement.toLightElements(): List<PsiNamedElement> =
|
||||
elements
|
||||
}
|
||||
is KtTypeParameter -> toPsiTypeParameters()
|
||||
is KtFile -> findFacadeClass().singletonOrEmptyList()
|
||||
is KtFile -> listOfNotNull(findFacadeClass())
|
||||
else -> listOf()
|
||||
}
|
||||
|
||||
@@ -70,8 +68,8 @@ fun PsiElement.toLightMethods(): List<PsiMethod> =
|
||||
is KtProperty -> LightClassUtil.getLightClassPropertyMethods(this).toList()
|
||||
is KtParameter -> LightClassUtil.getLightClassPropertyMethods(this).toList()
|
||||
is KtPropertyAccessor -> LightClassUtil.getLightClassAccessorMethods(this)
|
||||
is KtClass -> toLightClass()?.constructors?.firstOrNull().singletonOrEmptyList()
|
||||
is PsiMethod -> this.singletonList()
|
||||
is KtClass -> listOfNotNull(toLightClass()?.constructors?.firstOrNull())
|
||||
is PsiMethod -> listOf(this)
|
||||
else -> listOf()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user