Fix primitive override problem in Kotlin-Java inheritance
See the comment in JetTypeMapper
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
class ExtendsB extends B {
|
||||
void test() {
|
||||
byte x = foo();
|
||||
Byte y = foo();
|
||||
Object z = foo();
|
||||
}
|
||||
}
|
||||
|
||||
class ExtendsC extends C {
|
||||
void test() {
|
||||
byte x = foo();
|
||||
Byte y = foo();
|
||||
Object z = foo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Byte foo() { return 42; }
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
trait A<T> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
open class B : A<Byte> {
|
||||
override fun foo(): Byte = 42
|
||||
}
|
||||
|
||||
abstract class C : A<Byte>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
class Test {
|
||||
void test() {
|
||||
A<Integer> a = new B();
|
||||
int ax = a.foo();
|
||||
Integer ay = a.foo();
|
||||
Object az = a.foo();
|
||||
|
||||
B b = new B();
|
||||
int bx = b.foo();
|
||||
Integer by = b.foo();
|
||||
Object bz = b.foo();
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
trait A<T> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
class B : A<Int> {
|
||||
override final fun foo(): Int = 42
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
class Test {
|
||||
void test() {
|
||||
A<Integer> a = new B();
|
||||
int ax = a.foo();
|
||||
Integer ay = a.foo();
|
||||
Object az = a.foo();
|
||||
|
||||
B b = new B();
|
||||
int bx = b.foo();
|
||||
Integer by = b.foo();
|
||||
Object bz = b.foo();
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
trait A<T> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
class B : A<Int> {
|
||||
override fun foo(): Int = 42
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class Test extends B {
|
||||
void test() {
|
||||
int x = foo();
|
||||
Integer y = foo();
|
||||
Object z = foo();
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
trait A {
|
||||
fun foo(): Any
|
||||
}
|
||||
|
||||
open class B : A {
|
||||
override fun foo(): Int = 42
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
class Test extends B {
|
||||
void test() {
|
||||
A<Integer> a = new B();
|
||||
int ax = a.foo();
|
||||
Integer ay = a.foo();
|
||||
Object az = a.foo();
|
||||
|
||||
B b = new B();
|
||||
int bx = b.foo();
|
||||
Integer by = b.foo();
|
||||
Object bz = b.foo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
trait A<T> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
open class B : A<Int> {
|
||||
override final fun foo(): Int = 42
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
class ExtendsB extends B {
|
||||
void test() {
|
||||
int x = foo();
|
||||
Integer y = foo();
|
||||
Object z = foo();
|
||||
}
|
||||
}
|
||||
|
||||
class ExtendsC extends C {
|
||||
void test() {
|
||||
int x = foo();
|
||||
Integer y = foo();
|
||||
Object z = foo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer foo() { return 42; }
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
trait A<T : Comparable<T>> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
open class B : A<Int> {
|
||||
override fun foo(): Int = 42
|
||||
}
|
||||
|
||||
abstract class C : A<Int>
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
class ExtendsB extends B {
|
||||
void test() {
|
||||
int x = foo();
|
||||
Integer y = foo();
|
||||
Object z = foo();
|
||||
}
|
||||
}
|
||||
|
||||
class ExtendsC extends C {
|
||||
void test() {
|
||||
int x = foo();
|
||||
Integer y = foo();
|
||||
Object z = foo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer foo() { return 42; }
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
trait A<T : Number> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
open class B : A<Int> {
|
||||
override fun foo(): Int = 42
|
||||
}
|
||||
|
||||
abstract class C : A<Int>
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
class ExtendsB extends B {
|
||||
void test() {
|
||||
int x = foo();
|
||||
Integer y = foo();
|
||||
Object z = foo();
|
||||
}
|
||||
}
|
||||
|
||||
class ExtendsC extends C {
|
||||
void test() {
|
||||
int x = foo();
|
||||
Integer y = foo();
|
||||
Object z = foo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer foo() { return 42; }
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
trait A<T> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
open class B : A<Int> {
|
||||
override fun foo(): Int = 42
|
||||
}
|
||||
|
||||
abstract class C : A<Int>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class ExtendsD extends D {
|
||||
void test() {
|
||||
int x = foo();
|
||||
Integer y = foo();
|
||||
Object z = foo();
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
trait A<T> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
trait B : A
|
||||
|
||||
abstract class C : B
|
||||
|
||||
open class D : C() {
|
||||
override fun foo(): Int = 42
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
class ExtendsB extends B {
|
||||
void test() {
|
||||
int x = foo();
|
||||
Integer y = foo();
|
||||
Object z = foo();
|
||||
}
|
||||
}
|
||||
|
||||
class ExtendsC extends C {
|
||||
void test() {
|
||||
int x = foo();
|
||||
Integer y = foo();
|
||||
Object z = foo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer foo() { return 42; }
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
trait A<T> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
open class B : A<Int?> {
|
||||
override fun foo(): Int? = 42
|
||||
}
|
||||
|
||||
abstract class C : A<Int?>
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class ExtendsB extends B {
|
||||
@Override
|
||||
public Integer foo() {
|
||||
return 239;
|
||||
}
|
||||
|
||||
void test() {
|
||||
int x = foo();
|
||||
Integer y = foo();
|
||||
Object z = foo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
trait A<T> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
abstract class B : A<Int> {
|
||||
override abstract fun foo(): Int
|
||||
}
|
||||
Reference in New Issue
Block a user