Introduce 'reified' instead of 'erased'

This commit is contained in:
Andrey Breslav
2012-06-05 20:05:35 +04:00
parent 0ceee0a383
commit 91606a3901
98 changed files with 158 additions and 157 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ package jet
public fun arrayOfNulls<T>(public val size : Int) : Array<T?>
public class Array<T>(public val size : Int, init : (Int) -> T) {
public class Array<reified T>(public val size : Int, init : (Int) -> T) {
public fun get(index : Int) : T
public fun set(index : Int, value : T) : Unit
@@ -82,7 +82,7 @@ public class DescriptorResolver {
TypeParameterDescriptor typeParameterDescriptor = TypeParameterDescriptorImpl.createForFurtherModification(
descriptor,
annotationResolver.createAnnotationStubs(typeParameter.getModifierList(), trace),
!typeParameter.hasModifier(JetTokens.ERASED_KEYWORD),
typeParameter.hasModifier(JetTokens.REIFIED_KEYWORD),
typeParameter.getVariance(),
JetPsiUtil.safeName(typeParameter.getName()),
index
@@ -335,7 +335,7 @@ public class DescriptorResolver {
TypeParameterDescriptorImpl typeParameterDescriptor = TypeParameterDescriptorImpl.createForFurtherModification(
containingDescriptor,
annotationResolver.createAnnotationStubs(typeParameter.getModifierList(), trace),
!typeParameter.hasModifier(JetTokens.ERASED_KEYWORD),
typeParameter.hasModifier(JetTokens.REIFIED_KEYWORD),
typeParameter.getVariance(),
JetPsiUtil.safeName(typeParameter.getName()),
index
@@ -157,7 +157,7 @@ public interface JetTokens {
JetKeywordToken OUT_KEYWORD = JetKeywordToken.softKeyword("out");
JetKeywordToken VARARG_KEYWORD = JetKeywordToken.softKeyword("vararg");
JetKeywordToken INLINE_KEYWORD = JetKeywordToken.softKeyword("inline");
JetKeywordToken ERASED_KEYWORD = JetKeywordToken.softKeyword("erased");
JetKeywordToken REIFIED_KEYWORD = JetKeywordToken.softKeyword("reified");
JetKeywordToken FINALLY_KEYWORD = JetKeywordToken.softKeyword("finally");
JetKeywordToken FINAL_KEYWORD = JetKeywordToken.softKeyword("final");
@@ -174,12 +174,12 @@ public interface JetTokens {
TokenSet SOFT_KEYWORDS = TokenSet.create(IMPORT_KEYWORD, WHERE_KEYWORD, BY_KEYWORD, GET_KEYWORD,
SET_KEYWORD, ABSTRACT_KEYWORD, ENUM_KEYWORD, OPEN_KEYWORD, ANNOTATION_KEYWORD,
OVERRIDE_KEYWORD, PRIVATE_KEYWORD, PUBLIC_KEYWORD, INTERNAL_KEYWORD, PROTECTED_KEYWORD,
CATCH_KEYWORD, FINALLY_KEYWORD, OUT_KEYWORD, FINAL_KEYWORD, VARARG_KEYWORD, INLINE_KEYWORD, ERASED_KEYWORD
CATCH_KEYWORD, FINALLY_KEYWORD, OUT_KEYWORD, FINAL_KEYWORD, VARARG_KEYWORD, INLINE_KEYWORD, REIFIED_KEYWORD
);
TokenSet MODIFIER_KEYWORDS = TokenSet.create(ABSTRACT_KEYWORD, ENUM_KEYWORD,
OPEN_KEYWORD, ANNOTATION_KEYWORD, OVERRIDE_KEYWORD, PRIVATE_KEYWORD, PUBLIC_KEYWORD, INTERNAL_KEYWORD,
PROTECTED_KEYWORD, OUT_KEYWORD, IN_KEYWORD, FINAL_KEYWORD, VARARG_KEYWORD, INLINE_KEYWORD, ERASED_KEYWORD
PROTECTED_KEYWORD, OUT_KEYWORD, IN_KEYWORD, FINAL_KEYWORD, VARARG_KEYWORD, INLINE_KEYWORD, REIFIED_KEYWORD
);
TokenSet WHITE_SPACE_OR_COMMENT_BIT_SET = TokenSet.create(WHITE_SPACE, BLOCK_COMMENT, EOL_COMMENT, DOC_COMMENT, SHEBANG_COMMENT);
TokenSet WHITESPACES = TokenSet.create(TokenType.WHITE_SPACE);
@@ -553,14 +553,14 @@ public class DescriptorRenderer implements Renderer<DeclarationDescriptor> {
}
protected void renderTypeParameter(TypeParameterDescriptor descriptor, StringBuilder builder, boolean topLevel) {
if (descriptor.isReified()) {
if (!descriptor.isReified()) {
String variance = descriptor.getVariance().toString();
if (!variance.isEmpty()) {
builder.append(renderKeyword(variance)).append(" ");
}
}
else {
builder.append(renderKeyword("erased")).append(" ");
builder.append(renderKeyword("reified")).append(" ");
}
renderName(descriptor, builder);
if (descriptor.getUpperBounds().size() == 1) {
@@ -1,4 +1,4 @@
fun <erased T : Any> T?.iterator() = object {
fun <T : Any> T?.iterator() = object {
var hasNext = this@iterator != null
private set
@@ -1 +1,2 @@
fun box() = if(arrayOfNulls<Int>(10) is Array<java.lang.Integer>) "OK" else "fail"
@@ -3,7 +3,7 @@ class Box<T>(t: T) {
}
fun isIntBox(box: Box<out Any?>): Boolean {
return box is Box<Int>;
return box is Box<*>;
}
@@ -1,3 +1,3 @@
class MyList<T>
fun ff(a: Any) = a is MyList<String>
fun ff(a: Any) = a is <!CANNOT_CHECK_FOR_ERASED!>MyList<String><!>
@@ -2,7 +2,7 @@
package kt1189
import java.util.concurrent.locks.ReentrantReadWriteLock
inline fun <erased T> ReentrantReadWriteLock.write(action: ()->T) : T {
inline fun <T> ReentrantReadWriteLock.write(action: ()->T) : T {
val rl = readLock().sure()
var readCount = 0
val writeCount = getWriteHoldCount()
@@ -7,7 +7,7 @@ trait FunctionalList<T> {
val tail: FunctionalList<T>
}
fun <erased T> FunctionalList<T>.plus(element: T) : FunctionalList<T> = object: FunctionalList<T> {
fun <T> FunctionalList<T>.plus(element: T) : FunctionalList<T> = object: FunctionalList<T> {
override val size: Int
get() = 1 + this@plus.size
override val tail: FunctionalList<T>
@@ -1,4 +1,4 @@
package test
class ClassWithTypeParameter<erased P>() : java.lang.Object() {
class ClassWithTypeParameter<P>() : java.lang.Object() {
}
@@ -1,4 +1,4 @@
package test
abstract class ClassTypeTypePRefSuper<erased P>() : java.lang.Iterable<P> {
abstract class ClassTypeTypePRefSuper<P>() : java.lang.Iterable<P> {
}
@@ -1,4 +1,4 @@
package test
class ClassWithTypeParameter<erased P, erased Q : P>() : java.lang.Object() {
class ClassWithTypeParameter<P, Q : P>() : java.lang.Object() {
}
@@ -1,5 +1,5 @@
package test
trait Foo<erased Q> : java.lang.Object
trait Foo<Q> : java.lang.Object
open class ClassWithTypePRefNext<erased R : Foo<P>?, erased P>() : java.lang.Object()
open class ClassWithTypePRefNext<R : Foo<P>?, P>() : java.lang.Object()
@@ -1,4 +1,4 @@
package test
class ClassWithTypePRefSelf<erased P : java.lang.Enum<P>?>() : java.lang.Object() {
class ClassWithTypePRefSelf<P : java.lang.Enum<P>?>() : java.lang.Object() {
}
@@ -1,5 +1,5 @@
package test
open class Outer<erased P>() : java.lang.Object() {
open class Inner<erased Q : P>() : java.lang.Object()
open class Outer<P>() : java.lang.Object() {
open class Inner<Q : P>() : java.lang.Object()
}
@@ -1,8 +1,8 @@
package test
trait Trait<erased P> : java.lang.Object
trait Trait<P> : java.lang.Object
open class Outer<erased P, erased Q>() : java.lang.Object() {
open class Outer<P, Q>() : java.lang.Object() {
open class Inner() : java.lang.Object() {
}
@@ -1,7 +1,7 @@
package test
class Outer<erased P>() : java.lang.Object() {
class Outer<P>() : java.lang.Object() {
class Inner() : java.lang.Object() {
fun f<erased Q : P>() {}
fun f<Q : P>() {}
}
}
@@ -3,5 +3,5 @@ package test
trait Foo : java.lang.Object
open class MethodTypePOneUpperBound() : java.lang.Object() {
open fun <erased T : Foo?> bar() = #()
open fun <T : Foo?> bar() = #()
}
@@ -4,7 +4,7 @@ trait Foo : java.lang.Object
trait Bar : java.lang.Object
open class MethodTypePTwoUpperBounds() : java.lang.Object() {
open fun <erased T> foo(): Unit
open fun <T> foo(): Unit
where T : Foo?, T : Bar?
{}
}
@@ -1,5 +1,5 @@
package test
class MethodWithTypeP() : java.lang.Object() {
fun <erased P> f() = #()
fun <P> f() = #()
}
@@ -1,5 +1,5 @@
package test
class MethodWithTypePP() : java.lang.Object() {
fun <erased P, erased Q : P> f() = #()
fun <P, Q : P> f() = #()
}
@@ -1,5 +1,5 @@
package test
open class MethodWithTypePRefClassP<erased P>() : java.lang.Object() {
fun <erased Q : P> f() = #()
open class MethodWithTypePRefClassP<P>() : java.lang.Object() {
fun <Q : P> f() = #()
}
@@ -1,5 +1,5 @@
package test
final class MethosWithPRefTP() : java.lang.Object() {
fun <erased P> f(p0: P?) = #()
fun <P> f(p0: P?) = #()
}
@@ -2,7 +2,7 @@ package test
import java.util.ArrayList
open class JavaBeanVarOfGenericType<erased P>() : java.lang.Object() {
open class JavaBeanVarOfGenericType<P>() : java.lang.Object() {
open fun getCharacters(): ArrayList<P>? = null
open fun setCharacters(p0: ArrayList<P>?) { }
//var characters: ArrayList<P>? = null
@@ -1,5 +1,5 @@
namespace test
final class test.Wine</*0,r*/ in T : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ in T : jet.Any?><init>(): test.Wine<T>
final class test.Wine</*0*/ in T : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ in T : jet.Any?><init>(): test.Wine<T>
}
@@ -1,5 +1,5 @@
namespace test
final class test.Juice</*0,r*/ in T : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ in T : jet.Any?><init>(): test.Juice<T>
final class test.Juice</*0*/ in T : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ in T : jet.Any?><init>(): test.Juice<T>
}
@@ -1,5 +1,5 @@
namespace test
final class test.Beer</*0,r*/ T : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ T : jet.Any?><init>(): test.Beer<T>
final class test.Beer</*0*/ T : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): test.Beer<T>
}
@@ -1,5 +1,5 @@
namespace test
final class test.ClassParamReferencesParam</*0,r*/ A : jet.Any?, /*1,r*/ B : A> : jet.Any {
final /*constructor*/ fun </*0,r*/ A : jet.Any?, /*1,r*/ B : A><init>(): test.ClassParamReferencesParam<A, B>
final class test.ClassParamReferencesParam</*0*/ A : jet.Any?, /*1*/ B : A> : jet.Any {
final /*constructor*/ fun </*0*/ A : jet.Any?, /*1*/ B : A><init>(): test.ClassParamReferencesParam<A, B>
}
@@ -1,5 +1,5 @@
namespace test
final class test.ClassParamReferencesParam</*0,r*/ A : jet.Any?, /*1,r*/ in B : A> : jet.Any {
final /*constructor*/ fun </*0,r*/ A : jet.Any?, /*1,r*/ in B : A><init>(): test.ClassParamReferencesParam<A, B>
final class test.ClassParamReferencesParam</*0*/ A : jet.Any?, /*1*/ in B : A> : jet.Any {
final /*constructor*/ fun </*0*/ A : jet.Any?, /*1*/ in B : A><init>(): test.ClassParamReferencesParam<A, B>
}
@@ -1,7 +1,7 @@
namespace test
final class test.ClassParamReferencesSelf</*0,r*/ A : test.TraitWithP<A>> : jet.Any {
final /*constructor*/ fun </*0,r*/ A : test.TraitWithP<A>><init>(): test.ClassParamReferencesSelf<A>
final class test.ClassParamReferencesSelf</*0*/ A : test.TraitWithP<A>> : jet.Any {
final /*constructor*/ fun </*0*/ A : test.TraitWithP<A>><init>(): test.ClassParamReferencesSelf<A>
}
abstract trait test.TraitWithP</*0,r*/ P : jet.Any?> : jet.Any {
abstract trait test.TraitWithP</*0*/ P : jet.Any?> : jet.Any {
}
@@ -1,5 +1,5 @@
namespace test
final class test.Clock</*0,r*/ A : java.lang.Number> : jet.Any {
final /*constructor*/ fun </*0,r*/ A : java.lang.Number><init>(): test.Clock<A>
final class test.Clock</*0*/ A : java.lang.Number> : jet.Any {
final /*constructor*/ fun </*0*/ A : java.lang.Number><init>(): test.Clock<A>
}
@@ -1,5 +1,5 @@
namespace test
final class test.Clock</*0,r*/ A : java.io.Serializable & java.lang.Number> : jet.Any {
final /*constructor*/ fun </*0,r*/ A : java.io.Serializable & java.lang.Number><init>(): test.Clock<A>
final class test.Clock</*0*/ A : java.io.Serializable & java.lang.Number> : jet.Any {
final /*constructor*/ fun </*0*/ A : java.io.Serializable & java.lang.Number><init>(): test.Clock<A>
}
@@ -1,5 +1,5 @@
namespace test
final class test.Clock</*0,r*/ A : java.io.Serializable> : jet.Any {
final /*constructor*/ fun </*0,r*/ A : java.io.Serializable><init>(): test.Clock<A>
final class test.Clock</*0*/ A : java.io.Serializable> : jet.Any {
final /*constructor*/ fun </*0*/ A : java.io.Serializable><init>(): test.Clock<A>
}
@@ -1,5 +1,5 @@
namespace test
final class test.Clock</*0,r*/ A : java.io.Serializable & java.lang.Number> : jet.Any {
final /*constructor*/ fun </*0,r*/ A : java.io.Serializable & java.lang.Number><init>(): test.Clock<A>
final class test.Clock</*0*/ A : java.io.Serializable & java.lang.Number> : jet.Any {
final /*constructor*/ fun </*0*/ A : java.io.Serializable & java.lang.Number><init>(): test.Clock<A>
}
@@ -1,5 +1,5 @@
namespace test
final class test.ClassTwoParams</*0,r*/ P : jet.Any?, /*1,r*/ Q : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ P : jet.Any?, /*1,r*/ Q : jet.Any?><init>(): test.ClassTwoParams<P, Q>
final class test.ClassTwoParams</*0*/ P : jet.Any?, /*1*/ Q : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ P : jet.Any?, /*1*/ Q : jet.Any?><init>(): test.ClassTwoParams<P, Q>
}
@@ -1,5 +1,5 @@
namespace test
final class test.ClassTwoParams</*0,r*/ out P : jet.Any?, /*1,r*/ Q : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ out P : jet.Any?, /*1,r*/ Q : jet.Any?><init>(): test.ClassTwoParams<P, Q>
final class test.ClassTwoParams</*0*/ out P : jet.Any?, /*1*/ Q : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ out P : jet.Any?, /*1*/ Q : jet.Any?><init>(): test.ClassTwoParams<P, Q>
}
@@ -1,7 +1,7 @@
namespace test
abstract class test.Aaa</*0,r*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ P : jet.Any?><init>(): test.Aaa<P>
abstract class test.Aaa</*0*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ P : jet.Any?><init>(): test.Aaa<P>
}
final class test.Bbb : test.Aaa<java.util.Random> {
final /*constructor*/ fun <init>(): test.Bbb
@@ -1,6 +1,6 @@
namespace test
abstract trait test.Aaa</*0,r*/ P : jet.Any?> : jet.Any {
abstract trait test.Aaa</*0*/ P : jet.Any?> : jet.Any {
}
final class test.Bbb : test.Aaa<java.util.Random> {
final /*constructor*/ fun <init>(): test.Bbb
@@ -1,6 +1,6 @@
namespace test
final class test.ClassParamUsedInFun</*0,r*/ in T : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ in T : jet.Any?><init>(): test.ClassParamUsedInFun<T>
final class test.ClassParamUsedInFun</*0*/ in T : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ in T : jet.Any?><init>(): test.ClassParamUsedInFun<T>
final fun f(/*0*/ t: T): jet.Int
}
@@ -1,6 +1,6 @@
namespace test
final class test.ClassParamUsedInFun</*0,r*/ T : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ T : jet.Any?><init>(): test.ClassParamUsedInFun<T>
final class test.ClassParamUsedInFun</*0*/ T : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): test.ClassParamUsedInFun<T>
final fun f(/*0*/ t: T): jet.Int
}
@@ -1,7 +1,7 @@
namespace test
open class test.Base</*0,r*/ T : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ T : jet.Any?><init>(): test.Base<T>
open class test.Base</*0*/ T : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): test.Base<T>
final fun foo(): T
}
final class test.Inh : test.Base<jet.String> {
@@ -1,6 +1,6 @@
namespace test
abstract trait test.Bbb</*0,r*/ P : jet.Any?> : jet.Any {
abstract trait test.Bbb</*0*/ P : jet.Any?> : jet.Any {
}
final class test.ClassObjectExtendsTraitWithTP : jet.Any {
final /*constructor*/ fun <init>(): test.ClassObjectExtendsTraitWithTP
@@ -1,5 +1,5 @@
namespace test
final class test.ClassWithConstructorAndTypeParameter</*0,r*/ P : jet.Any?, /*1,r*/ Q : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ P : jet.Any?, /*1,r*/ Q : jet.Any?><init>(): test.ClassWithConstructorAndTypeParameter<P, Q>
final class test.ClassWithConstructorAndTypeParameter</*0*/ P : jet.Any?, /*1*/ Q : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ P : jet.Any?, /*1*/ Q : jet.Any?><init>(): test.ClassWithConstructorAndTypeParameter<P, Q>
}
@@ -1,5 +1,5 @@
namespace test
final class test.ClassWithConstructorAndTypeParameter</*0,r*/ P : jet.Any?, /*1,r*/ Q : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ P : jet.Any?, /*1,r*/ Q : jet.Any?><init>(/*0*/ q: jet.Int): test.ClassWithConstructorAndTypeParameter<P, Q>
final class test.ClassWithConstructorAndTypeParameter</*0*/ P : jet.Any?, /*1*/ Q : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ P : jet.Any?, /*1*/ Q : jet.Any?><init>(/*0*/ q: jet.Int): test.ClassWithConstructorAndTypeParameter<P, Q>
}
@@ -1,5 +1,5 @@
namespace test
final class test.ClassWithConstructorAndTypeParameter</*0,r*/ P : jet.Any?, /*1,r*/ Q : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ P : jet.Any?, /*1,r*/ Q : jet.Any?><init>(/*0*/ q: Q): test.ClassWithConstructorAndTypeParameter<P, Q>
final class test.ClassWithConstructorAndTypeParameter</*0*/ P : jet.Any?, /*1*/ Q : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ P : jet.Any?, /*1*/ Q : jet.Any?><init>(/*0*/ q: Q): test.ClassWithConstructorAndTypeParameter<P, Q>
}
@@ -1,5 +1,5 @@
namespace test
final class test.ClassWithConstructorAndTypeParameter</*0,r*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ P : jet.Any?><init>(): test.ClassWithConstructorAndTypeParameter<P>
final class test.ClassWithConstructorAndTypeParameter</*0*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ P : jet.Any?><init>(): test.ClassWithConstructorAndTypeParameter<P>
}
@@ -1,3 +1,3 @@
package test
class OneTypeParameterErased<P, erased Q>(q: Q)
class OneTypeParameterErased<P, Q>(q: Q)
@@ -1,5 +1,5 @@
namespace test
final class test.OneTypeParameterErased</*0,r*/ P : jet.Any?, /*1*/ Q : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ P : jet.Any?, /*1*/ Q : jet.Any?><init>(/*0*/ q: Q): test.OneTypeParameterErased<P, Q>
final class test.OneTypeParameterErased</*0*/ P : jet.Any?, /*1*/ Q : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ P : jet.Any?, /*1*/ Q : jet.Any?><init>(/*0*/ q: Q): test.OneTypeParameterErased<P, Q>
}
@@ -1,3 +1,3 @@
namespace test
final fun </*0,r*/ T : jet.Any?>f(): jet.Int
final fun </*0*/ T : jet.Any?>f(): jet.Int
@@ -1,3 +1,3 @@
namespace test
final fun </*0,r*/ in T : jet.Any?>f(): jet.Int
final fun </*0*/ in T : jet.Any?>f(): jet.Int
@@ -1,3 +1,3 @@
namespace test
final fun </*0,r*/ out T : jet.Any?>f(): jet.Int
final fun </*0*/ out T : jet.Any?>f(): jet.Int
@@ -1,3 +1,3 @@
namespace test
final fun </*0,r*/ P : jet.Any?>funParamParam(/*0*/ a: jet.Int, /*1*/ b: P): jet.Int
final fun </*0*/ P : jet.Any?>funParamParam(/*0*/ a: jet.Int, /*1*/ b: P): jet.Int
@@ -1,3 +1,3 @@
package test
fun <erased P> funParamParam(a: Int, b: P) = 1
fun <P> funParamParam(a: Int, b: P) = 1
@@ -1,3 +1,3 @@
namespace test
final fun </*0,r*/ P : jet.Any?, /*1,r*/ Q : P>funParamReferencesParam(): jet.Int
final fun </*0*/ P : jet.Any?, /*1*/ Q : P>funParamReferencesParam(): jet.Int
@@ -1,3 +1,3 @@
namespace test
final fun </*0,r*/ in P : jet.Any?, /*1,r*/ Q : P>funParamReferencesParam(): jet.Int
final fun </*0*/ in P : jet.Any?, /*1*/ Q : P>funParamReferencesParam(): jet.Int
@@ -4,4 +4,4 @@ abstract trait test.Bar : jet.Any {
}
abstract trait test.Foo : jet.Any {
}
final fun </*0,r*/ T : test.Bar & test.Foo>foo(): jet.Tuple0
final fun </*0*/ T : test.Bar & test.Foo>foo(): jet.Tuple0
@@ -1,3 +1,3 @@
namespace test
final fun </*0,r*/ A : java.lang.Number>uno(): jet.Int
final fun </*0*/ A : java.lang.Number>uno(): jet.Int
@@ -1,3 +1,3 @@
namespace test
final fun </*0,r*/ A : java.io.Serializable & java.lang.Number>tres(): jet.Int
final fun </*0*/ A : java.io.Serializable & java.lang.Number>tres(): jet.Int
@@ -1,3 +1,3 @@
namespace test
final fun </*0,r*/ A : java.io.Serializable>dos(): jet.Int
final fun </*0*/ A : java.io.Serializable>dos(): jet.Int
@@ -1,3 +1,3 @@
namespace test
final fun </*0,r*/ A : java.io.Serializable & java.lang.Number>cuatro(): jet.Int
final fun </*0*/ A : java.io.Serializable & java.lang.Number>cuatro(): jet.Int
@@ -1,3 +1,3 @@
namespace test
final fun </*0,r*/ P : jet.Any?>funParamVarargParam(/*0*/ a: jet.Int, /*1*/ vararg b: P /*jet.Array<P>*/): jet.Int
final fun </*0*/ P : jet.Any?>funParamVarargParam(/*0*/ a: jet.Int, /*1*/ vararg b: P /*jet.Array<P>*/): jet.Int
@@ -1,3 +1,3 @@
namespace test
final fun </*0,r*/ P : jet.Any?, /*1,r*/ Q : jet.Any?>funTwoTypeParams(): jet.Int
final fun </*0*/ P : jet.Any?, /*1*/ Q : jet.Any?>funTwoTypeParams(): jet.Int
@@ -1,3 +1,3 @@
namespace test
final fun </*0,r*/ P : jet.Any?, /*1,r*/ in Q : jet.Any?>funTwoTypeParams(): jet.Int
final fun </*0*/ P : jet.Any?, /*1*/ in Q : jet.Any?>funTwoTypeParams(): jet.Int
@@ -1,3 +1,3 @@
namespace test
final val </*0,r*/ P : jet.Any?> P.anotherJavaClass: java.lang.Class<P>
final val </*0*/ P : jet.Any?> P.anotherJavaClass: java.lang.Class<P>
@@ -1,6 +1,6 @@
namespace test
final class test.ExtValInClass</*0,r*/ T : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ T : jet.Any?><init>(): test.ExtValInClass<T>
final class test.ExtValInClass</*0*/ T : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ T : jet.Any?><init>(): test.ExtValInClass<T>
final val jet.Int.asas: T
}
@@ -1,6 +1,6 @@
namespace test
final class test.ExtValInClass</*0,r*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ P : jet.Any?><init>(): test.ExtValInClass<P>
final class test.ExtValInClass</*0*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ P : jet.Any?><init>(): test.ExtValInClass<P>
final val jet.Int.asas: P?
}
@@ -1,6 +1,6 @@
namespace test
final class test.ExtValPIntInClass</*0,r*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ P : jet.Any?><init>(): test.ExtValPIntInClass<P>
final class test.ExtValPIntInClass</*0*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ P : jet.Any?><init>(): test.ExtValPIntInClass<P>
final val P.asas: jet.Int
}
@@ -1,3 +1,3 @@
namespace test
final var </*0,r*/ P : jet.Any?> P.anotherJavaClass: java.lang.Class<P>
final var </*0*/ P : jet.Any?> P.anotherJavaClass: java.lang.Class<P>
@@ -1,6 +1,6 @@
namespace test
final class test.ExtValInClass</*0,r*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ P : jet.Any?><init>(): test.ExtValInClass<P>
final class test.ExtValInClass</*0*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ P : jet.Any?><init>(): test.ExtValInClass<P>
final var jet.Int.asas: P
}
@@ -1,6 +1,6 @@
namespace test
final class test.ExtValInClass</*0,r*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ P : jet.Any?><init>(): test.ExtValInClass<P>
final class test.ExtValInClass</*0*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ P : jet.Any?><init>(): test.ExtValInClass<P>
final var jet.Int.asas: P?
}
@@ -1,3 +1,3 @@
namespace test
final var </*0,r*/ P : jet.Any?, /*1,r*/ Q : jet.Any?> java.util.Map<P, Q>.asas: jet.Int
final var </*0*/ P : jet.Any?, /*1*/ Q : jet.Any?> java.util.Map<P, Q>.asas: jet.Int
@@ -1,6 +1,6 @@
namespace test
final class test.ExtValPIntInClass</*0,r*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ P : jet.Any?><init>(): test.ExtValPIntInClass<P>
final class test.ExtValPIntInClass</*0*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ P : jet.Any?><init>(): test.ExtValPIntInClass<P>
final var P.asas: jet.Int
}
@@ -1,6 +1,6 @@
namespace test
final class test.ExtValPIntInClass</*0,r*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0,r*/ P : jet.Any?><init>(): test.ExtValPIntInClass<P>
final class test.ExtValPIntInClass</*0*/ P : jet.Any?> : jet.Any {
final /*constructor*/ fun </*0*/ P : jet.Any?><init>(): test.ExtValPIntInClass<P>
final var P?.asas: jet.Int
}
@@ -3,6 +3,6 @@ fun <P> foo(vararg tail: P) = 1
// method: namespace::foo
// jvm signature: ([Ljava/lang/Object;)I
// generic signature: <P:Ljava/lang/Object;>([TP;)I
// kotlin signature: <P:?Ljava/lang/Object;>([TP;)I
// kotlin signature: <erased P:?Ljava/lang/Object;>([TP;)I
// TODO: skip kotlin signature
// TODO: properly serialize typeinfo
+1 -1
View File
@@ -1,5 +1,5 @@
package java.lang
public trait Iterable<erased T> {
public trait Iterable<T> {
fun iterator() : java.util.Iterator<T>
}
@@ -1,11 +1,11 @@
package java.util
public abstract class AbstractCollection<erased E> protected () : java.lang.Object(), java.util.Collection<E> {
public abstract class AbstractCollection<E> protected () : java.lang.Object(), java.util.Collection<E> {
public abstract override fun iterator() : java.util.Iterator<E>
public abstract override fun size() : Int
public override fun isEmpty() : Boolean {}
public override fun contains(o : Any?) : Boolean {}
public override fun toArray() : Array<Any?> {}
public override fun toArray<erased T>(a : Array<out T>) : Array<T> {}
public override fun toArray<T>(a : Array<out T>) : Array<T> {}
public override fun add(e : E) : Boolean {}
public override fun remove(o : Any?) : Boolean {}
public override fun containsAll(c : java.util.Collection<*>) : Boolean {}
+1 -1
View File
@@ -1,5 +1,5 @@
package java.util
public abstract class AbstractList<erased E> protected () : java.util.AbstractCollection<E>(), java.util.List<E> {
public abstract class AbstractList<E> protected () : java.util.AbstractCollection<E>(), java.util.List<E> {
public override fun add(e : E) : Boolean {}
public abstract override fun get(index : Int) : E
public override fun set(index : Int, element : E) : E {}
+1 -1
View File
@@ -2,7 +2,7 @@ package java.util
import java.util.Map.Entry
public abstract class AbstractMap<erased K, erased V> protected () : java.lang.Object(), java.util.Map<K, V> {
public abstract class AbstractMap<K, V> protected () : java.lang.Object(), java.util.Map<K, V> {
public override fun size() : Int {}
public override fun isEmpty() : Boolean {}
public override fun containsValue(value : Any?) : Boolean {}
@@ -1,5 +1,5 @@
package java.util
public abstract class AbstractSequentialList<erased E> protected () : java.util.AbstractList<E>() {
public abstract class AbstractSequentialList<E> protected () : java.util.AbstractList<E>() {
public override fun get(index : Int) : E {}
public override fun set(index : Int, element : E) : E {}
public override fun add(index : Int, element : E) : Unit {}
+1 -1
View File
@@ -1,5 +1,5 @@
package java.util
public abstract class AbstractSet<erased E> protected () : java.util.AbstractCollection<E>(), java.util.Set<E> {
public abstract class AbstractSet<E> protected () : java.util.AbstractCollection<E>(), java.util.Set<E> {
// public override fun equals(o : Any?) : Boolean
// public override fun hashCode() : Int
public override fun removeAll(c : java.util.Collection<*>) : Boolean {}
+2 -2
View File
@@ -1,5 +1,5 @@
package java.util
public open class ArrayList<erased E>(c : java.util.Collection<out E>) : java.util.AbstractList<E>(),
public open class ArrayList<E>(c : java.util.Collection<out E>) : java.util.AbstractList<E>(),
java.util.List<E>,
java.util.RandomAccess,
java.lang.Cloneable,
@@ -15,7 +15,7 @@ public open class ArrayList<erased E>(c : java.util.Collection<out E>) : java.ut
public override fun lastIndexOf(o : Any?) : Int {}
public override fun clone() : java.lang.Object {}
public override fun toArray() : Array<Any?> {}
public override fun toArray<erased T>(a : Array<out T>) : Array<T> {}
public override fun toArray<T>(a : Array<out T>) : Array<T> {}
public override fun get(index : Int) : E {}
public override fun set(index : Int, element : E) : E {}
public override fun add(e : E) : Boolean {}
+2 -2
View File
@@ -1,12 +1,12 @@
package java.util
public trait Collection<erased E> : java.lang.Iterable<E> {
public trait Collection<E> : java.lang.Iterable<E> {
open fun size() : Int
open fun isEmpty() : Boolean
open fun contains(o : Any?) : Boolean
override fun iterator() : java.util.Iterator<E>
open fun toArray() : Array<Any?>
// a : Array<out T> to emulate Java's array covariance
open fun toArray<erased T>(a : Array<out T>) : Array<T>
open fun toArray<T>(a : Array<out T>) : Array<T>
open fun add(e : E) : Boolean
open fun remove(o : Any?) : Boolean
open fun containsAll(c : java.util.Collection<*>) : Boolean
+1 -1
View File
@@ -1,5 +1,5 @@
package java.util
public trait Deque<erased E> : java.util.Queue<E> {
public trait Deque<E> : java.util.Queue<E> {
open fun addFirst(e : E) : Unit
open fun addLast(e : E) : Unit
open fun offerFirst(e : E) : Boolean
+1 -1
View File
@@ -1,5 +1,5 @@
package java.util
public trait Enumeration<erased E> {
public trait Enumeration<E> {
open fun hasMoreElements() : Boolean
open fun nextElement() : E
}
+1 -1
View File
@@ -1,7 +1,7 @@
package java.util
import java.io.*
import java.util.Map.Entry
public open class HashMap<erased K, erased V>(m : java.util.Map<out K, out V>) : java.util.AbstractMap<K, V>(),
public open class HashMap<K, V>(m : java.util.Map<out K, out V>) : java.util.AbstractMap<K, V>(),
java.util.Map<K, V>,
java.lang.Cloneable,
java.io.Serializable {
+1 -1
View File
@@ -1,5 +1,5 @@
package java.util
public open class HashSet<erased E>(c : java.util.Collection<out E>) : java.util.AbstractSet<E>(),
public open class HashSet<E>(c : java.util.Collection<out E>) : java.util.AbstractSet<E>(),
java.util.Set<E>,
java.lang.Cloneable,
java.io.Serializable {
+1 -1
View File
@@ -1,6 +1,6 @@
package java.util
public trait Iterator<erased E> {
public trait Iterator<E> {
fun hasNext() : Boolean
fun next() : E
fun remove() : Unit
+1 -1
View File
@@ -2,7 +2,7 @@ package java.util
import java.util.Map.Entry
public open class LinkedHashMap<erased K, erased V>(m : java.util.Map<out K, out V>) : java.util.HashMap<K, V>(), java.util.Map<K, V> {
public open class LinkedHashMap<K, V>(m : java.util.Map<out K, out V>) : java.util.HashMap<K, V>(), java.util.Map<K, V> {
public this(initialCapacity : Int, loadFactor : Float) {}
public this(initialCapacity : Int) {}
public this() {}
+1 -1
View File
@@ -1,5 +1,5 @@
package java.util
public open class LinkedHashSet<erased E>(c : java.util.Collection<out E>) : java.util.HashSet<E>(c),
public open class LinkedHashSet<E>(c : java.util.Collection<out E>) : java.util.HashSet<E>(c),
java.util.Set<E>,
java.lang.Cloneable,
java.io.Serializable {
+2 -2
View File
@@ -1,5 +1,5 @@
package java.util
public open class LinkedList<erased E>(c : java.util.Collection<out E>) : java.util.AbstractSequentialList<E>(),
public open class LinkedList<E>(c : java.util.Collection<out E>) : java.util.AbstractSequentialList<E>(),
java.util.List<E>,
java.util.Deque<E>,
java.lang.Cloneable,
@@ -44,7 +44,7 @@ public open class LinkedList<erased E>(c : java.util.Collection<out E>) : java.u
public override fun descendingIterator() : java.util.Iterator<E> {}
public override fun clone() : Any? {}
public override fun toArray() : Array<Any?> {}
public override fun toArray<erased T>(a : Array<out T>) : Array<T> {}
public override fun toArray<T>(a : Array<out T>) : Array<T> {}
//class object {
//open public fun init<E>(c : java.util.Collection<out E?>?) : LinkedList<E> {
//return __
+2 -2
View File
@@ -1,12 +1,12 @@
package java.util
public trait List<erased E> : java.util.Collection<E> {
public trait List<E> : java.util.Collection<E> {
override fun size() : Int
override fun isEmpty() : Boolean
override fun contains(o : Any?) : Boolean
override fun iterator() : java.util.Iterator<E>
override fun toArray() : Array<Any?>
// Simulate Java's array covariance
override fun toArray<erased T>(a : Array<out T>) : Array<T>
override fun toArray<T>(a : Array<out T>) : Array<T>
override fun add(e : E) : Boolean
override fun remove(o : Any?) : Boolean
override fun containsAll(c : java.util.Collection<*>) : Boolean
+1 -1
View File
@@ -1,6 +1,6 @@
package java.util
public trait Map<erased K, erased V> {
public trait Map<K, V> {
open fun size() : Int
open fun isEmpty() : Boolean
open fun containsKey(key : Any?) : Boolean
+1 -1
View File
@@ -1,5 +1,5 @@
package java.util
public trait Queue<erased E> : java.util.Collection<E> {
public trait Queue<E> : java.util.Collection<E> {
override fun add(e : E) : Boolean
open fun offer(e : E) : Boolean
open fun remove() : E
+2 -2
View File
@@ -1,5 +1,5 @@
package java.util
public trait Set<erased E> : java.util.Collection<E> {
public trait Set<E> : java.util.Collection<E> {
override fun size() : Int
override fun isEmpty() : Boolean
override fun contains(o : Any?) : Boolean
@@ -7,7 +7,7 @@ public trait Set<erased E> : java.util.Collection<E> {
override fun toArray() : Array<Any?>
// Simulate Java's array covariance
override fun toArray<erased T>(a : Array<out T>) : Array<T>
override fun toArray<T>(a : Array<out T>) : Array<T>
override fun add(e : E) : Boolean
override fun remove(o : Any?) : Boolean
override fun containsAll(c : java.util.Collection<*>) : Boolean
+15 -15
View File
@@ -29,7 +29,7 @@ val Collections = object {
}
library
public open class ArrayList<erased E>() : java.util.List<E> {
public open class ArrayList<E>() : java.util.List<E> {
public override fun size() : Int = js.noImpl
public override fun isEmpty() : Boolean = js.noImpl
public override fun contains(o : Any?) : Boolean = js.noImpl
@@ -37,7 +37,7 @@ public open class ArrayList<erased E>() : java.util.List<E> {
// public override fun indexOf(o : Any?) : Int = js.noImpl
// public override fun lastIndexOf(o : Any?) : Int = js.noImpl
// public override fun toArray() : Array<Any?> = js.noImpl
// public override fun toArray<erased T>(a : Array<out T>) : Array<T> = js.noImpl
// public override fun toArray<T>(a : Array<out T>) : Array<T> = js.noImpl
public override fun get(index : Int) : E = js.noImpl
public override fun set(index : Int, element : E) : E = js.noImpl
public override fun add(e : E) : Boolean = js.noImpl
@@ -51,13 +51,13 @@ public open class ArrayList<erased E>() : java.util.List<E> {
}
library
public trait Collection<erased E> : java.lang.Iterable<E> {
public trait Collection<E> : java.lang.Iterable<E> {
open fun size() : Int
open fun isEmpty() : Boolean
open fun contains(o : Any?) : Boolean
override fun iterator() : java.util.Iterator<E>
// open fun toArray() : Array<Any?>
// open fun toArray<erased T>(a : Array<out T>) : Array<T>
// open fun toArray<T>(a : Array<out T>) : Array<T>
open fun add(e : E) : Boolean
open fun remove(o : Any?) : Boolean
//open fun containsAll(c : java.util.Collection<*>) : Boolean
@@ -68,18 +68,18 @@ public trait Collection<erased E> : java.lang.Iterable<E> {
}
library
public abstract open class AbstractCollection<erased E>() : Collection<E> {
public abstract open class AbstractCollection<E>() : Collection<E> {
}
library
public abstract open class AbstractList<erased E>() : AbstractCollection<E>(), List<E> {
public abstract open class AbstractList<E>() : AbstractCollection<E>(), List<E> {
public override fun isEmpty() : Boolean = js.noImpl
public override fun contains(o : Any?) : Boolean = js.noImpl
public override fun iterator() : Iterator<E> = js.noImpl
// public override fun indexOf(o : Any?) : Int = js.noImpl
// public override fun lastIndexOf(o : Any?) : Int = js.noImpl
// public override fun toArray() : Array<Any?> = js.noImpl
// public override fun toArray<erased T>(a : Array<out T>) : Array<T> = js.noImpl
// public override fun toArray<T>(a : Array<out T>) : Array<T> = js.noImpl
public override fun set(index : Int, element : E) : E = js.noImpl
public override fun add(e : E) : Boolean = js.noImpl
public override fun add(index : Int, element : E) : Unit = js.noImpl
@@ -92,14 +92,14 @@ public abstract open class AbstractList<erased E>() : AbstractCollection<E>(), L
}
library
public trait List<erased E> : Collection<E> {
public trait List<E> : Collection<E> {
override fun size() : Int
override fun isEmpty() : Boolean
override fun contains(o : Any?) : Boolean
override fun iterator() : java.util.Iterator<E>
// override fun toArray() : Array<Any?>
// Simulate Java's array covariance
// override fun toArray<erased T>(a : Array<out T>) : Array<T>
// override fun toArray<T>(a : Array<out T>) : Array<T>
override fun add(e : E) : Boolean
override fun remove(o : Any?) : Boolean
// override fun containsAll(c : java.util.Collection<*>) : Boolean
@@ -117,13 +117,13 @@ public trait List<erased E> : Collection<E> {
}
library
public trait Set<erased E> : Collection<E> {
public trait Set<E> : Collection<E> {
override fun size() : Int
override fun isEmpty() : Boolean
override fun contains(o : Any?) : Boolean
override fun iterator() : java.util.Iterator<E>
// override fun toArray() : Array<Any?>
// override fun toArray<erased T>(a : Array<out T>) : Array<T>
// override fun toArray<T>(a : Array<out T>) : Array<T>
override fun add(e : E) : Boolean
override fun remove(o : Any?) : Boolean
//override fun containsAll(c : java.util.Collection<*>) : Boolean
@@ -134,7 +134,7 @@ public trait Set<erased E> : Collection<E> {
}
library
public open class HashSet<erased E>() : java.util.Set<E> {
public open class HashSet<E>() : java.util.Set<E> {
public override fun iterator() : java.util.Iterator<E> = js.noImpl
public override fun size() : Int = js.noImpl
public override fun isEmpty() : Boolean = js.noImpl
@@ -146,7 +146,7 @@ public open class HashSet<erased E>() : java.util.Set<E> {
}
library
public trait Map<erased K, erased V> {
public trait Map<K, V> {
open fun size() : Int
open fun isEmpty() : Boolean
open fun containsKey(key : Any?) : Boolean
@@ -161,7 +161,7 @@ public trait Map<erased K, erased V> {
}
library
public open class HashMap<erased K, erased V>() : java.util.Map<K, V> {
public open class HashMap<K, V>() : java.util.Map<K, V> {
public override fun size() : Int = js.noImpl
public override fun isEmpty() : Boolean = js.noImpl
public override fun get(key : Any?) : V = js.noImpl
@@ -176,7 +176,7 @@ public open class HashMap<erased K, erased V>() : java.util.Map<K, V> {
}
library
public open class LinkedList<erased E>() : List<E> {
public open class LinkedList<E>() : List<E> {
public override fun iterator() : java.util.Iterator<E> = js.noImpl
public override fun isEmpty() : Boolean = js.noImpl
public override fun contains(o : Any?) : Boolean = js.noImpl
+1 -1
View File
@@ -24,7 +24,7 @@ public inline fun <T> java.util.Iterator<T>.iterator() : java.util.Iterator<T> =
/**
Helper to make java.util.Enumeration usable in for
*/
public fun <erased T> java.util.Enumeration<T>.iterator(): Iterator<T> = object: Iterator<T> {
public fun <T> java.util.Enumeration<T>.iterator(): Iterator<T> = object: Iterator<T> {
override val hasNext: Boolean
get() = hasMoreElements()
@@ -9,7 +9,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock
Executes given calculation under lock
Returns result of the calculation
*/
public inline fun <erased T> Lock.withLock(action: ()->T) : T {
public inline fun <T> Lock.withLock(action: ()->T) : T {
lock()
try {
return action()
@@ -23,7 +23,7 @@ public inline fun <erased T> Lock.withLock(action: ()->T) : T {
Executes given calculation under read lock
Returns result of the calculation
*/
public inline fun <erased T> ReentrantReadWriteLock.read(action: ()->T) : T {
public inline fun <T> ReentrantReadWriteLock.read(action: ()->T) : T {
val rl = readLock().sure()
rl.lock()
try {
@@ -40,7 +40,7 @@ The method does upgrade from read to write lock if needed
If such write has been initiated by checking some condition, the condition must be rechecked inside the action to avoid possible races
Returns result of the calculation
*/
public inline fun <erased T> ReentrantReadWriteLock.write(action: ()->T) : T {
public inline fun <T> ReentrantReadWriteLock.write(action: ()->T) : T {
val rl = readLock().sure()
val readCount = if (getWriteHoldCount() == 0) getReadHoldCount() else 0