Optimize method count for collection stubs

Do not generate stubs if they're already present in superclasses

 #KT-13698 In Progress
This commit is contained in:
Denis Zharkov
2016-10-05 15:52:48 +03:00
parent 900c442efd
commit e05e0ec921
13 changed files with 414 additions and 25 deletions
@@ -0,0 +1,58 @@
// FILE: test/B.java
package test;
public abstract class B<E> extends A<E> implements L<E> {
}
// FILE: main.kt
package test
open class A<T> : Collection<T> {
override val size: Int
get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates.
override fun contains(element: T): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun containsAll(elements: Collection<T>): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun isEmpty(): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun iterator(): Iterator<T> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
interface L<Q> : List<Q>
// 'remove(Int)' method must be present in C though it has supeclass that is subclass of List
class C<F> : B<F>() {
override fun get(index: Int): F {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun indexOf(element: F): Int {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun lastIndexOf(element: F): Int {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun listIterator(): ListIterator<F> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun listIterator(index: Int): ListIterator<F> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun subList(fromIndex: Int, toIndex: Int): List<F> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -0,0 +1,38 @@
@kotlin.Metadata
public class test/A {
public method <init>(): void
public method add(p0: java.lang.Object): boolean
public method addAll(p0: java.util.Collection): boolean
public method clear(): void
public method contains(p0: java.lang.Object): boolean
public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean
public method getSize(): int
public method isEmpty(): boolean
public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator
public method remove(p0: java.lang.Object): boolean
public method removeAll(p0: java.util.Collection): boolean
public method retainAll(p0: java.util.Collection): boolean
public final method size(): int
public method toArray(): java.lang.Object[]
public method toArray(p0: java.lang.Object[]): java.lang.Object[]
}
@kotlin.Metadata
public final class test/C {
public method <init>(): void
public method add(p0: int, p1: java.lang.Object): void
public method addAll(p0: int, p1: java.util.Collection): boolean
public method get(p0: int): java.lang.Object
public method indexOf(p0: java.lang.Object): int
public method lastIndexOf(p0: java.lang.Object): int
public @org.jetbrains.annotations.NotNull method listIterator(): java.util.ListIterator
public @org.jetbrains.annotations.NotNull method listIterator(p0: int): java.util.ListIterator
public method remove(p0: int): java.lang.Object
public method set(p0: int, p1: java.lang.Object): java.lang.Object
public @org.jetbrains.annotations.NotNull method subList(p0: int, p1: int): java.util.List
public method toArray(): java.lang.Object[]
public method toArray(p0: java.lang.Object[]): java.lang.Object[]
}
@kotlin.Metadata
public interface test/L
@@ -0,0 +1,47 @@
open class A<T> : Collection<T> {
override val size: Int
get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates.
override fun contains(element: T): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun containsAll(elements: Collection<T>): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun isEmpty(): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun iterator(): Iterator<T> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
open class B<E> : A<E>()
class C<F> : B<F>(), List<F> {
override fun get(index: Int): F {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun indexOf(element: F): Int {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun lastIndexOf(element: F): Int {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun listIterator(): ListIterator<F> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun listIterator(index: Int): ListIterator<F> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun subList(fromIndex: Int, toIndex: Int): List<F> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -0,0 +1,42 @@
@kotlin.Metadata
public class A {
public method <init>(): void
public method add(p0: java.lang.Object): boolean
public method addAll(p0: java.util.Collection): boolean
public method clear(): void
public method contains(p0: java.lang.Object): boolean
public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean
public method getSize(): int
public method isEmpty(): boolean
public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator
public method remove(p0: java.lang.Object): boolean
public method removeAll(p0: java.util.Collection): boolean
public method retainAll(p0: java.util.Collection): boolean
public final method size(): int
public method toArray(): java.lang.Object[]
public method toArray(p0: java.lang.Object[]): java.lang.Object[]
}
@kotlin.Metadata
public class B {
public method <init>(): void
public method toArray(): java.lang.Object[]
public method toArray(p0: java.lang.Object[]): java.lang.Object[]
}
@kotlin.Metadata
public final class C {
public method <init>(): void
public method add(p0: int, p1: java.lang.Object): void
public method addAll(p0: int, p1: java.util.Collection): boolean
public method get(p0: int): java.lang.Object
public method indexOf(p0: java.lang.Object): int
public method lastIndexOf(p0: java.lang.Object): int
public @org.jetbrains.annotations.NotNull method listIterator(): java.util.ListIterator
public @org.jetbrains.annotations.NotNull method listIterator(p0: int): java.util.ListIterator
public method remove(p0: int): java.lang.Object
public method set(p0: int, p1: java.lang.Object): java.lang.Object
public @org.jetbrains.annotations.NotNull method subList(p0: int, p1: int): java.util.List
public method toArray(): java.lang.Object[]
public method toArray(p0: java.lang.Object[]): java.lang.Object[]
}
@@ -0,0 +1,47 @@
open class A<T> : Collection<T> {
override val size: Int
get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates.
override fun contains(element: T): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun containsAll(elements: Collection<T>): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun isEmpty(): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun iterator(): Iterator<T> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
open class B<E : CharSequence> : A<E>()
class C : B<CharSequence>(), List<CharSequence> {
override fun get(index: Int): CharSequence {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun indexOf(element: CharSequence): Int {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun lastIndexOf(element: CharSequence): Int {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun listIterator(): ListIterator<CharSequence> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun listIterator(index: Int): ListIterator<CharSequence> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun subList(fromIndex: Int, toIndex: Int): List<CharSequence> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -0,0 +1,50 @@
@kotlin.Metadata
public class A {
public method <init>(): void
public method add(p0: java.lang.Object): boolean
public method addAll(p0: java.util.Collection): boolean
public method clear(): void
public method contains(p0: java.lang.Object): boolean
public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean
public method getSize(): int
public method isEmpty(): boolean
public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator
public method remove(p0: java.lang.Object): boolean
public method removeAll(p0: java.util.Collection): boolean
public method retainAll(p0: java.util.Collection): boolean
public final method size(): int
public method toArray(): java.lang.Object[]
public method toArray(p0: java.lang.Object[]): java.lang.Object[]
}
@kotlin.Metadata
public class B {
public method <init>(): void
public method contains(p0: java.lang.CharSequence): boolean
public final method contains(p0: java.lang.Object): boolean
public method toArray(): java.lang.Object[]
public method toArray(p0: java.lang.Object[]): java.lang.Object[]
}
@kotlin.Metadata
public final class C {
public method <init>(): void
public method add(p0: int, p1: java.lang.CharSequence): void
public synthetic method add(p0: int, p1: java.lang.Object): void
public method addAll(p0: int, p1: java.util.Collection): boolean
public @org.jetbrains.annotations.NotNull method get(p0: int): java.lang.CharSequence
public synthetic method get(p0: int): java.lang.Object
public method indexOf(@org.jetbrains.annotations.NotNull p0: java.lang.CharSequence): int
public final method indexOf(p0: java.lang.Object): int
public method lastIndexOf(@org.jetbrains.annotations.NotNull p0: java.lang.CharSequence): int
public final method lastIndexOf(p0: java.lang.Object): int
public @org.jetbrains.annotations.NotNull method listIterator(): java.util.ListIterator
public @org.jetbrains.annotations.NotNull method listIterator(p0: int): java.util.ListIterator
public method remove(p0: int): java.lang.CharSequence
public synthetic method remove(p0: int): java.lang.Object
public method set(p0: int, p1: java.lang.CharSequence): java.lang.CharSequence
public synthetic method set(p0: int, p1: java.lang.Object): java.lang.Object
public @org.jetbrains.annotations.NotNull method subList(p0: int, p1: int): java.util.List
public method toArray(): java.lang.Object[]
public method toArray(p0: java.lang.Object[]): java.lang.Object[]
}