Change Signature: Support Kotlin functions overriding Java methods
#KT-5856 Fixed
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
open class X: A() {
|
||||
fun foo(x: Int): String? {
|
||||
return super.foo(1)
|
||||
}
|
||||
}
|
||||
|
||||
open class Y: B() {
|
||||
fun foo(x: Int): String? {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
open class Z: X() {
|
||||
fun foo(x: Int): String? {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A().foo(1)
|
||||
B().foo(1)
|
||||
X().foo(1)
|
||||
Y().foo(1)
|
||||
Z().foo(1)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import java.lang.Override;
|
||||
import java.lang.String;
|
||||
|
||||
class A {
|
||||
String foo(int x) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
@Override
|
||||
String foo(int x) {
|
||||
return super.foo(x);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
new A().foo(1);
|
||||
new B().foo(1);
|
||||
new X().foo(1);
|
||||
new Y().foo(1);
|
||||
new Z().foo(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
open class X: A() {
|
||||
fun foo(s: String): Int {
|
||||
return super.foo(s)
|
||||
}
|
||||
}
|
||||
|
||||
open class Y: B() {
|
||||
fun foo(s: String): Int {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
open class Z: X() {
|
||||
fun foo(s: String): Int {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A().foo("")
|
||||
B().foo("")
|
||||
X().foo("")
|
||||
Y().foo("")
|
||||
Z().foo("")
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import java.lang.Override;
|
||||
import java.lang.String;
|
||||
|
||||
class A {
|
||||
int <caret>foo(String s) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
@Override
|
||||
int foo(String s) {
|
||||
return super.foo(s);
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
new A().foo("");
|
||||
new B().foo("");
|
||||
new X().foo("");
|
||||
new Y().foo("");
|
||||
new Z().foo("");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user