Light class builder: do not generate methods delegating to DefaultImpls in kotlin classes
Class APIs from java point of view stays the same so we can avoid generating those methods
Otherwise we have to calculate all supertypes when getMethods() is called,
which imposes severe performance penalties
We have to pretend these methods are not 'abstract' (also we consider them 'default' for safety)
so java highlighting does not report "class should be abstract" for all inheritors
We have to manually report "class should be abstract" on some of the java inheritors,
specifically those that are implementing interfaces directly
as opposed to extending kotlin classes implementing those interfaces
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
package test;
|
||||
|
||||
public class ExtendClassWithDefaultImplementationComplext {
|
||||
<error descr="Class 'Test1' must either be declared abstract or implement abstract method 'a()' in 'A'">public static class Test1 implements A</error> {
|
||||
|
||||
}
|
||||
|
||||
public static class Test2 extends AI implements A {
|
||||
|
||||
}
|
||||
|
||||
<error descr="Class 'Test3' must either be declared abstract or implement abstract method 'b()' in 'B'">public static class Test3 extends AI implements B</error> {
|
||||
|
||||
}
|
||||
|
||||
public static class Test4 extends BI implements B {
|
||||
|
||||
}
|
||||
|
||||
<error descr="Class 'Test5' must either be declared abstract or implement abstract method 'c()' in 'C'">public static class Test5 extends BI implements C</error> {
|
||||
|
||||
}
|
||||
|
||||
<error descr="Class 'Test6' must either be declared abstract or implement abstract method 'd()' in 'D'">public static class Test6 extends BI implements D</error> {
|
||||
|
||||
}
|
||||
|
||||
public static class Test7 extends BI implements S {
|
||||
|
||||
}
|
||||
|
||||
public static interface Test8 extends A {
|
||||
|
||||
}
|
||||
|
||||
public static abstract class Test9 implements A {
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
package test
|
||||
|
||||
interface A {
|
||||
fun a() = Unit
|
||||
}
|
||||
|
||||
open class AI : A
|
||||
|
||||
interface B : A {
|
||||
fun b() = Unit
|
||||
}
|
||||
|
||||
open class BI: B
|
||||
|
||||
interface C: B {
|
||||
fun c() = Unit
|
||||
}
|
||||
|
||||
interface D {
|
||||
fun d() = Unit
|
||||
}
|
||||
|
||||
interface S {
|
||||
fun a() = Unit
|
||||
fun b() = Unit
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
package test;
|
||||
|
||||
public class ExtendClassWithDefaultImplementation_1_6 {
|
||||
public static class ExtendClass extends KotlinClass {
|
||||
|
||||
}
|
||||
|
||||
<error descr="Class 'ImplementInterface' must either be declared abstract or implement abstract method 'bar()' in 'KotlinInterface'">public static class ImplementInterface implements KotlinInterface</error> {
|
||||
@Override
|
||||
public void f() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
package test
|
||||
|
||||
interface KotlinInterface {
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
|
||||
}
|
||||
|
||||
fun f()
|
||||
}
|
||||
|
||||
|
||||
abstract class KotlinClass : KotlinInterface {
|
||||
override fun f() {
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
// LANGUAGE_LEVEL 1.6
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
package test;
|
||||
|
||||
public class ExtendClassWithDefaultImplementation_1_8 {
|
||||
public static class ExtendClass extends KotlinClass {
|
||||
|
||||
}
|
||||
|
||||
<error descr="Class 'ImplementInterface' must either be declared abstract or implement abstract method 'bar()' in 'KotlinInterface'">public static class ImplementInterface implements KotlinInterface</error> {
|
||||
@Override
|
||||
public void f() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
package test
|
||||
|
||||
interface KotlinInterface {
|
||||
fun foo() {
|
||||
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
|
||||
}
|
||||
|
||||
fun f()
|
||||
}
|
||||
|
||||
|
||||
abstract class KotlinClass : KotlinInterface {
|
||||
override fun f() {
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
// LANGUAGE_LEVEL 1.8
|
||||
Reference in New Issue
Block a user