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:
Pavel V. Talanov
2017-03-30 17:44:19 +03:00
parent db294da24d
commit 4f701285b1
38 changed files with 510 additions and 45 deletions
@@ -0,0 +1,70 @@
public final class Wrapper {
public Wrapper() { /* compiled code */ }
public static final class Equals {
@org.jetbrains.annotations.NotNull
private final p.G code;
public boolean equals(@org.jetbrains.annotations.Nullable java.lang.Object other) { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final p.G getCode() { /* compiled code */ }
public Equals(@org.jetbrains.annotations.NotNull p.G code) { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final p.G component1() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final p.Wrapper.Equals copy(@org.jetbrains.annotations.NotNull p.G code) { /* compiled code */ }
public java.lang.String toString() { /* compiled code */ }
public int hashCode() { /* compiled code */ }
}
public static final class HashCode {
@org.jetbrains.annotations.NotNull
private final p.G code;
public int hashCode() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final p.G getCode() { /* compiled code */ }
public HashCode(@org.jetbrains.annotations.NotNull p.G code) { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final p.G component1() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final p.Wrapper.HashCode copy(@org.jetbrains.annotations.NotNull p.G code) { /* compiled code */ }
public java.lang.String toString() { /* compiled code */ }
public boolean equals(java.lang.Object p) { /* compiled code */ }
}
public static final class ToString {
@org.jetbrains.annotations.NotNull
private final p.G code;
@org.jetbrains.annotations.NotNull
public java.lang.String toString() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final p.G getCode() { /* compiled code */ }
public ToString(@org.jetbrains.annotations.NotNull p.G code) { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final p.G component1() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final p.Wrapper.ToString copy(@org.jetbrains.annotations.NotNull p.G code) { /* compiled code */ }
public int hashCode() { /* compiled code */ }
public boolean equals(java.lang.Object p) { /* compiled code */ }
}
}
@@ -0,0 +1,12 @@
public interface B extends p.A {
@org.jetbrains.annotations.NotNull
java.lang.String b();
final class DefaultImpls {
@org.jetbrains.annotations.NotNull
public static java.lang.String b(p.B $this) { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public static java.lang.String a(p.B $this) { /* compiled code */ }
}
}
@@ -0,0 +1,10 @@
// p.B
package p
interface A {
fun a() = "a"
}
interface B: A {
fun b() = "b"
}
@@ -0,0 +1,13 @@
public final class Inheritor implements p.I, p.I2 {
public final void f() { /* compiled code */ }
public void g() { /* compiled code */ }
public Inheritor() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public java.lang.String foo() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public java.lang.String bar() { /* compiled code */ }
}
@@ -0,0 +1,7 @@
public final class Inheritor implements p.I, p.I2 {
public final void f() { /* compiled code */ }
public void g() { /* compiled code */ }
public Inheritor() { /* compiled code */ }
}
@@ -0,0 +1,26 @@
// p.Inheritor
package p
class Inheritor: I, I2 {
fun f() {
}
override fun g() {
}
}
interface I : I1 {
fun g()
}
interface I1 {
fun foo() = "foo"
}
interface I2 {
fun bar() = "bar"
}
// LAZINESS:NoLaziness