Moved compiledJava cases to generated test.

This commit is contained in:
Evgeny Gerashchenko
2013-03-06 16:44:57 +04:00
parent b109a104f1
commit e943b9c9ab
32 changed files with 949 additions and 858 deletions
@@ -0,0 +1,7 @@
package test;
//TODO: move to LoadJavaTestGenerated when possible
public enum MyEnum {
ENTRY,
ANOTHER;
}
@@ -0,0 +1,15 @@
package test
public final enum class MyEnum : jet.Enum<test.MyEnum> {
private constructor MyEnum()
public final override /*1*/ /*fake_override*/ fun name() : jet.String
public final override /*1*/ /*fake_override*/ fun ordinal() : jet.Int
public class object <class-object-for-MyEnum> {
private constructor <class-object-for-MyEnum>()
public final val ANOTHER : test.MyEnum
public final val ENTRY : test.MyEnum
public final fun valueOf(/*0*/ value : jet.String) : test.MyEnum
public final fun values() : jet.Array<test.MyEnum>
}
}
@@ -0,0 +1,11 @@
package test;
public class inner implements B.C {
}
class B {
B(C c) {}
interface C {
}
}
@@ -0,0 +1,5 @@
package test
public open class inner : test.B.C {
public constructor inner()
}
@@ -0,0 +1,5 @@
package test;
public class ProtectedPackageConstructor {
protected static class Foo { }
}
@@ -0,0 +1,9 @@
package test
public open class ProtectedPackageConstructor : java.lang.Object {
public constructor ProtectedPackageConstructor()
protected/*protected static*/ open class Foo : java.lang.Object {
protected/*protected and package*/ constructor Foo()
}
}
@@ -0,0 +1,5 @@
package test;
public class ProtectedPackageFun {
protected void foo() {}
}
@@ -0,0 +1,6 @@
package test
public open class ProtectedPackageFun : java.lang.Object {
public constructor ProtectedPackageFun()
protected/*protected and package*/ open fun foo() : Unit
}
@@ -0,0 +1,5 @@
package test;
public class ProtectedPackageProperty {
protected int foo = 1;
}
@@ -0,0 +1,6 @@
package test
public open class ProtectedPackageProperty : java.lang.Object {
public constructor ProtectedPackageProperty()
protected/*protected and package*/ final var foo : jet.Int
}
@@ -0,0 +1,7 @@
package test;
public class ConstructorInProtectedStaticNestedClass {
protected static class Inner {
}
}
@@ -0,0 +1,9 @@
package test
public open class ConstructorInProtectedStaticNestedClass : java.lang.Object {
public constructor ConstructorInProtectedStaticNestedClass()
protected/*protected static*/ open class Inner : java.lang.Object {
protected/*protected and package*/ constructor Inner()
}
}
@@ -0,0 +1,24 @@
package test;
import java.util.List;
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
public interface ArraysInSubtypes {
interface Super {
CharSequence[] array();
List<? extends CharSequence[]> listOfArray();
Object[] objArray();
}
interface Sub<T> extends Super {
@ExpectLoadError("Return type is not a subtype of overridden method. To fix it, add annotation with Kotlin signature to super method with type Array<CharSequence>? replaced with Array<out CharSequence>? in return type")
String[] array();
@ExpectLoadError("Return type is not a subtype of overridden method. To fix it, add annotation with Kotlin signature to super method with type Array<CharSequence>? replaced with Array<out CharSequence>? in return type")
List<? extends String[]> listOfArray();
@ExpectLoadError("Return type is not a subtype of overridden method. To fix it, add annotation with Kotlin signature to super method with type Array<Any>? replaced with Array<out Any>? in return type")
T[] objArray();
}
}
@@ -0,0 +1,16 @@
package test
public trait ArraysInSubtypes : java.lang.Object {
public trait Sub</*0*/ T> : test.ArraysInSubtypes.Super {
public abstract override /*1*/ fun array() : jet.Array<jet.String>?
public abstract override /*1*/ fun listOfArray() : jet.MutableList<out jet.Array<jet.String>?>?
public abstract override /*1*/ fun objArray() : jet.Array<T>?
}
public trait Super : java.lang.Object {
public abstract fun array() : jet.Array<jet.CharSequence>?
public abstract fun listOfArray() : jet.MutableList<out jet.Array<jet.CharSequence>?>?
public abstract fun objArray() : jet.Array<jet.Any>?
}
}
@@ -0,0 +1,15 @@
package test;
public interface MethodTypeParameterErased {
public interface Bug<T> {
<RET extends Bug<T>> RET save();
}
public class SubBug implements Bug<Object> {
public SubBug save() {
return this;
}
}
}
@@ -0,0 +1,13 @@
package test
public trait MethodTypeParameterErased : java.lang.Object {
public trait Bug</*0*/ T> : java.lang.Object {
public abstract fun </*0*/ RET : test.MethodTypeParameterErased.Bug<T>?> save() : RET?
}
public open class SubBug : test.MethodTypeParameterErased.Bug<jet.Any> {
public constructor SubBug()
public open fun save() : test.MethodTypeParameterErased.SubBug?
}
}
@@ -0,0 +1,20 @@
package test;
import java.lang.Object;
import java.lang.Override;
import java.lang.UnsupportedOperationException;
public class RawSuperType {
public interface Super<T> {
void foo(T t);
}
public class Derived implements Super {
@Override
public void foo(Object o) {
throw new UnsupportedOperationException();
}
}
}
@@ -0,0 +1,14 @@
package test
public open class RawSuperType : java.lang.Object {
public constructor RawSuperType()
public open inner class Derived : test.RawSuperType.Super<jet.Any?> {
public constructor Derived()
public open override /*1*/ fun foo(/*0*/ p0 : jet.Any?) : Unit
}
public trait Super</*0*/ T> : java.lang.Object {
public abstract fun foo(/*0*/ p0 : T?) : Unit
}
}
@@ -0,0 +1,21 @@
package test;
//This test could be written in simple load java test, but KT-3128 prevents from writing Kotlin counterpart for it
//See the same test data in sourceJava test data
public interface ReturnInnerSubclassOfSupersInner {
class Super<A> {
class Inner {
Super<A> get() {
throw new UnsupportedOperationException();
}
}
}
class Sub<B> extends Super<B> {
class Inner extends Super<B>.Inner {
Sub<B> get() {
throw new UnsupportedOperationException();
}
}
}
}
@@ -0,0 +1,22 @@
package test
public trait ReturnInnerSubclassOfSupersInner : java.lang.Object {
public open class Sub</*0*/ B> : test.ReturnInnerSubclassOfSupersInner.Super<B> {
public constructor Sub</*0*/ B>()
public/*package*/ open inner class Inner : test.ReturnInnerSubclassOfSupersInner.Super.Inner {
public/*package*/ constructor Inner()
public/*package*/ open override /*1*/ fun get() : test.ReturnInnerSubclassOfSupersInner.Sub<B>?
}
}
public open class Super</*0*/ A> : java.lang.Object {
public constructor Super</*0*/ A>()
public/*package*/ open inner class Inner : java.lang.Object {
public/*package*/ constructor Inner()
public/*package*/ open fun get() : test.ReturnInnerSubclassOfSupersInner.Super<A>?
}
}
}
@@ -0,0 +1,36 @@
package test;
import java.io.Serializable;
import java.lang.Comparable;
import java.lang.Runnable;
import java.util.List;
public interface SubclassWithRawType {
interface Super {
List simple1();
List simple2();
List<String> simple3();
List<? extends List> boundWildcard1();
List<? super List<String>> boundWildcard2();
List<?> wildcard();
List[] array1();
List<String>[] array2();
}
interface Sub extends Super {
List<String> simple1();
List<List<String>> simple2();
List simple3();
List<? extends List<String>> boundWildcard1();
List<? super List> boundWildcard2();
List wildcard();
List<String>[] array1();
List[] array2();
}
}
@@ -0,0 +1,26 @@
package test
public trait SubclassWithRawType : java.lang.Object {
public trait Sub : test.SubclassWithRawType.Super {
public abstract override /*1*/ fun array1() : jet.Array<jet.List<jet.String?>>?
public abstract override /*1*/ fun array2() : jet.Array<jet.List<jet.Any>>?
public abstract override /*1*/ fun boundWildcard1() : jet.MutableList<out jet.List<jet.String?>?>?
public abstract override /*1*/ fun boundWildcard2() : jet.MutableList<in jet.List<jet.Any>?>?
public abstract override /*1*/ fun simple1() : jet.MutableList<out jet.String?>?
public abstract override /*1*/ fun simple2() : jet.MutableList<out jet.List<jet.String>?>?
public abstract override /*1*/ fun simple3() : jet.MutableList<out jet.Any>?
public abstract override /*1*/ fun wildcard() : jet.MutableList<out jet.Any?>?
}
public trait Super : java.lang.Object {
public abstract fun array1() : jet.Array<jet.List<jet.Any?>>?
public abstract fun array2() : jet.Array<jet.List<jet.String>>?
public abstract fun boundWildcard1() : jet.MutableList<out jet.List<jet.Any?>?>?
public abstract fun boundWildcard2() : jet.MutableList<in jet.List<jet.String>?>?
public abstract fun simple1() : jet.MutableList<out jet.Any?>?
public abstract fun simple2() : jet.MutableList<out jet.Any?>?
public abstract fun simple3() : jet.MutableList<jet.String>?
public abstract fun wildcard() : jet.MutableList<out jet.Any?>?
}
}
@@ -0,0 +1,24 @@
package test;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import jet.runtime.typeinfo.KotlinSignature;
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
public interface TwoSuperclassesInconsistentGenericTypes {
@KotlinSignature("fun foo(): MutableList<String?>")
List<String> foo();
public interface Other {
@KotlinSignature("fun foo(): MutableList<String>?")
List<String> foo();
}
public class Sub implements TwoSuperclassesInconsistentGenericTypes, Other {
@ExpectLoadError("Incompatible types in superclasses: [String?, String]")
public List<String> foo() {
throw new UnsupportedOperationException();
}
}
}
@@ -0,0 +1,14 @@
package test
public trait TwoSuperclassesInconsistentGenericTypes : java.lang.Object {
public abstract fun foo() : jet.MutableList<jet.String?>
public trait Other : java.lang.Object {
public abstract fun foo() : jet.MutableList<jet.String>?
}
public open class Sub : test.TwoSuperclassesInconsistentGenericTypes, test.TwoSuperclassesInconsistentGenericTypes.Other {
public constructor Sub()
public open override /*2*/ fun foo() : jet.MutableList<jet.String>
}
}
@@ -0,0 +1,27 @@
package test;
import org.jetbrains.annotations.NotNull;
import java.lang.String;
import java.util.List;
import jet.runtime.typeinfo.KotlinSignature;
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
public interface TwoSuperclassesVarargAndNot {
public interface Super1 {
void foo(String... s);
}
public interface Super2 {
@KotlinSignature("fun foo(s : Array<out String?>?)")
void foo(String[] s);
}
public interface Sub extends Super1, Super2 {
@ExpectLoadError("Incompatible projection kinds in type arguments of super methods' return types: [String?, out String?]|" +
"Incompatible super methods: some have vararg parameter, some have not|" +
"Incompatible types in superclasses: [Array<String?>, Array<out String?>?]")
void foo(String[] s);
}
}
@@ -0,0 +1,17 @@
package test
public trait TwoSuperclassesVarargAndNot : java.lang.Object {
public trait Sub : test.TwoSuperclassesVarargAndNot.Super1, test.TwoSuperclassesVarargAndNot.Super2 {
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ vararg p0 : jet.String? /*jet.Array<jet.String?>*/) : Unit
public abstract override /*1*/ fun foo(/*0*/ p0 : jet.Array<out jet.String?>?) : Unit
}
public trait Super1 : java.lang.Object {
public abstract fun foo(/*0*/ vararg p0 : jet.String? /*jet.Array<jet.String?>*/) : Unit
}
public trait Super2 : java.lang.Object {
public abstract fun foo(/*0*/ p0 : jet.Array<out jet.String?>?) : Unit
}
}
@@ -0,0 +1,3 @@
public class test {
public static final String foo = "aaa";
}
@@ -0,0 +1,3 @@
package test
public val foo : jet.String