Switch DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET according to LL
This commit is contained in:
+10
-4
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.resolve.jvm.checkers
|
|||||||
|
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.config.JvmTarget
|
import org.jetbrains.kotlin.config.JvmTarget
|
||||||
|
import org.jetbrains.kotlin.config.LanguageFeature
|
||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||||
@@ -28,7 +29,7 @@ import org.jetbrains.kotlin.resolve.calls.callResolverUtil.getSuperCallExpressio
|
|||||||
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker
|
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker
|
||||||
import org.jetbrains.kotlin.resolve.calls.checkers.CallCheckerContext
|
import org.jetbrains.kotlin.resolve.calls.checkers.CallCheckerContext
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
|
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.*
|
||||||
|
|
||||||
class InterfaceDefaultMethodCallChecker(val jvmTarget: JvmTarget) : CallChecker {
|
class InterfaceDefaultMethodCallChecker(val jvmTarget: JvmTarget) : CallChecker {
|
||||||
|
|
||||||
@@ -41,7 +42,8 @@ class InterfaceDefaultMethodCallChecker(val jvmTarget: JvmTarget) : CallChecker
|
|||||||
isStaticDeclaration(descriptor) &&
|
isStaticDeclaration(descriptor) &&
|
||||||
isInterface(descriptor.containingDeclaration) &&
|
isInterface(descriptor.containingDeclaration) &&
|
||||||
descriptor is JavaCallableMemberDescriptor) {
|
descriptor is JavaCallableMemberDescriptor) {
|
||||||
context.trace.report(ErrorsJvm.INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET.on(reportOn))
|
val diagnostic = if (isDefaultCallsProhibited(context)) INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR else INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET
|
||||||
|
context.trace.report(diagnostic.on(reportOn))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getSuperCallExpression(resolvedCall.call) == null) return
|
if (getSuperCallExpression(resolvedCall.call) == null) return
|
||||||
@@ -55,11 +57,15 @@ class InterfaceDefaultMethodCallChecker(val jvmTarget: JvmTarget) : CallChecker
|
|||||||
val classifier = DescriptorUtils.getParentOfType(context.scope.ownerDescriptor, ClassifierDescriptor::class.java)
|
val classifier = DescriptorUtils.getParentOfType(context.scope.ownerDescriptor, ClassifierDescriptor::class.java)
|
||||||
//is java interface default method called from trait
|
//is java interface default method called from trait
|
||||||
if (classifier != null && DescriptorUtils.isInterface(classifier)) {
|
if (classifier != null && DescriptorUtils.isInterface(classifier)) {
|
||||||
context.trace.report(ErrorsJvm.INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER.on(reportOn))
|
context.trace.report(INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER.on(reportOn))
|
||||||
}
|
}
|
||||||
else if (!supportDefaults) {
|
else if (!supportDefaults) {
|
||||||
context.trace.report(ErrorsJvm.DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET.on(reportOn))
|
val diagnostic = if (isDefaultCallsProhibited(context)) DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR else DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET
|
||||||
|
context.trace.report(diagnostic.on(reportOn))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun isDefaultCallsProhibited(context: CallCheckerContext) =
|
||||||
|
context.languageVersionSettings.supportsFeature(LanguageFeature.DefaultMethodsCallFromJava6TargetError)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -115,8 +115,10 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
|
|||||||
"Please make explicit overrides (abstract or concrete) for the following non-abstract members of ''{1}'': {2}",
|
"Please make explicit overrides (abstract or concrete) for the following non-abstract members of ''{1}'': {2}",
|
||||||
NAME, NAME, STRING);
|
NAME, NAME, STRING);
|
||||||
|
|
||||||
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(DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET, "Super calls to Java default methods are deprecated in JVM target 1.6. Recompile with '-jvm-target 1.8'");
|
||||||
|
MAP.put(DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR, "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 deprecated 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 deprecated in JVM target 1.6. Recompile with '-jvm-target 1.8'");
|
||||||
|
MAP.put(INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR, "Calls to static methods in Java interfaces are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8'");
|
||||||
|
|
||||||
MAP.put(INLINE_FROM_HIGHER_PLATFORM, "Cannot inline bytecode built with {0} into bytecode that is being built with {1}. Please specify proper ''-jvm-target'' option", STRING, STRING);
|
MAP.put(INLINE_FROM_HIGHER_PLATFORM, "Cannot inline bytecode built with {0} into bytecode that is being built with {1}. Please specify proper ''-jvm-target'' option", STRING, STRING);
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -96,8 +96,10 @@ public interface ErrorsJvm {
|
|||||||
|
|
||||||
DiagnosticFactory3<PsiElement, DeclarationDescriptor, DeclarationDescriptor, String> TARGET6_INTERFACE_INHERITANCE = DiagnosticFactory3.create(ERROR);
|
DiagnosticFactory3<PsiElement, DeclarationDescriptor, DeclarationDescriptor, String> TARGET6_INTERFACE_INHERITANCE = DiagnosticFactory3.create(ERROR);
|
||||||
|
|
||||||
DiagnosticFactory0<PsiElement> DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<PsiElement> DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET = DiagnosticFactory0.create(WARNING);
|
||||||
|
DiagnosticFactory0<PsiElement> DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR = DiagnosticFactory0.create(ERROR);
|
||||||
DiagnosticFactory0<PsiElement> INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET = DiagnosticFactory0.create(WARNING);
|
DiagnosticFactory0<PsiElement> INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET = DiagnosticFactory0.create(WARNING);
|
||||||
|
DiagnosticFactory0<PsiElement> INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR = DiagnosticFactory0.create(ERROR);
|
||||||
|
|
||||||
DiagnosticFactory2<PsiElement, String, String> INLINE_FROM_HIGHER_PLATFORM = DiagnosticFactory2.create(ERROR);
|
DiagnosticFactory2<PsiElement, String, String> INLINE_FROM_HIGHER_PLATFORM = DiagnosticFactory2.create(ERROR);
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ interface IBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: Kotlin.kt
|
// FILE: Kotlin.kt
|
||||||
|
// JVM_TARGET: 1.8
|
||||||
open class Base {
|
open class Base {
|
||||||
fun foo() = "OK"
|
fun foo() = "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
@kotlin.Suppress("DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET")
|
|
||||||
class C : Base(), IBase {
|
class C : Base(), IBase {
|
||||||
val lambda1 = {
|
val lambda1 = {
|
||||||
super.foo()
|
super.foo()
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public interface Simple {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: main.kt
|
// FILE: main.kt
|
||||||
|
// JVM_TARGET: 1.8
|
||||||
interface KInterface : Simple {
|
interface KInterface : Simple {
|
||||||
fun bar(): String {
|
fun bar(): String {
|
||||||
return test("O") + Simple.testStatic("O")
|
return test("O") + Simple.testStatic("O")
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ interface Simple {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: main.kt
|
// FILE: main.kt
|
||||||
|
// JVM_TARGET: 1.8
|
||||||
class Test : Simple {}
|
class Test : Simple {}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public interface Simple {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: main.kt
|
// FILE: main.kt
|
||||||
|
// JVM_TARGET: 1.8
|
||||||
interface TestInterface : Simple {}
|
interface TestInterface : Simple {}
|
||||||
class Test : TestInterface {}
|
class Test : TestInterface {}
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -7,7 +7,7 @@ interface Simple extends KInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: main.kt
|
// FILE: main.kt
|
||||||
|
// JVM_TARGET: 1.8
|
||||||
interface KInterface {
|
interface KInterface {
|
||||||
fun test(): String {
|
fun test(): String {
|
||||||
return "base";
|
return "base";
|
||||||
@@ -15,7 +15,6 @@ interface KInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Test : Simple {
|
class Test : Simple {
|
||||||
@kotlin.Suppress("DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET")
|
|
||||||
fun bar(): String {
|
fun bar(): String {
|
||||||
return super.test()
|
return super.test()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,20 +7,18 @@ public interface Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: test.kt
|
// FILE: test.kt
|
||||||
|
// JVM_TARGET: 1.8
|
||||||
interface KInterface : Test {
|
interface KInterface : Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class KClass : Test {
|
class KClass : Test {
|
||||||
@kotlin.Suppress("DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET")
|
|
||||||
fun ktest(): String {
|
fun ktest(): String {
|
||||||
return super.test() + test()
|
return super.test() + test()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KTClass : KInterface {
|
class KTClass : KInterface {
|
||||||
@kotlin.Suppress("DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET")
|
|
||||||
fun ktest(): String {
|
fun ktest(): String {
|
||||||
return super.test() + test()
|
return super.test() + test()
|
||||||
}
|
}
|
||||||
@@ -29,7 +27,6 @@ class KTClass : KInterface {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val p = object : KInterface {
|
val p = object : KInterface {
|
||||||
@kotlin.Suppress("DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET")
|
|
||||||
fun ktest(): String {
|
fun ktest(): String {
|
||||||
return super.test() + test()
|
return super.test() + test()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
// FILE: Test.java
|
||||||
|
|
||||||
|
public interface Test {
|
||||||
|
default String test() {
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
interface KInterface : Test {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class KClass : Test {
|
||||||
|
@kotlin.Suppress("DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR")
|
||||||
|
fun ktest(): String {
|
||||||
|
return super.test() + test()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class KTClass : KInterface {
|
||||||
|
@kotlin.Suppress("DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR")
|
||||||
|
fun ktest(): String {
|
||||||
|
return super.test() + test()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val p = object : KInterface {
|
||||||
|
@kotlin.Suppress("DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR")
|
||||||
|
fun ktest(): String {
|
||||||
|
return super.test() + test()
|
||||||
|
}
|
||||||
|
}.ktest()
|
||||||
|
|
||||||
|
if (p != "OKOK") return "fail1: $p"
|
||||||
|
|
||||||
|
if (KClass().ktest() != "OKOK") return "fail 2: ${KClass().ktest()}"
|
||||||
|
|
||||||
|
if (KTClass().ktest() != "OKOK") return "fail 3: ${KTClass().ktest()}"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+1
-2
@@ -7,7 +7,7 @@ public interface Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: derived.kt
|
// FILE: derived.kt
|
||||||
|
// JVM_TARGET: 1.8
|
||||||
interface K1 : Base
|
interface K1 : Base
|
||||||
|
|
||||||
interface K2 : K1
|
interface K2 : K1
|
||||||
@@ -15,7 +15,6 @@ interface K2 : K1
|
|||||||
interface K3 : K2
|
interface K3 : K2
|
||||||
|
|
||||||
class C : K3 {
|
class C : K3 {
|
||||||
@kotlin.Suppress("DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET")
|
|
||||||
override fun foo() = super.foo()
|
override fun foo() = super.foo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// FULL_JDK
|
// FULL_JDK
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
// LANGUAGE_VERSION: 1.1
|
||||||
import java.util.stream.*
|
import java.util.stream.*
|
||||||
|
|
||||||
class B<F> : List<F> {
|
class B<F> : List<F> {
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ import java.util.stream.Collectors
|
|||||||
import java.util.stream.IntStream
|
import java.util.stream.IntStream
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val xs = IntStream.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>range<!>(0, 10).mapToObj { it.toString() }
|
val xs = IntStream.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>range<!>(0, 10).mapToObj { it.toString() }
|
||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList())
|
||||||
xs[0]
|
xs[0]
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@ import JavaInterface.testStatic
|
|||||||
|
|
||||||
interface KotlinInterface : JavaInterface {
|
interface KotlinInterface : JavaInterface {
|
||||||
fun fooo() {
|
fun fooo() {
|
||||||
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,22 +30,22 @@ interface KotlinInterface : JavaInterface {
|
|||||||
|
|
||||||
interface KotlinInterfaceInderectInheritance : KotlinInterface {
|
interface KotlinInterfaceInderectInheritance : KotlinInterface {
|
||||||
fun foooo() {
|
fun foooo() {
|
||||||
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class KotlinClass : JavaInterface {
|
open class KotlinClass : JavaInterface {
|
||||||
fun foo(){
|
fun foo(){
|
||||||
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET!>test<!>()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET!>testOverride<!>()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testOverride<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KotlinClassInderectInheritance : KotlinClass() {
|
class KotlinClassInderectInheritance : KotlinClass() {
|
||||||
fun foo2(){
|
fun foo2(){
|
||||||
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.test()
|
super.test()
|
||||||
super.testOverride()
|
super.testOverride()
|
||||||
}
|
}
|
||||||
@@ -53,14 +53,14 @@ class KotlinClassInderectInheritance : KotlinClass() {
|
|||||||
|
|
||||||
class KotlinClassInderectInheritance2 : KotlinInterfaceInderectInheritance {
|
class KotlinClassInderectInheritance2 : KotlinInterfaceInderectInheritance {
|
||||||
fun foo(){
|
fun foo(){
|
||||||
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET!>test<!>()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
super.testOverride()
|
super.testOverride()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
JavaInterface.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
JavaInterface.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
KotlinClass().foo()
|
KotlinClass().foo()
|
||||||
KotlinClassInderectInheritance2().foo()
|
KotlinClassInderectInheritance2().foo()
|
||||||
|
|
||||||
|
|||||||
+9
-9
@@ -24,7 +24,7 @@ import JavaInterface.testStatic
|
|||||||
|
|
||||||
interface KotlinInterface : JavaInterface {
|
interface KotlinInterface : JavaInterface {
|
||||||
fun fooo() {
|
fun fooo() {
|
||||||
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
test()
|
test()
|
||||||
testOverride()
|
testOverride()
|
||||||
@@ -37,7 +37,7 @@ interface KotlinInterface : JavaInterface {
|
|||||||
|
|
||||||
interface KotlinInterfaceIndirectInheritance : KotlinInterface {
|
interface KotlinInterfaceIndirectInheritance : KotlinInterface {
|
||||||
fun foooo() {
|
fun foooo() {
|
||||||
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
testOverride()
|
testOverride()
|
||||||
super.testOverride()
|
super.testOverride()
|
||||||
@@ -46,15 +46,15 @@ interface KotlinInterfaceIndirectInheritance : KotlinInterface {
|
|||||||
|
|
||||||
open class KotlinClass : JavaInterface {
|
open class KotlinClass : JavaInterface {
|
||||||
fun foo(){
|
fun foo(){
|
||||||
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET!>test<!>()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET!>testOverride<!>()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testOverride<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KotlinClassIndirectInheritance : KotlinClass() {
|
class KotlinClassIndirectInheritance : KotlinClass() {
|
||||||
fun foo2(){
|
fun foo2(){
|
||||||
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.test()
|
super.test()
|
||||||
super.testOverride()
|
super.testOverride()
|
||||||
}
|
}
|
||||||
@@ -62,14 +62,14 @@ class KotlinClassIndirectInheritance : KotlinClass() {
|
|||||||
|
|
||||||
class KotlinClassIndirectInheritance2 : KotlinInterfaceIndirectInheritance {
|
class KotlinClassIndirectInheritance2 : KotlinInterfaceIndirectInheritance {
|
||||||
fun foo(){
|
fun foo(){
|
||||||
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET!>test<!>()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
super.testOverride()
|
super.testOverride()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
JavaInterface.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
JavaInterface.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>testStatic<!>()
|
||||||
KotlinClass().foo()
|
KotlinClass().foo()
|
||||||
KotlinClassIndirectInheritance2().foo()
|
KotlinClassIndirectInheritance2().foo()
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
//!LANGUAGE: -DefaultMethodsCallFromJava6TargetError
|
||||||
|
// FILE: JavaInterface.java
|
||||||
|
|
||||||
|
public interface JavaInterface {
|
||||||
|
static String testStatic() {
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
default String test() {
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
default String testOverride() {
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: 1.kt
|
||||||
|
|
||||||
|
import JavaInterface.testStatic
|
||||||
|
|
||||||
|
interface KotlinInterface : JavaInterface {
|
||||||
|
fun fooo() {
|
||||||
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
||||||
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun testOverride(): String {
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface KotlinInterfaceInderectInheritance : KotlinInterface {
|
||||||
|
fun foooo() {
|
||||||
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
||||||
|
super.<!INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER!>test<!>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open class KotlinClass : JavaInterface {
|
||||||
|
fun foo(){
|
||||||
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
||||||
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET!>test<!>()
|
||||||
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET!>testOverride<!>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class KotlinClassInderectInheritance : KotlinClass() {
|
||||||
|
fun foo2(){
|
||||||
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
||||||
|
super.test()
|
||||||
|
super.testOverride()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class KotlinClassInderectInheritance2 : KotlinInterfaceInderectInheritance {
|
||||||
|
fun foo(){
|
||||||
|
<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
||||||
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET!>test<!>()
|
||||||
|
super.testOverride()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
JavaInterface.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>testStatic<!>()
|
||||||
|
KotlinClass().foo()
|
||||||
|
KotlinClassInderectInheritance2().foo()
|
||||||
|
|
||||||
|
KotlinClass().test()
|
||||||
|
KotlinClass().testOverride()
|
||||||
|
KotlinClassInderectInheritance().testOverride()
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun test(): kotlin.Unit
|
||||||
|
|
||||||
|
public interface JavaInterface {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open fun test(): kotlin.String!
|
||||||
|
public open fun testOverride(): kotlin.String!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public open fun testStatic(): kotlin.String!
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class KotlinClass : JavaInterface {
|
||||||
|
public constructor KotlinClass()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun test(): kotlin.String!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun testOverride(): kotlin.String!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class KotlinClassInderectInheritance : KotlinClass {
|
||||||
|
public constructor KotlinClassInderectInheritance()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||||
|
public final fun foo2(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun test(): kotlin.String!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun testOverride(): kotlin.String!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class KotlinClassInderectInheritance2 : KotlinInterfaceInderectInheritance {
|
||||||
|
public constructor KotlinClassInderectInheritance2()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun fooo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun foooo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun test(): kotlin.String!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun testOverride(): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface KotlinInterface : JavaInterface {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open fun fooo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun test(): kotlin.String!
|
||||||
|
public open override /*1*/ fun testOverride(): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface KotlinInterfaceInderectInheritance : KotlinInterface {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun fooo(): kotlin.Unit
|
||||||
|
public open fun foooo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun test(): kotlin.String!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun testOverride(): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
+1
-1
@@ -18,7 +18,7 @@ class K : C()
|
|||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
I.a
|
I.a
|
||||||
I.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>foo<!>()
|
I.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>foo<!>()
|
||||||
|
|
||||||
C.a
|
C.a
|
||||||
C.b
|
C.b
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ interface KTrait2 : KTrait {
|
|||||||
|
|
||||||
class A : KTrait {
|
class A : KTrait {
|
||||||
fun a() {
|
fun a() {
|
||||||
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET!>test<!>()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
|
|
||||||
test()
|
test()
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ class A : KTrait {
|
|||||||
|
|
||||||
class A2 : KTrait2 {
|
class A2 : KTrait2 {
|
||||||
fun a() {
|
fun a() {
|
||||||
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET!>test<!>()
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>test<!>()
|
||||||
|
|
||||||
test()
|
test()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import java.util.stream.*
|
import java.util.stream.*
|
||||||
|
|
||||||
interface A : Collection<String> {
|
interface A : Collection<String> {
|
||||||
override fun stream(): Stream<String> = Stream.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET!>of<!>()
|
override fun stream(): Stream<String> = Stream.<!INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>of<!>()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo(x: List<String>, y: A) {
|
fun foo(x: List<String>, y: A) {
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
abstract class A : MutableList<String> {
|
abstract class A : MutableList<String> {
|
||||||
override fun sort(/*0*/ p0: java.util.Comparator<in String>) {
|
override fun sort(/*0*/ p0: java.util.Comparator<in String>) {
|
||||||
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET!>sort<!>(p0)
|
super.<!DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET_ERROR!>sort<!>(p0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
@@ -102,6 +102,12 @@ public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodeg
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("invokeDefaultViaSuper_16.kt")
|
||||||
|
public void testInvokeDefaultViaSuper_16() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/invokeDefaultViaSuper_16.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("longChainOfKotlinExtendsFromJavaWithDefault.kt")
|
@TestMetadata("longChainOfKotlinExtendsFromJavaWithDefault.kt")
|
||||||
public void testLongChainOfKotlinExtendsFromJavaWithDefault() throws Exception {
|
public void testLongChainOfKotlinExtendsFromJavaWithDefault() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/longChainOfKotlinExtendsFromJavaWithDefault.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/longChainOfKotlinExtendsFromJavaWithDefault.kt");
|
||||||
|
|||||||
@@ -12370,6 +12370,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("defaultMethods_warning.kt")
|
||||||
|
public void testDefaultMethods_warning() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/defaultMethods_warning.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("differentFilename.kt")
|
@TestMetadata("differentFilename.kt")
|
||||||
public void testDifferentFilename() throws Exception {
|
public void testDifferentFilename() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/differentFilename.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/differentFilename.kt");
|
||||||
|
|||||||
+6
@@ -12370,6 +12370,12 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("defaultMethods_warning.kt")
|
||||||
|
public void testDefaultMethods_warning() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/defaultMethods_warning.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("differentFilename.kt")
|
@TestMetadata("differentFilename.kt")
|
||||||
public void testDifferentFilename() throws Exception {
|
public void testDifferentFilename() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/differentFilename.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/differentFilename.kt");
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ enum class LanguageFeature(
|
|||||||
JvmPackageName(KOTLIN_1_2),
|
JvmPackageName(KOTLIN_1_2),
|
||||||
AssigningArraysToVarargsInNamedFormInAnnotations(KOTLIN_1_2),
|
AssigningArraysToVarargsInNamedFormInAnnotations(KOTLIN_1_2),
|
||||||
ExpectedTypeFromCast(KOTLIN_1_2),
|
ExpectedTypeFromCast(KOTLIN_1_2),
|
||||||
|
DefaultMethodsCallFromJava6TargetError(KOTLIN_1_2),
|
||||||
|
|
||||||
BooleanElvisBoundSmartCasts(KOTLIN_1_3),
|
BooleanElvisBoundSmartCasts(KOTLIN_1_3),
|
||||||
ReturnsEffect(KOTLIN_1_3),
|
ReturnsEffect(KOTLIN_1_3),
|
||||||
|
|||||||
Reference in New Issue
Block a user