[FIR] Implement FirInterfaceDefaultMethodCallChecker
Add diagnostics: INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET, INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER, DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET
This commit is contained in:
committed by
TeamCityServer
parent
97bc079634
commit
f414a91c66
+15
-4
@@ -6,10 +6,10 @@
|
|||||||
package org.jetbrains.kotlin.fir.checkers.generator.diagnostics
|
package org.jetbrains.kotlin.fir.checkers.generator.diagnostics
|
||||||
|
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.config.LanguageFeature
|
import org.jetbrains.kotlin.config.LanguageFeature.*
|
||||||
import org.jetbrains.kotlin.descriptors.Named
|
|
||||||
import org.jetbrains.kotlin.fir.PrivateForInline
|
import org.jetbrains.kotlin.fir.PrivateForInline
|
||||||
import org.jetbrains.kotlin.fir.checkers.generator.diagnostics.model.*
|
import org.jetbrains.kotlin.fir.checkers.generator.diagnostics.model.DiagnosticList
|
||||||
|
import org.jetbrains.kotlin.fir.checkers.generator.diagnostics.model.PositioningStrategy
|
||||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
@@ -57,7 +57,9 @@ object JVM_DIAGNOSTICS_LIST : DiagnosticList("FirJvmErrors") {
|
|||||||
val OVERLOADS_ABSTRACT by error<KtAnnotationEntry>()
|
val OVERLOADS_ABSTRACT by error<KtAnnotationEntry>()
|
||||||
val OVERLOADS_INTERFACE by error<KtAnnotationEntry>()
|
val OVERLOADS_INTERFACE by error<KtAnnotationEntry>()
|
||||||
val OVERLOADS_LOCAL by error<KtAnnotationEntry>()
|
val OVERLOADS_LOCAL by error<KtAnnotationEntry>()
|
||||||
val OVERLOADS_ANNOTATION_CLASS_CONSTRUCTOR by deprecationError<KtAnnotationEntry>(LanguageFeature.ProhibitJvmOverloadsOnConstructorsOfAnnotationClasses)
|
val OVERLOADS_ANNOTATION_CLASS_CONSTRUCTOR by deprecationError<KtAnnotationEntry>(
|
||||||
|
ProhibitJvmOverloadsOnConstructorsOfAnnotationClasses
|
||||||
|
)
|
||||||
val OVERLOADS_PRIVATE by warning<KtAnnotationEntry>()
|
val OVERLOADS_PRIVATE by warning<KtAnnotationEntry>()
|
||||||
val DEPRECATED_JAVA_ANNOTATION by warning<KtAnnotationEntry>() {
|
val DEPRECATED_JAVA_ANNOTATION by warning<KtAnnotationEntry>() {
|
||||||
parameter<FqName>("kotlinName")
|
parameter<FqName>("kotlinName")
|
||||||
@@ -72,6 +74,7 @@ object JVM_DIAGNOSTICS_LIST : DiagnosticList("FirJvmErrors") {
|
|||||||
val SUPER_CALL_WITH_DEFAULT_PARAMETERS by error<PsiElement>() {
|
val SUPER_CALL_WITH_DEFAULT_PARAMETERS by error<PsiElement>() {
|
||||||
parameter<String>("name")
|
parameter<String>("name")
|
||||||
}
|
}
|
||||||
|
val INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER by error<PsiElement>(PositioningStrategy.REFERENCE_BY_QUALIFIED)
|
||||||
}
|
}
|
||||||
|
|
||||||
val RECORDS by object : DiagnosticGroup("JVM Records") {
|
val RECORDS by object : DiagnosticGroup("JVM Records") {
|
||||||
@@ -129,5 +132,13 @@ object JVM_DIAGNOSTICS_LIST : DiagnosticList("FirJvmErrors") {
|
|||||||
parameter<String>("message")
|
parameter<String>("message")
|
||||||
}
|
}
|
||||||
val JVM_SYNTHETIC_ON_DELEGATE by error<KtAnnotationEntry>()
|
val JVM_SYNTHETIC_ON_DELEGATE by error<KtAnnotationEntry>()
|
||||||
|
val DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET by deprecationError<PsiElement>(
|
||||||
|
DefaultMethodsCallFromJava6TargetError,
|
||||||
|
PositioningStrategy.REFERENCE_BY_QUALIFIED
|
||||||
|
)
|
||||||
|
val INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET by deprecationError<PsiElement>(
|
||||||
|
DefaultMethodsCallFromJava6TargetError,
|
||||||
|
PositioningStrategy.REFERENCE_BY_QUALIFIED
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.fir.analysis.diagnostics.jvm
|
package org.jetbrains.kotlin.fir.analysis.diagnostics.jvm
|
||||||
|
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
|
import org.jetbrains.kotlin.config.LanguageFeature.DefaultMethodsCallFromJava6TargetError
|
||||||
import org.jetbrains.kotlin.config.LanguageFeature.ProhibitJvmOverloadsOnConstructorsOfAnnotationClasses
|
import org.jetbrains.kotlin.config.LanguageFeature.ProhibitJvmOverloadsOnConstructorsOfAnnotationClasses
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.*
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.*
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.SourceElementPositioningStrategies
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.SourceElementPositioningStrategies
|
||||||
@@ -59,6 +60,7 @@ object FirJvmErrors {
|
|||||||
|
|
||||||
// Super
|
// Super
|
||||||
val SUPER_CALL_WITH_DEFAULT_PARAMETERS by error1<PsiElement, String>()
|
val SUPER_CALL_WITH_DEFAULT_PARAMETERS by error1<PsiElement, String>()
|
||||||
|
val INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER by error0<PsiElement>(SourceElementPositioningStrategies.REFERENCE_BY_QUALIFIED)
|
||||||
|
|
||||||
// JVM Records
|
// JVM Records
|
||||||
val LOCAL_JVM_RECORD by error0<PsiElement>()
|
val LOCAL_JVM_RECORD by error0<PsiElement>()
|
||||||
@@ -98,5 +100,7 @@ object FirJvmErrors {
|
|||||||
val INAPPLICABLE_JVM_FIELD by error1<KtAnnotationEntry, String>()
|
val INAPPLICABLE_JVM_FIELD by error1<KtAnnotationEntry, String>()
|
||||||
val INAPPLICABLE_JVM_FIELD_WARNING by warning1<KtAnnotationEntry, String>()
|
val INAPPLICABLE_JVM_FIELD_WARNING by warning1<KtAnnotationEntry, String>()
|
||||||
val JVM_SYNTHETIC_ON_DELEGATE by error0<KtAnnotationEntry>()
|
val JVM_SYNTHETIC_ON_DELEGATE by error0<KtAnnotationEntry>()
|
||||||
|
val DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET by deprecationError0<PsiElement>(DefaultMethodsCallFromJava6TargetError, SourceElementPositioningStrategies.REFERENCE_BY_QUALIFIED)
|
||||||
|
val INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET by deprecationError0<PsiElement>(DefaultMethodsCallFromJava6TargetError, SourceElementPositioningStrategies.REFERENCE_BY_QUALIFIED)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.fir.analysis.jvm.checkers
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.config.JvmDefaultMode
|
||||||
|
import org.jetbrains.kotlin.fir.FirAnnotationContainer
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.getAnnotationByFqName
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||||
|
import org.jetbrains.kotlin.name.JvmNames.JVM_DEFAULT_FQ_NAME
|
||||||
|
|
||||||
|
fun <D> FirBasedSymbol<out D>.isCompiledToJvmDefault(jvmDefaultMode: JvmDefaultMode): Boolean where D : FirAnnotationContainer, D : FirDeclaration {
|
||||||
|
// TODO: Fix support for all cases
|
||||||
|
if (getAnnotationByFqName(JVM_DEFAULT_FQ_NAME) != null) return true
|
||||||
|
|
||||||
|
return jvmDefaultMode.forAllMethodsWithBody
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.fir.analysis.jvm.checkers
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||||
|
import org.jetbrains.kotlin.fir.moduleData
|
||||||
|
|
||||||
|
fun CheckerContext.isJvm6(): Boolean {
|
||||||
|
return session.moduleData.platform.componentPlatforms.any { it.targetName == "1.6" }
|
||||||
|
}
|
||||||
+7
-4
@@ -8,12 +8,15 @@ package org.jetbrains.kotlin.fir.analysis.jvm.checkers
|
|||||||
import org.jetbrains.kotlin.fir.analysis.checkers.expression.ExpressionCheckers
|
import org.jetbrains.kotlin.fir.analysis.checkers.expression.ExpressionCheckers
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirAnnotationCallChecker
|
import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirAnnotationCallChecker
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirFunctionCallChecker
|
import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirFunctionCallChecker
|
||||||
import org.jetbrains.kotlin.fir.analysis.jvm.checkers.expression.FirDeprecatedJavaAnnotationsChecker
|
import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirQualifiedAccessExpressionChecker
|
||||||
import org.jetbrains.kotlin.fir.analysis.jvm.checkers.expression.FirJavaGenericVarianceViolationTypeChecker
|
import org.jetbrains.kotlin.fir.analysis.jvm.checkers.expression.*
|
||||||
import org.jetbrains.kotlin.fir.analysis.jvm.checkers.expression.FirJvmPackageNameAnnotationsChecker
|
|
||||||
import org.jetbrains.kotlin.fir.analysis.jvm.checkers.expression.FirSuperCallWithDefaultsChecker
|
|
||||||
|
|
||||||
object JvmExpressionCheckers : ExpressionCheckers() {
|
object JvmExpressionCheckers : ExpressionCheckers() {
|
||||||
|
override val qualifiedAccessExpressionCheckers: Set<FirQualifiedAccessExpressionChecker>
|
||||||
|
get() = setOf(
|
||||||
|
FirInterfaceDefaultMethodCallChecker
|
||||||
|
)
|
||||||
|
|
||||||
override val functionCallCheckers: Set<FirFunctionCallChecker>
|
override val functionCallCheckers: Set<FirFunctionCallChecker>
|
||||||
get() = setOf(
|
get() = setOf(
|
||||||
FirJavaGenericVarianceViolationTypeChecker,
|
FirJavaGenericVarianceViolationTypeChecker,
|
||||||
|
|||||||
+8
-15
@@ -14,39 +14,38 @@ import org.jetbrains.kotlin.fir.analysis.checkers.unsubstitutedScope
|
|||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.jvm.checkers.isCompiledToJvmDefault
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.jvm.checkers.isJvm6
|
||||||
import org.jetbrains.kotlin.fir.containingClass
|
import org.jetbrains.kotlin.fir.containingClass
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.isInterface
|
import org.jetbrains.kotlin.fir.declarations.utils.isInterface
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.modality
|
import org.jetbrains.kotlin.fir.declarations.utils.modality
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
||||||
import org.jetbrains.kotlin.fir.java.jvmDefaultModeState
|
import org.jetbrains.kotlin.fir.java.jvmDefaultModeState
|
||||||
import org.jetbrains.kotlin.fir.moduleData
|
|
||||||
import org.jetbrains.kotlin.fir.resolve.toFirRegularClass
|
import org.jetbrains.kotlin.fir.resolve.toFirRegularClass
|
||||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||||
import org.jetbrains.kotlin.fir.scopes.getDirectOverriddenFunctions
|
import org.jetbrains.kotlin.fir.scopes.getDirectOverriddenFunctions
|
||||||
import org.jetbrains.kotlin.fir.scopes.impl.FirClassUseSiteMemberScope
|
import org.jetbrains.kotlin.fir.scopes.impl.FirClassUseSiteMemberScope
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirIntersectionCallableSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirIntersectionCallableSymbol
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.JvmNames.JVM_DEFAULT_FQ_NAME
|
||||||
|
import org.jetbrains.kotlin.name.JvmNames.JVM_DEFAULT_NO_COMPATIBILITY_FQ_NAME
|
||||||
|
|
||||||
object FirJvmDefaultChecker : FirBasicDeclarationChecker() {
|
object FirJvmDefaultChecker : FirBasicDeclarationChecker() {
|
||||||
private val JVM_DEFAULT_FQ_NAME = FqName("kotlin.jvm.JvmDefault")
|
|
||||||
private val JVM_DEFAULT_NO_COMPATIBILITY_FQ_NAME = FqName("kotlin.jvm.JvmDefaultWithoutCompatibility")
|
|
||||||
|
|
||||||
override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||||
val jvmDefaultMode = context.session.jvmDefaultModeState
|
val jvmDefaultMode = context.session.jvmDefaultModeState
|
||||||
var defaultAnnotation: FirAnnotationCall? = null
|
var defaultAnnotation: FirAnnotationCall? = null
|
||||||
val containingDeclaration = context.findClosest<FirClassLikeDeclaration>()
|
val containingDeclaration = context.findClosest<FirClassLikeDeclaration>()
|
||||||
|
|
||||||
if (declaration is FirAnnotatedDeclaration) {
|
if (declaration is FirAnnotatedDeclaration) {
|
||||||
val isJvm16 = context.session.moduleData.platform.componentPlatforms.any { it.targetName == "1.6" }
|
val isJvm6 = context.isJvm6()
|
||||||
defaultAnnotation = declaration.getAnnotationByFqName(JVM_DEFAULT_FQ_NAME)
|
defaultAnnotation = declaration.getAnnotationByClassId(JVM_DEFAULT_CLASS_ID)
|
||||||
|
|
||||||
if (defaultAnnotation != null) {
|
if (defaultAnnotation != null) {
|
||||||
if (containingDeclaration !is FirClass || !containingDeclaration.isInterface) {
|
if (containingDeclaration !is FirClass || !containingDeclaration.isInterface) {
|
||||||
reporter.reportOn(defaultAnnotation.source, FirJvmErrors.JVM_DEFAULT_NOT_IN_INTERFACE, context)
|
reporter.reportOn(defaultAnnotation.source, FirJvmErrors.JVM_DEFAULT_NOT_IN_INTERFACE, context)
|
||||||
return
|
return
|
||||||
} else if (isJvm16) {
|
} else if (isJvm6) {
|
||||||
reporter.reportOn(defaultAnnotation.source, FirJvmErrors.JVM_DEFAULT_IN_JVM6_TARGET, "JvmDefault", context)
|
reporter.reportOn(defaultAnnotation.source, FirJvmErrors.JVM_DEFAULT_IN_JVM6_TARGET, "JvmDefault", context)
|
||||||
return
|
return
|
||||||
} else if (!jvmDefaultMode.isEnabled) {
|
} else if (!jvmDefaultMode.isEnabled) {
|
||||||
@@ -56,7 +55,7 @@ object FirJvmDefaultChecker : FirBasicDeclarationChecker() {
|
|||||||
} else {
|
} else {
|
||||||
val annotation = declaration.getAnnotationByFqName(JVM_DEFAULT_NO_COMPATIBILITY_FQ_NAME)
|
val annotation = declaration.getAnnotationByFqName(JVM_DEFAULT_NO_COMPATIBILITY_FQ_NAME)
|
||||||
if (annotation != null) {
|
if (annotation != null) {
|
||||||
if (isJvm16) {
|
if (isJvm6) {
|
||||||
reporter.reportOn(
|
reporter.reportOn(
|
||||||
annotation.source,
|
annotation.source,
|
||||||
FirJvmErrors.JVM_DEFAULT_IN_JVM6_TARGET,
|
FirJvmErrors.JVM_DEFAULT_IN_JVM6_TARGET,
|
||||||
@@ -176,10 +175,4 @@ object FirJvmDefaultChecker : FirBasicDeclarationChecker() {
|
|||||||
// TODO: Fix support for all cases
|
// TODO: Fix support for all cases
|
||||||
return isCompiledToJvmDefault(jvmDefaultMode)
|
return isCompiledToJvmDefault(jvmDefaultMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun FirCallableSymbol<*>.isCompiledToJvmDefault(): Boolean {
|
|
||||||
// TODO: Fix support for all cases
|
|
||||||
if (getAnnotationByFqName(JVM_DEFAULT_FQ_NAME) != null) return true
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+8
-4
@@ -13,10 +13,14 @@ import org.jetbrains.kotlin.fir.analysis.checkers.declaration.FirAnnotatedDeclar
|
|||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.withSuppressedDiagnostics
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.jvm.checkers.isJvm6
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.expressions.*
|
import org.jetbrains.kotlin.fir.expressions.FirClassReferenceExpression
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirGetClassCall
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.toResolvedCallableSymbol
|
||||||
import org.jetbrains.kotlin.fir.languageVersionSettings
|
import org.jetbrains.kotlin.fir.languageVersionSettings
|
||||||
import org.jetbrains.kotlin.fir.moduleData
|
|
||||||
import org.jetbrains.kotlin.fir.resolve.fqName
|
import org.jetbrains.kotlin.fir.resolve.fqName
|
||||||
import org.jetbrains.kotlin.fir.resolve.symbolProvider
|
import org.jetbrains.kotlin.fir.resolve.symbolProvider
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol
|
||||||
@@ -41,14 +45,14 @@ object FirRepeatableAnnotationChecker : FirAnnotatedDeclarationChecker() {
|
|||||||
val classId = annotation.classId ?: continue
|
val classId = annotation.classId ?: continue
|
||||||
val annotationClassId = annotation.toAnnotationClassId() ?: continue
|
val annotationClassId = annotation.toAnnotationClassId() ?: continue
|
||||||
if (annotationClassId.isLocal) continue
|
if (annotationClassId.isLocal) continue
|
||||||
val annotationClass = session.symbolProvider.getClassLikeSymbolByFqName(annotationClassId) ?: continue
|
val annotationClass = session.symbolProvider.getClassLikeSymbolByClassId(annotationClassId) ?: continue
|
||||||
|
|
||||||
// TODO: consider REPEATED_ANNOTATION ?
|
// TODO: consider REPEATED_ANNOTATION ?
|
||||||
if (fqName in annotationsSet &&
|
if (fqName in annotationsSet &&
|
||||||
annotationClass.isRepeatableAnnotation(session) &&
|
annotationClass.isRepeatableAnnotation(session) &&
|
||||||
annotationClass.getAnnotationRetention() != AnnotationRetention.SOURCE
|
annotationClass.getAnnotationRetention() != AnnotationRetention.SOURCE
|
||||||
) {
|
) {
|
||||||
if (session.moduleData.platform.componentPlatforms.any { it.targetName == "1.6" }) {
|
if (context.isJvm6()) {
|
||||||
reporter.reportOn(annotation.source, FirJvmErrors.REPEATED_ANNOTATION_TARGET6, context)
|
reporter.reportOn(annotation.source, FirJvmErrors.REPEATED_ANNOTATION_TARGET6, context)
|
||||||
} else if (session.languageVersionSettings.supportsFeature(LanguageFeature.RepeatableAnnotations)) {
|
} else if (session.languageVersionSettings.supportsFeature(LanguageFeature.RepeatableAnnotations)) {
|
||||||
// It's not allowed to have both a repeated annotation (applied more than once) and its container
|
// It's not allowed to have both a repeated annotation (applied more than once) and its container
|
||||||
|
|||||||
+74
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.fir.analysis.jvm.checkers.expression
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.checkers.context.findClosest
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirQualifiedAccessExpressionChecker
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.jvm.checkers.isCompiledToJvmDefault
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.jvm.checkers.isJvm6
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.utils.isInterface
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.toResolvedCallableSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.java.jvmDefaultModeState
|
||||||
|
import org.jetbrains.kotlin.fir.references.FirSuperReference
|
||||||
|
import org.jetbrains.kotlin.fir.resolve.symbolProvider
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.ANONYMOUS_CLASS_ID
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.isStatic
|
||||||
|
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||||
|
|
||||||
|
object FirInterfaceDefaultMethodCallChecker : FirQualifiedAccessExpressionChecker() {
|
||||||
|
override fun check(expression: FirQualifiedAccessExpression, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||||
|
val supportsDefaults = !context.isJvm6()
|
||||||
|
|
||||||
|
val symbol = expression.calleeReference.toResolvedCallableSymbol()
|
||||||
|
val classId = symbol?.callableId?.classId ?: return
|
||||||
|
if (classId.isLocal) return
|
||||||
|
val typeSymbol = context.session.symbolProvider.getClassLikeSymbolByFqName(classId) as? FirRegularClassSymbol ?: return
|
||||||
|
|
||||||
|
if (!supportsDefaults &&
|
||||||
|
symbol.isStatic &&
|
||||||
|
typeSymbol.isInterface &&
|
||||||
|
typeSymbol.origin == FirDeclarationOrigin.Java
|
||||||
|
) {
|
||||||
|
reporter.reportOn(expression.source, FirJvmErrors.INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET, context)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (expression.explicitReceiver.safeAs<FirQualifiedAccessExpression>()
|
||||||
|
?.calleeReference.safeAs<FirSuperReference>() == null
|
||||||
|
) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val containingDeclaration = context.findClosest<FirRegularClass>() ?: return
|
||||||
|
|
||||||
|
val jvmDefaultMode = context.session.jvmDefaultModeState
|
||||||
|
if (typeSymbol.isInterface && (typeSymbol.origin == FirDeclarationOrigin.Java || symbol.isCompiledToJvmDefault(jvmDefaultMode))) {
|
||||||
|
if (containingDeclaration.isInterface) {
|
||||||
|
val containingMember = context.findContainingMember()?.symbol
|
||||||
|
if (containingMember?.isCompiledToJvmDefault(jvmDefaultMode) == false) {
|
||||||
|
reporter.reportOn(expression.source, FirJvmErrors.INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER, context)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!supportsDefaults) {
|
||||||
|
reporter.reportOn(expression.source, FirJvmErrors.DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET, context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun CheckerContext.findContainingMember(): FirCallableDeclaration? {
|
||||||
|
return findClosest {
|
||||||
|
(it is FirSimpleFunction && it.symbol.callableId.classId != ANONYMOUS_CLASS_ID) || it is FirProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+15
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDefaultErrorMessages
|
|||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.RENDER_TYPE
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.RENDER_TYPE
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.TO_STRING
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.TO_STRING
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.CONFLICTING_JVM_DECLARATIONS
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.CONFLICTING_JVM_DECLARATIONS
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.DELEGATION_BY_IN_JVM_RECORD
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.DELEGATION_BY_IN_JVM_RECORD
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.DEPRECATED_JAVA_ANNOTATION
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.DEPRECATED_JAVA_ANNOTATION
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.ENUM_JVM_RECORD
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.ENUM_JVM_RECORD
|
||||||
@@ -25,6 +26,8 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.INAPPLICAB
|
|||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.INAPPLICABLE_JVM_FIELD
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.INAPPLICABLE_JVM_FIELD
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.INAPPLICABLE_JVM_FIELD_WARNING
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.INAPPLICABLE_JVM_FIELD_WARNING
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.INNER_JVM_RECORD
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.INNER_JVM_RECORD
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.JAVA_TYPE_MISMATCH
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.JAVA_TYPE_MISMATCH
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.JVM_DEFAULT_IN_DECLARATION
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.JVM_DEFAULT_IN_DECLARATION
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.JVM_DEFAULT_IN_JVM6_TARGET
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.JVM_DEFAULT_IN_JVM6_TARGET
|
||||||
@@ -204,6 +207,18 @@ object FirJvmDefaultErrorMessages {
|
|||||||
INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER,
|
INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER,
|
||||||
"Interfaces can call default methods via super only within @JvmDefault members. Please annotate the containing interface member with @JvmDefault"
|
"Interfaces can call default methods via super only within @JvmDefault members. Please annotate the containing interface member with @JvmDefault"
|
||||||
)
|
)
|
||||||
|
map.put(
|
||||||
|
DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET,
|
||||||
|
"Super calls to Java default methods are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8'"
|
||||||
|
)
|
||||||
|
map.put(
|
||||||
|
INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET,
|
||||||
|
"Calls to static methods in Java interfaces are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8'"
|
||||||
|
)
|
||||||
|
map.put(
|
||||||
|
INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER,
|
||||||
|
"Interfaces can call default methods via super only within @JvmDefault members. Please annotate the containing interface member with @JvmDefault"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+30
-30
@@ -20,23 +20,23 @@ import JavaInterface.testStatic
|
|||||||
|
|
||||||
interface KotlinInterface : JavaInterface {
|
interface KotlinInterface : JavaInterface {
|
||||||
fun fooo() {
|
fun fooo() {
|
||||||
testStatic()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.test()
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinInterface.test()
|
super@KotlinInterface.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val propertyy: String
|
val propertyy: String
|
||||||
get() {
|
get() {
|
||||||
super.test()
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinInterface.test()
|
super@KotlinInterface.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
@@ -49,23 +49,23 @@ interface KotlinInterface : JavaInterface {
|
|||||||
|
|
||||||
interface KotlinInterfaceIndirectInheritance : KotlinInterface {
|
interface KotlinInterfaceIndirectInheritance : KotlinInterface {
|
||||||
fun foooo() {
|
fun foooo() {
|
||||||
testStatic()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.test()
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinInterfaceIndirectInheritance.test()
|
super@KotlinInterfaceIndirectInheritance.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val propertyyy: String
|
val propertyyy: String
|
||||||
get() {
|
get() {
|
||||||
super.test()
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinInterfaceIndirectInheritance.test()
|
super@KotlinInterfaceIndirectInheritance.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
@@ -74,25 +74,25 @@ interface KotlinInterfaceIndirectInheritance : KotlinInterface {
|
|||||||
|
|
||||||
open class KotlinClass : JavaInterface {
|
open class KotlinClass : JavaInterface {
|
||||||
fun foo() {
|
fun foo() {
|
||||||
testStatic()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.test()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
super.testOverride()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testOverride<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinClass.test()
|
super@KotlinClass.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val property: String
|
val property: String
|
||||||
get() {
|
get() {
|
||||||
super.test()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
super.testOverride()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testOverride<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinClass.test()
|
super@KotlinClass.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
@@ -101,25 +101,25 @@ open class KotlinClass : JavaInterface {
|
|||||||
|
|
||||||
class KotlinClassIndirectInheritance : KotlinClass() {
|
class KotlinClassIndirectInheritance : KotlinClass() {
|
||||||
fun foo2(){
|
fun foo2(){
|
||||||
testStatic()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.test()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
super.testOverride()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testOverride<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinClassIndirectInheritance.test()
|
super@KotlinClassIndirectInheritance.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val property2: String
|
val property2: String
|
||||||
get() {
|
get() {
|
||||||
super.test()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
super.testOverride()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testOverride<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinClassIndirectInheritance.test()
|
super@KotlinClassIndirectInheritance.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
@@ -128,25 +128,25 @@ class KotlinClassIndirectInheritance : KotlinClass() {
|
|||||||
|
|
||||||
class KotlinClassIndirectInheritance2 : KotlinInterfaceIndirectInheritance {
|
class KotlinClassIndirectInheritance2 : KotlinInterfaceIndirectInheritance {
|
||||||
fun foo() {
|
fun foo() {
|
||||||
testStatic()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.test()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
super.testOverride()
|
super.testOverride()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinClassIndirectInheritance2.test()
|
super@KotlinClassIndirectInheritance2.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val property: String
|
val property: String
|
||||||
get() {
|
get() {
|
||||||
super.test()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
super.testOverride()
|
super.testOverride()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinClassIndirectInheritance2.test()
|
super@KotlinClassIndirectInheritance2.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
@@ -154,7 +154,7 @@ class KotlinClassIndirectInheritance2 : KotlinInterfaceIndirectInheritance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
JavaInterface.testStatic()
|
JavaInterface.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
KotlinClass().foo()
|
KotlinClass().foo()
|
||||||
KotlinClass().property
|
KotlinClass().property
|
||||||
KotlinClassIndirectInheritance2().foo()
|
KotlinClassIndirectInheritance2().foo()
|
||||||
|
|||||||
+13
-13
@@ -25,8 +25,8 @@ import JavaInterface.testStatic
|
|||||||
|
|
||||||
interface KotlinInterface : JavaInterface {
|
interface KotlinInterface : JavaInterface {
|
||||||
fun fooo() {
|
fun fooo() {
|
||||||
testStatic()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.test()
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
test()
|
test()
|
||||||
testOverride()
|
testOverride()
|
||||||
}
|
}
|
||||||
@@ -38,8 +38,8 @@ interface KotlinInterface : JavaInterface {
|
|||||||
|
|
||||||
interface KotlinInterfaceIndirectInheritance : KotlinInterface {
|
interface KotlinInterfaceIndirectInheritance : KotlinInterface {
|
||||||
fun foooo() {
|
fun foooo() {
|
||||||
testStatic()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.test()
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
testOverride()
|
testOverride()
|
||||||
super.testOverride()
|
super.testOverride()
|
||||||
}
|
}
|
||||||
@@ -47,30 +47,30 @@ interface KotlinInterfaceIndirectInheritance : KotlinInterface {
|
|||||||
|
|
||||||
open class KotlinClass : JavaInterface {
|
open class KotlinClass : JavaInterface {
|
||||||
fun foo(){
|
fun foo(){
|
||||||
testStatic()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.test()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
super.testOverride()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testOverride<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KotlinClassIndirectInheritance : KotlinClass() {
|
class KotlinClassIndirectInheritance : KotlinClass() {
|
||||||
fun foo2(){
|
fun foo2(){
|
||||||
testStatic()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.test()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
super.testOverride()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testOverride<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KotlinClassIndirectInheritance2 : KotlinInterfaceIndirectInheritance {
|
class KotlinClassIndirectInheritance2 : KotlinInterfaceIndirectInheritance {
|
||||||
fun foo(){
|
fun foo(){
|
||||||
testStatic()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.test()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
super.testOverride()
|
super.testOverride()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
JavaInterface.testStatic()
|
JavaInterface.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
KotlinClass().foo()
|
KotlinClass().foo()
|
||||||
KotlinClassIndirectInheritance2().foo()
|
KotlinClassIndirectInheritance2().foo()
|
||||||
|
|
||||||
|
|||||||
@@ -22,23 +22,23 @@ import JavaInterface.testStatic
|
|||||||
|
|
||||||
interface KotlinInterface : JavaInterface {
|
interface KotlinInterface : JavaInterface {
|
||||||
fun fooo() {
|
fun fooo() {
|
||||||
testStatic()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>testStatic<!>()
|
||||||
super.test()
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinInterface.test()
|
super@KotlinInterface.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val propertyy: String
|
val propertyy: String
|
||||||
get() {
|
get() {
|
||||||
super.test()
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinInterface.test()
|
super@KotlinInterface.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
@@ -51,23 +51,23 @@ interface KotlinInterface : JavaInterface {
|
|||||||
|
|
||||||
interface KotlinInterfaceIndirectInheritance : KotlinInterface {
|
interface KotlinInterfaceIndirectInheritance : KotlinInterface {
|
||||||
fun foooo() {
|
fun foooo() {
|
||||||
testStatic()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>testStatic<!>()
|
||||||
super.test()
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinInterfaceIndirectInheritance.test()
|
super@KotlinInterfaceIndirectInheritance.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val propertyyy: String
|
val propertyyy: String
|
||||||
get() {
|
get() {
|
||||||
super.test()
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinInterfaceIndirectInheritance.test()
|
super@KotlinInterfaceIndirectInheritance.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
@@ -76,25 +76,25 @@ interface KotlinInterfaceIndirectInheritance : KotlinInterface {
|
|||||||
|
|
||||||
open class KotlinClass : JavaInterface {
|
open class KotlinClass : JavaInterface {
|
||||||
fun foo(){
|
fun foo(){
|
||||||
testStatic()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>testStatic<!>()
|
||||||
super.test()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>test<!>()
|
||||||
super.testOverride()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>testOverride<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinClass.test()
|
super@KotlinClass.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val property: String
|
val property: String
|
||||||
get() {
|
get() {
|
||||||
super.test()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>test<!>()
|
||||||
super.testOverride()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>testOverride<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinClass.test()
|
super@KotlinClass.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
@@ -103,25 +103,25 @@ open class KotlinClass : JavaInterface {
|
|||||||
|
|
||||||
class KotlinClassIndirectInheritance : KotlinClass() {
|
class KotlinClassIndirectInheritance : KotlinClass() {
|
||||||
fun foo2(){
|
fun foo2(){
|
||||||
testStatic()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>testStatic<!>()
|
||||||
super.test()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>test<!>()
|
||||||
super.testOverride()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>testOverride<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinClassIndirectInheritance.test()
|
super@KotlinClassIndirectInheritance.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val property2: String
|
val property2: String
|
||||||
get() {
|
get() {
|
||||||
super.test()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>test<!>()
|
||||||
super.testOverride()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>testOverride<!>()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinClassIndirectInheritance.test()
|
super@KotlinClassIndirectInheritance.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
@@ -130,25 +130,25 @@ class KotlinClassIndirectInheritance : KotlinClass() {
|
|||||||
|
|
||||||
class KotlinClassIndirectInheritance2 : KotlinInterfaceIndirectInheritance {
|
class KotlinClassIndirectInheritance2 : KotlinInterfaceIndirectInheritance {
|
||||||
fun foo(){
|
fun foo(){
|
||||||
testStatic()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>testStatic<!>()
|
||||||
super.test()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>test<!>()
|
||||||
super.testOverride()
|
super.testOverride()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinClassIndirectInheritance2.test()
|
super@KotlinClassIndirectInheritance2.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val property: String
|
val property: String
|
||||||
get() {
|
get() {
|
||||||
super.test()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>test<!>()
|
||||||
super.testOverride()
|
super.testOverride()
|
||||||
|
|
||||||
object {
|
object {
|
||||||
fun run () {
|
fun run () {
|
||||||
super@KotlinClassIndirectInheritance2.test()
|
super@KotlinClassIndirectInheritance2.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
@@ -156,7 +156,7 @@ class KotlinClassIndirectInheritance2 : KotlinInterfaceIndirectInheritance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
JavaInterface.testStatic()
|
JavaInterface.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_WARNING!>testStatic<!>()
|
||||||
KotlinClass().foo()
|
KotlinClass().foo()
|
||||||
KotlinClass().property
|
KotlinClass().property
|
||||||
KotlinClassIndirectInheritance2().foo()
|
KotlinClassIndirectInheritance2().foo()
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
// !JVM_TARGET: 1.6
|
|
||||||
// FILE: Test.java
|
|
||||||
public interface Test {
|
|
||||||
default String test() {
|
|
||||||
return "123";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FILE: test.kt
|
|
||||||
interface KTrait : Test {
|
|
||||||
fun ktest() {
|
|
||||||
super.test()
|
|
||||||
|
|
||||||
test()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
interface KTrait2 : KTrait {
|
|
||||||
fun ktest2() {
|
|
||||||
super.test()
|
|
||||||
|
|
||||||
test()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class A : KTrait {
|
|
||||||
fun a() {
|
|
||||||
super.test()
|
|
||||||
|
|
||||||
test()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class A2 : KTrait2 {
|
|
||||||
fun a() {
|
|
||||||
super.test()
|
|
||||||
|
|
||||||
test()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !JVM_TARGET: 1.6
|
// !JVM_TARGET: 1.6
|
||||||
// FILE: Test.java
|
// FILE: Test.java
|
||||||
public interface Test {
|
public interface Test {
|
||||||
|
|||||||
-322
@@ -1,322 +0,0 @@
|
|||||||
// !JVM_DEFAULT_MODE: enable
|
|
||||||
// !JVM_TARGET: 1.8
|
|
||||||
|
|
||||||
public interface KInterface {
|
|
||||||
@<!DEPRECATION!>JvmDefault<!>
|
|
||||||
fun test(): String {
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
|
|
||||||
@<!DEPRECATION!>JvmDefault<!>
|
|
||||||
val property: String
|
|
||||||
get() = "OK"
|
|
||||||
|
|
||||||
|
|
||||||
fun testNonDefault(): String {
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
|
|
||||||
val propertyNonDefault: String
|
|
||||||
get() = "OK"
|
|
||||||
}
|
|
||||||
|
|
||||||
// FILE: 1.kt
|
|
||||||
|
|
||||||
interface KotlinInterface : KInterface {
|
|
||||||
@<!DEPRECATION!>JvmDefault<!>
|
|
||||||
fun fooo() {
|
|
||||||
super.test()
|
|
||||||
super.property
|
|
||||||
|
|
||||||
super.testNonDefault()
|
|
||||||
super.propertyNonDefault
|
|
||||||
|
|
||||||
object {
|
|
||||||
fun run () {
|
|
||||||
super@KotlinInterface.test()
|
|
||||||
super@KotlinInterface.property
|
|
||||||
|
|
||||||
super@KotlinInterface.testNonDefault()
|
|
||||||
super@KotlinInterface.propertyNonDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@<!DEPRECATION!>JvmDefault<!>
|
|
||||||
val propertyy: String
|
|
||||||
get() {
|
|
||||||
super.test()
|
|
||||||
super.property
|
|
||||||
|
|
||||||
super.testNonDefault()
|
|
||||||
super.propertyNonDefault
|
|
||||||
|
|
||||||
object {
|
|
||||||
fun run () {
|
|
||||||
super@KotlinInterface.test()
|
|
||||||
super@KotlinInterface.property
|
|
||||||
|
|
||||||
super@KotlinInterface.testNonDefault()
|
|
||||||
super@KotlinInterface.propertyNonDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
fun foooNonDefault() {
|
|
||||||
super.test()
|
|
||||||
super.property
|
|
||||||
|
|
||||||
super.testNonDefault()
|
|
||||||
super.propertyNonDefault
|
|
||||||
|
|
||||||
object {
|
|
||||||
fun run () {
|
|
||||||
super@KotlinInterface.test()
|
|
||||||
super@KotlinInterface.property
|
|
||||||
|
|
||||||
super@KotlinInterface.testNonDefault()
|
|
||||||
super@KotlinInterface.propertyNonDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val propertyyNonDefault: String
|
|
||||||
get() {
|
|
||||||
super.test()
|
|
||||||
super.property
|
|
||||||
|
|
||||||
super.testNonDefault()
|
|
||||||
super.propertyNonDefault
|
|
||||||
|
|
||||||
object {
|
|
||||||
fun run () {
|
|
||||||
super@KotlinInterface.test()
|
|
||||||
super@KotlinInterface.property
|
|
||||||
|
|
||||||
super@KotlinInterface.testNonDefault()
|
|
||||||
super@KotlinInterface.propertyNonDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KotlinInterfaceIndirectInheritance : KotlinInterface {
|
|
||||||
@<!DEPRECATION!>JvmDefault<!>
|
|
||||||
fun foooo() {
|
|
||||||
super.test()
|
|
||||||
super.property
|
|
||||||
|
|
||||||
super.testNonDefault()
|
|
||||||
super.propertyNonDefault
|
|
||||||
|
|
||||||
object {
|
|
||||||
fun run () {
|
|
||||||
super@KotlinInterfaceIndirectInheritance.test()
|
|
||||||
super@KotlinInterfaceIndirectInheritance.property
|
|
||||||
|
|
||||||
super@KotlinInterfaceIndirectInheritance.testNonDefault()
|
|
||||||
super@KotlinInterfaceIndirectInheritance.propertyNonDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@<!DEPRECATION!>JvmDefault<!>
|
|
||||||
val propertyyy: String
|
|
||||||
get() {
|
|
||||||
super.test()
|
|
||||||
super.property
|
|
||||||
|
|
||||||
super.testNonDefault()
|
|
||||||
super.propertyNonDefault
|
|
||||||
|
|
||||||
object {
|
|
||||||
fun run () {
|
|
||||||
super@KotlinInterfaceIndirectInheritance.test()
|
|
||||||
super@KotlinInterfaceIndirectInheritance.property
|
|
||||||
|
|
||||||
super@KotlinInterfaceIndirectInheritance.testNonDefault()
|
|
||||||
super@KotlinInterfaceIndirectInheritance.propertyNonDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
fun fooooNonDefault() {
|
|
||||||
super.test()
|
|
||||||
super.property
|
|
||||||
|
|
||||||
super.testNonDefault()
|
|
||||||
super.propertyNonDefault
|
|
||||||
|
|
||||||
object {
|
|
||||||
fun run () {
|
|
||||||
super@KotlinInterfaceIndirectInheritance.test()
|
|
||||||
super@KotlinInterfaceIndirectInheritance.property
|
|
||||||
|
|
||||||
super@KotlinInterfaceIndirectInheritance.testNonDefault()
|
|
||||||
super@KotlinInterfaceIndirectInheritance.propertyNonDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val propertyyyNonDefault: String
|
|
||||||
get() {
|
|
||||||
super.test()
|
|
||||||
super.property
|
|
||||||
|
|
||||||
super.testNonDefault()
|
|
||||||
super.propertyNonDefault
|
|
||||||
|
|
||||||
object {
|
|
||||||
fun run () {
|
|
||||||
super@KotlinInterfaceIndirectInheritance.test()
|
|
||||||
super@KotlinInterfaceIndirectInheritance.property
|
|
||||||
|
|
||||||
super@KotlinInterfaceIndirectInheritance.testNonDefault()
|
|
||||||
super@KotlinInterfaceIndirectInheritance.propertyNonDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
open class KotlinClass : KInterface {
|
|
||||||
fun foo() {
|
|
||||||
super.test()
|
|
||||||
super.property
|
|
||||||
|
|
||||||
super.testNonDefault()
|
|
||||||
super.propertyNonDefault
|
|
||||||
|
|
||||||
object {
|
|
||||||
fun run () {
|
|
||||||
super@KotlinClass.test()
|
|
||||||
super@KotlinClass.property
|
|
||||||
|
|
||||||
super@KotlinClass.testNonDefault()
|
|
||||||
super@KotlinClass.propertyNonDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val xproperty: String
|
|
||||||
get() {
|
|
||||||
super.test()
|
|
||||||
super.property
|
|
||||||
|
|
||||||
super.testNonDefault()
|
|
||||||
super.propertyNonDefault
|
|
||||||
|
|
||||||
object {
|
|
||||||
fun run () {
|
|
||||||
super@KotlinClass.test()
|
|
||||||
super@KotlinClass.property
|
|
||||||
|
|
||||||
super@KotlinClass.testNonDefault()
|
|
||||||
super@KotlinClass.propertyNonDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class KotlinClassIndirectInheritance : KotlinClass() {
|
|
||||||
fun foo2() {
|
|
||||||
super.test()
|
|
||||||
super.property
|
|
||||||
|
|
||||||
super.testNonDefault()
|
|
||||||
super.propertyNonDefault
|
|
||||||
|
|
||||||
object {
|
|
||||||
fun run () {
|
|
||||||
super@KotlinClassIndirectInheritance.test()
|
|
||||||
super@KotlinClassIndirectInheritance.property
|
|
||||||
|
|
||||||
super@KotlinClassIndirectInheritance.testNonDefault()
|
|
||||||
super@KotlinClassIndirectInheritance.propertyNonDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
val property2: String
|
|
||||||
get() {
|
|
||||||
super.test()
|
|
||||||
super.property
|
|
||||||
|
|
||||||
super.testNonDefault()
|
|
||||||
super.propertyNonDefault
|
|
||||||
|
|
||||||
object {
|
|
||||||
fun run () {
|
|
||||||
super@KotlinClassIndirectInheritance.test()
|
|
||||||
super@KotlinClassIndirectInheritance.property
|
|
||||||
|
|
||||||
super@KotlinClassIndirectInheritance.testNonDefault()
|
|
||||||
super@KotlinClassIndirectInheritance.propertyNonDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class KotlinClassIndirectInheritance2 : KotlinInterfaceIndirectInheritance {
|
|
||||||
fun foo() {
|
|
||||||
super.test()
|
|
||||||
super.property
|
|
||||||
|
|
||||||
super.testNonDefault()
|
|
||||||
super.propertyNonDefault
|
|
||||||
|
|
||||||
object {
|
|
||||||
fun run () {
|
|
||||||
super@KotlinClassIndirectInheritance2.test()
|
|
||||||
super@KotlinClassIndirectInheritance2.property
|
|
||||||
|
|
||||||
super@KotlinClassIndirectInheritance2.testNonDefault()
|
|
||||||
super@KotlinClassIndirectInheritance2.propertyNonDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val xproperty: String
|
|
||||||
get() {
|
|
||||||
super.test()
|
|
||||||
super.property
|
|
||||||
|
|
||||||
super.testNonDefault()
|
|
||||||
super.propertyNonDefault
|
|
||||||
|
|
||||||
object {
|
|
||||||
fun run () {
|
|
||||||
super@KotlinClassIndirectInheritance2.test()
|
|
||||||
super@KotlinClassIndirectInheritance2.property
|
|
||||||
|
|
||||||
super@KotlinClassIndirectInheritance2.testNonDefault()
|
|
||||||
super@KotlinClassIndirectInheritance2.propertyNonDefault
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun test() {
|
|
||||||
KotlinClass().test()
|
|
||||||
KotlinClass().property
|
|
||||||
KotlinClass().propertyNonDefault
|
|
||||||
KotlinClassIndirectInheritance2().test()
|
|
||||||
KotlinClassIndirectInheritance2().testNonDefault()
|
|
||||||
KotlinClassIndirectInheritance2().propertyyy
|
|
||||||
KotlinClassIndirectInheritance2().propertyyyNonDefault
|
|
||||||
|
|
||||||
KotlinClass().test()
|
|
||||||
KotlinClass().testNonDefault()
|
|
||||||
KotlinClass().property
|
|
||||||
KotlinClass().propertyNonDefault
|
|
||||||
}
|
|
||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !JVM_DEFAULT_MODE: enable
|
// !JVM_DEFAULT_MODE: enable
|
||||||
// !JVM_TARGET: 1.8
|
// !JVM_TARGET: 1.8
|
||||||
|
|
||||||
|
|||||||
+30
@@ -361,6 +361,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
|||||||
token,
|
token,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
add(FirJvmErrors.INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER) { firDiagnostic ->
|
||||||
|
InterfaceCantCallDefaultMethodViaSuperImpl(
|
||||||
|
firDiagnostic as FirPsiDiagnostic,
|
||||||
|
token,
|
||||||
|
)
|
||||||
|
}
|
||||||
add(FirErrors.NOT_A_SUPERTYPE) { firDiagnostic ->
|
add(FirErrors.NOT_A_SUPERTYPE) { firDiagnostic ->
|
||||||
NotASupertypeImpl(
|
NotASupertypeImpl(
|
||||||
firDiagnostic as FirPsiDiagnostic,
|
firDiagnostic as FirPsiDiagnostic,
|
||||||
@@ -3820,4 +3826,28 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
|||||||
token,
|
token,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
add(FirJvmErrors.DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET.errorFactory) { firDiagnostic ->
|
||||||
|
DefaultMethodCallFromJava6TargetErrorImpl(
|
||||||
|
firDiagnostic as FirPsiDiagnostic,
|
||||||
|
token,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
add(FirJvmErrors.DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET.warningFactory) { firDiagnostic ->
|
||||||
|
DefaultMethodCallFromJava6TargetWarningImpl(
|
||||||
|
firDiagnostic as FirPsiDiagnostic,
|
||||||
|
token,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
add(FirJvmErrors.INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET.errorFactory) { firDiagnostic ->
|
||||||
|
InterfaceStaticMethodCallFromJava6TargetErrorImpl(
|
||||||
|
firDiagnostic as FirPsiDiagnostic,
|
||||||
|
token,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
add(FirJvmErrors.INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET.warningFactory) { firDiagnostic ->
|
||||||
|
InterfaceStaticMethodCallFromJava6TargetWarningImpl(
|
||||||
|
firDiagnostic as FirPsiDiagnostic,
|
||||||
|
token,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+20
@@ -281,6 +281,10 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
|||||||
abstract val name: String
|
abstract val name: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract class InterfaceCantCallDefaultMethodViaSuper : KtFirDiagnostic<PsiElement>() {
|
||||||
|
override val diagnosticClass get() = InterfaceCantCallDefaultMethodViaSuper::class
|
||||||
|
}
|
||||||
|
|
||||||
abstract class NotASupertype : KtFirDiagnostic<PsiElement>() {
|
abstract class NotASupertype : KtFirDiagnostic<PsiElement>() {
|
||||||
override val diagnosticClass get() = NotASupertype::class
|
override val diagnosticClass get() = NotASupertype::class
|
||||||
}
|
}
|
||||||
@@ -2656,4 +2660,20 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
|||||||
override val diagnosticClass get() = JvmSyntheticOnDelegate::class
|
override val diagnosticClass get() = JvmSyntheticOnDelegate::class
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract class DefaultMethodCallFromJava6TargetError : KtFirDiagnostic<PsiElement>() {
|
||||||
|
override val diagnosticClass get() = DefaultMethodCallFromJava6TargetError::class
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class DefaultMethodCallFromJava6TargetWarning : KtFirDiagnostic<PsiElement>() {
|
||||||
|
override val diagnosticClass get() = DefaultMethodCallFromJava6TargetWarning::class
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class InterfaceStaticMethodCallFromJava6TargetError : KtFirDiagnostic<PsiElement>() {
|
||||||
|
override val diagnosticClass get() = InterfaceStaticMethodCallFromJava6TargetError::class
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class InterfaceStaticMethodCallFromJava6TargetWarning : KtFirDiagnostic<PsiElement>() {
|
||||||
|
override val diagnosticClass get() = InterfaceStaticMethodCallFromJava6TargetWarning::class
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+35
@@ -417,6 +417,13 @@ internal class SuperCallWithDefaultParametersImpl(
|
|||||||
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
|
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal class InterfaceCantCallDefaultMethodViaSuperImpl(
|
||||||
|
firDiagnostic: FirPsiDiagnostic,
|
||||||
|
override val token: ValidityToken,
|
||||||
|
) : KtFirDiagnostic.InterfaceCantCallDefaultMethodViaSuper(), KtAbstractFirDiagnostic<PsiElement> {
|
||||||
|
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
|
||||||
|
}
|
||||||
|
|
||||||
internal class NotASupertypeImpl(
|
internal class NotASupertypeImpl(
|
||||||
firDiagnostic: FirPsiDiagnostic,
|
firDiagnostic: FirPsiDiagnostic,
|
||||||
override val token: ValidityToken,
|
override val token: ValidityToken,
|
||||||
@@ -4319,3 +4326,31 @@ internal class JvmSyntheticOnDelegateImpl(
|
|||||||
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
|
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal class DefaultMethodCallFromJava6TargetErrorImpl(
|
||||||
|
firDiagnostic: FirPsiDiagnostic,
|
||||||
|
override val token: ValidityToken,
|
||||||
|
) : KtFirDiagnostic.DefaultMethodCallFromJava6TargetError(), KtAbstractFirDiagnostic<PsiElement> {
|
||||||
|
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class DefaultMethodCallFromJava6TargetWarningImpl(
|
||||||
|
firDiagnostic: FirPsiDiagnostic,
|
||||||
|
override val token: ValidityToken,
|
||||||
|
) : KtFirDiagnostic.DefaultMethodCallFromJava6TargetWarning(), KtAbstractFirDiagnostic<PsiElement> {
|
||||||
|
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class InterfaceStaticMethodCallFromJava6TargetErrorImpl(
|
||||||
|
firDiagnostic: FirPsiDiagnostic,
|
||||||
|
override val token: ValidityToken,
|
||||||
|
) : KtFirDiagnostic.InterfaceStaticMethodCallFromJava6TargetError(), KtAbstractFirDiagnostic<PsiElement> {
|
||||||
|
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class InterfaceStaticMethodCallFromJava6TargetWarningImpl(
|
||||||
|
firDiagnostic: FirPsiDiagnostic,
|
||||||
|
override val token: ValidityToken,
|
||||||
|
) : KtFirDiagnostic.InterfaceStaticMethodCallFromJava6TargetWarning(), KtAbstractFirDiagnostic<PsiElement> {
|
||||||
|
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user