Remove wrong condition part: there could be irrelevant overrides from Kotlin

This commit is contained in:
Denis Zharkov
2015-10-28 11:26:55 +03:00
parent 291f0e57d1
commit 5755af6b27
10 changed files with 363 additions and 2 deletions

View File

@@ -0,0 +1,7 @@
public class J {
public static class A extends AImpl implements CharSequence {
public CharSequence subSequence(int start, int end) {
return null;
}
}
}

View File

@@ -0,0 +1,18 @@
abstract class AImpl {
fun charAt(index: Int): Char {
return 'A'
}
fun length(): Int {
return 56
}
}
class X : J.A()
fun box(): String {
val x = X()
if (x.length != 56) return "fail 1"
if (x[0] != 'A') return "fail 2"
return "OK"
}

View File

@@ -0,0 +1,99 @@
import java.util.*;
public class J {
abstract static public class AImpl {
public final int size() {
return 56;
}
public boolean isEmpty() {
return false;
}
public final boolean contains(Object o) {
return true;
}
public Iterator<String> iterator() {
return null;
}
public Object[] toArray() {
return new Object[0];
}
public <T> T[] toArray(T[] a) {
return null;
}
public boolean add(String s) {
return false;
}
public boolean remove(Object o) {
return false;
}
public boolean containsAll(Collection<?> c) {
return false;
}
public boolean addAll(Collection<? extends String> c) {
return false;
}
public boolean addAll(int index, Collection<? extends String> c) {
return false;
}
public boolean removeAll(Collection<?> c) {
return false;
}
public boolean retainAll(Collection<?> c) {
return false;
}
public void clear() {
}
public String get(int index) {
return null;
}
public String set(int index, String element) {
return null;
}
public void add(int index, String element) {
}
public String remove(int index) {
return null;
}
public int indexOf(Object o) {
return 0;
}
public int lastIndexOf(Object o) {
return 0;
}
public ListIterator<String> listIterator() {
return null;
}
public ListIterator<String> listIterator(int index) {
return null;
}
public List<String> subList(int fromIndex, int toIndex) {
return null;
}
}
public static class A extends AImpl implements List<String> {
}
}

View File

@@ -0,0 +1,10 @@
class X : J.A()
fun box(): String {
val x = X()
if (x.size != 56) return "fail 1"
if (!x.contains("")) return "fail 2"
return "OK"
}

View File

@@ -0,0 +1,4 @@
public class A extends AImpl implements java.util.List<String> {
public <T> T[] toArray(T[] a) {return null;}
public Object[] toArray() {return null;}
}

View File

@@ -0,0 +1,91 @@
public abstract class AImpl {
fun add(element: String): Boolean {
throw UnsupportedOperationException()
}
fun remove(element: Any?): Boolean {
throw UnsupportedOperationException()
}
fun addAll(elements: Collection<String>): Boolean {
throw UnsupportedOperationException()
}
fun addAll(index: Int, elements: Collection<String>): Boolean {
throw UnsupportedOperationException()
}
fun removeAll(elements: Collection<*>): Boolean {
throw UnsupportedOperationException()
}
fun retainAll(elements: Collection<*>): Boolean {
throw UnsupportedOperationException()
}
fun clear() {
throw UnsupportedOperationException()
}
fun set(index: Int, element: String): String {
throw UnsupportedOperationException()
}
fun add(index: Int, element: String) {
throw UnsupportedOperationException()
}
fun remove(index: Int): String {
throw UnsupportedOperationException()
}
fun listIterator(): MutableListIterator<String> {
throw UnsupportedOperationException()
}
fun listIterator(index: Int): MutableListIterator<String> {
throw UnsupportedOperationException()
}
fun subList(fromIndex: Int, toIndex: Int): MutableList<String> {
throw UnsupportedOperationException()
}
fun size(): Int = 56
fun isEmpty(): Boolean {
throw UnsupportedOperationException()
}
fun contains(element: Any?) = true
fun containsAll(elements: Collection<*>): Boolean {
throw UnsupportedOperationException()
}
fun get(index: Int): String {
throw UnsupportedOperationException()
}
fun indexOf(element: Any?): Int {
throw UnsupportedOperationException()
}
fun lastIndexOf(element: Any?): Int {
throw UnsupportedOperationException()
}
fun iterator(): MutableIterator<String> {
throw UnsupportedOperationException()
}
}
class X : A()
fun box(): String {
val x = X()
if (x.size != 56) return "fail 1"
if (!x.contains("")) return "fail 2"
return "OK"
}

View File

@@ -0,0 +1,99 @@
import java.util.*;
public class J {
abstract static public class AImpl<E> {
public int size() {
return 56;
}
public boolean isEmpty() {
return false;
}
public final boolean contains(Object o) {
return true;
}
public Iterator<E> iterator() {
return null;
}
public Object[] toArray() {
return new Object[0];
}
public <T> T[] toArray(T[] a) {
return null;
}
public boolean add(E s) {
return false;
}
public boolean remove(Object o) {
return false;
}
public boolean containsAll(Collection<?> c) {
return false;
}
public boolean addAll(Collection<? extends E> c) {
return false;
}
public boolean addAll(int index, Collection<? extends E> c) {
return false;
}
public boolean removeAll(Collection<?> c) {
return false;
}
public boolean retainAll(Collection<?> c) {
return false;
}
public void clear() {
}
public E get(int index) {
return null;
}
public E set(int index, E element) {
return null;
}
public void add(int index, E element) {
}
public E remove(int index) {
return null;
}
public int indexOf(Object o) {
return 0;
}
public int lastIndexOf(Object o) {
return 0;
}
public ListIterator<E> listIterator() {
return null;
}
public ListIterator<E> listIterator(int index) {
return null;
}
public List<E> subList(int fromIndex, int toIndex) {
return null;
}
}
public static class A<E> extends AImpl<E> implements List<E> {
}
}

View File

@@ -0,0 +1,10 @@
class X : J.A<Any?>()
fun box(): String {
val x = X()
if (x.size != 56) return "fail 1"
if (!x.contains(null)) return "fail 2"
return "OK"
}