KT-6698 Bad class file when using a star-projection on a Java's recursive generic parameter
#KT-6698 Fixed
This commit is contained in:
@@ -146,6 +146,12 @@ public class BothSignatureWriter {
|
||||
generic = true;
|
||||
}
|
||||
|
||||
public void writeUnboundedWildcard() {
|
||||
signatureVisitor().visitTypeArgument();
|
||||
|
||||
generic = true;
|
||||
}
|
||||
|
||||
public void writeTypeArgumentEnd() {
|
||||
pop();
|
||||
}
|
||||
|
||||
@@ -396,17 +396,22 @@ public class JetTypeMapper {
|
||||
for (TypeParameterDescriptor parameter : jetType.getConstructor().getParameters()) {
|
||||
TypeProjection argument = arguments.get(parameter.getIndex());
|
||||
|
||||
Variance projectionKind = projectionsAllowed
|
||||
? getEffectiveVariance(
|
||||
parameter.getVariance(),
|
||||
argument.getProjectionKind(),
|
||||
howThisTypeIsUsed
|
||||
)
|
||||
: Variance.INVARIANT;
|
||||
signatureVisitor.writeTypeArgument(projectionKind);
|
||||
if (projectionsAllowed && argument.isStarProjection()) {
|
||||
signatureVisitor.writeUnboundedWildcard();
|
||||
}
|
||||
else {
|
||||
Variance projectionKind = projectionsAllowed
|
||||
? getEffectiveVariance(
|
||||
parameter.getVariance(),
|
||||
argument.getProjectionKind(),
|
||||
howThisTypeIsUsed
|
||||
)
|
||||
: Variance.INVARIANT;
|
||||
signatureVisitor.writeTypeArgument(projectionKind);
|
||||
|
||||
mapType(argument.getType(), signatureVisitor, JetTypeMapperMode.TYPE_PARAMETER);
|
||||
signatureVisitor.writeTypeArgumentEnd();
|
||||
mapType(argument.getType(), signatureVisitor, JetTypeMapperMode.TYPE_PARAMETER);
|
||||
signatureVisitor.writeTypeArgumentEnd();
|
||||
}
|
||||
}
|
||||
signatureVisitor.writeClassEnd();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package test;
|
||||
|
||||
public class StarProjection {
|
||||
void foo(K<?> k) {
|
||||
k.foo(null);
|
||||
TestPackage.bar(null);
|
||||
new Sub().foo(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package test
|
||||
|
||||
open class K<out T: K<T>> {
|
||||
fun foo(k: K<*>) {}
|
||||
fun foo(): K<*> = null!!
|
||||
}
|
||||
|
||||
class Sub: K<K<*>>()
|
||||
|
||||
fun bar(k: K<*>) {}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,7 +24,7 @@ internal trait D</*0*/ T> {
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal trait Test : A<in kotlin.Int>, B<out kotlin.Int>, C<out kotlin.Any?>?, D<kotlin.Int> {
|
||||
internal trait Test : A<in kotlin.Int>, B<out kotlin.Int>, C<*>?, D<kotlin.Int> {
|
||||
public open override /*4*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*4*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*4*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
@@ -4,7 +4,7 @@ internal trait MyTrait : java.lang.Object {
|
||||
protected/*protected and package*/ open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any!
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any!): kotlin.Boolean
|
||||
public abstract override /*1*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun getClass(): java.lang.Class<out kotlin.Any?>!
|
||||
public final override /*1*/ /*fake_override*/ fun getClass(): java.lang.Class<*>!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun notify(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun notifyAll(): kotlin.Unit
|
||||
|
||||
+8
-8
@@ -57,8 +57,8 @@ package test {
|
||||
}
|
||||
|
||||
internal final annotation class Ann6 : kotlin.Annotation {
|
||||
public constructor Ann6(/*0*/ p: java.lang.Class<out kotlin.Any?>)
|
||||
internal final val p: java.lang.Class<out kotlin.Any?>
|
||||
public constructor Ann6(/*0*/ p: java.lang.Class<*>)
|
||||
internal final val p: java.lang.Class<*>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
@@ -73,9 +73,9 @@ package test {
|
||||
}
|
||||
|
||||
internal final annotation class Ann8 : kotlin.Annotation {
|
||||
public constructor Ann8(/*0*/ p1: kotlin.Array<kotlin.String>, /*1*/ p2: kotlin.Array<java.lang.Class<out kotlin.Any?>>, /*2*/ p3: kotlin.Array<test.MyEnum>, /*3*/ p4: kotlin.Array<test.Ann1>)
|
||||
public constructor Ann8(/*0*/ p1: kotlin.Array<kotlin.String>, /*1*/ p2: kotlin.Array<java.lang.Class<*>>, /*2*/ p3: kotlin.Array<test.MyEnum>, /*3*/ p4: kotlin.Array<test.Ann1>)
|
||||
internal final val p1: kotlin.Array<kotlin.String>
|
||||
internal final val p2: kotlin.Array<java.lang.Class<out kotlin.Any?>>
|
||||
internal final val p2: kotlin.Array<java.lang.Class<*>>
|
||||
internal final val p3: kotlin.Array<test.MyEnum>
|
||||
internal final val p4: kotlin.Array<test.Ann1>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@@ -84,9 +84,9 @@ package test {
|
||||
}
|
||||
|
||||
internal final annotation class Ann9 : kotlin.Annotation {
|
||||
public constructor Ann9(/*0*/ vararg p1: kotlin.String /*kotlin.Array<out kotlin.String>*/, /*1*/ vararg p2: java.lang.Class<out kotlin.Any?> /*kotlin.Array<out java.lang.Class<out kotlin.Any?>>*/, /*2*/ vararg p3: test.MyEnum /*kotlin.Array<out test.MyEnum>*/, /*3*/ vararg p4: test.Ann1 /*kotlin.Array<out test.Ann1>*/, /*4*/ vararg p5: kotlin.Int /*kotlin.IntArray*/)
|
||||
public constructor Ann9(/*0*/ vararg p1: kotlin.String /*kotlin.Array<out kotlin.String>*/, /*1*/ vararg p2: java.lang.Class<*> /*kotlin.Array<out java.lang.Class<*>>*/, /*2*/ vararg p3: test.MyEnum /*kotlin.Array<out test.MyEnum>*/, /*3*/ vararg p4: test.Ann1 /*kotlin.Array<out test.Ann1>*/, /*4*/ vararg p5: kotlin.Int /*kotlin.IntArray*/)
|
||||
internal final val p1: kotlin.Array<out kotlin.String>
|
||||
internal final val p2: kotlin.Array<out java.lang.Class<out kotlin.Any?>>
|
||||
internal final val p2: kotlin.Array<out java.lang.Class<*>>
|
||||
internal final val p3: kotlin.Array<out test.MyEnum>
|
||||
internal final val p4: kotlin.Array<out test.Ann1>
|
||||
internal final val p5: kotlin.IntArray
|
||||
@@ -143,8 +143,8 @@ package test {
|
||||
}
|
||||
|
||||
internal final annotation class InAnn6 : kotlin.Annotation {
|
||||
public constructor InAnn6(/*0*/ p: java.lang.Class<out kotlin.Any?>?)
|
||||
internal final val p: java.lang.Class<out kotlin.Any?>?
|
||||
public constructor InAnn6(/*0*/ p: java.lang.Class<*>?)
|
||||
internal final val p: java.lang.Class<*>?
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package
|
||||
|
||||
internal fun ff(/*0*/ l: kotlin.Any): kotlin.MutableList<out kotlin.Any?>
|
||||
internal fun ff(/*0*/ l: kotlin.Any): kotlin.MutableList<*>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package
|
||||
|
||||
internal fun f(/*0*/ a: kotlin.Collection<kotlin.Any?>): kotlin.Boolean
|
||||
internal fun f(/*0*/ a: kotlin.Collection<*>): kotlin.Boolean
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package
|
||||
package
|
||||
|
||||
package test {
|
||||
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package
|
||||
|
||||
internal fun f1(/*0*/ p: In<in X>): kotlin.Unit
|
||||
internal fun f10(/*0*/ p: Out<kotlin.Any?>): kotlin.Unit
|
||||
internal fun f11(/*0*/ p: Inv<out kotlin.Any?>): kotlin.Unit
|
||||
internal fun f10(/*0*/ p: Out<*>): kotlin.Unit
|
||||
internal fun f11(/*0*/ p: Inv<*>): kotlin.Unit
|
||||
internal fun f2(/*0*/ p: In<out X>): kotlin.Unit
|
||||
internal fun f3(/*0*/ p: In<X>): kotlin.Unit
|
||||
internal fun f4(/*0*/ p: Out<out X>): kotlin.Unit
|
||||
@@ -11,7 +11,7 @@ internal fun f6(/*0*/ p: Inv<X>): kotlin.Unit
|
||||
internal fun f6(/*0*/ p: Out<X>): kotlin.Unit
|
||||
internal fun f7(/*0*/ p: Inv<in X>): kotlin.Unit
|
||||
internal fun f8(/*0*/ p: Inv<out X>): kotlin.Unit
|
||||
internal fun f9(/*0*/ p: In<out kotlin.Any?>): kotlin.Unit
|
||||
internal fun f9(/*0*/ p: In<*>): kotlin.Unit
|
||||
|
||||
internal final class In</*0*/ in T> {
|
||||
public constructor In</*0*/ in T>()
|
||||
|
||||
@@ -13,7 +13,7 @@ internal final class TestObject : java.lang.Object {
|
||||
protected open override /*1*/ /*delegation*/ fun clone(): kotlin.Any!
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any!): kotlin.Boolean
|
||||
protected open override /*1*/ /*delegation*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun getClass(): java.lang.Class<out kotlin.Any?>!
|
||||
public final override /*1*/ /*fake_override*/ fun getClass(): java.lang.Class<*>!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun notify(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun notifyAll(): kotlin.Unit
|
||||
|
||||
@@ -6,7 +6,7 @@ package test {
|
||||
public open class Usage {
|
||||
public constructor Usage()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public/*package*/ open fun foo(/*0*/ c: (kotlin.MutableCollection<out kotlin.Any?>..kotlin.Collection<kotlin.Any?>?)): kotlin.Unit
|
||||
public/*package*/ open fun foo(/*0*/ c: kotlin.(Mutable)Collection<*>!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package
|
||||
|
||||
internal object O : Tr<V<kotlin.Any?>> {
|
||||
internal object O : Tr<V<*>> {
|
||||
private constructor O()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package
|
||||
|
||||
internal fun test(/*0*/ t: Tr<out kotlin.Any?>): kotlin.Unit
|
||||
internal fun test(/*0*/ t: Tr<*>): kotlin.Unit
|
||||
|
||||
internal trait Tr</*0*/ T> {
|
||||
internal abstract var v: Tr<T>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package
|
||||
|
||||
internal fun test(/*0*/ t: Tr<out kotlin.Any?>): kotlin.Unit
|
||||
internal fun test(/*0*/ t: Tr<*>): kotlin.Unit
|
||||
|
||||
internal trait Tr</*0*/ T> {
|
||||
internal abstract var v: T
|
||||
|
||||
+256
-256
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,4 +1,4 @@
|
||||
package
|
||||
package
|
||||
|
||||
package other {
|
||||
internal val prop: test.PropType? = null
|
||||
|
||||
@@ -7,7 +7,7 @@ package h {
|
||||
internal fun test1(/*0*/ z: h.Z): kotlin.Unit
|
||||
internal fun test2(/*0*/ z: h.Z): kotlin.Unit
|
||||
internal fun test3(/*0*/ z: h.Z): kotlin.Unit
|
||||
internal fun test4(/*0*/ collection: kotlin.Collection<h.A<out kotlin.Any?>>): kotlin.Unit
|
||||
internal fun test4(/*0*/ collection: kotlin.Collection<h.A<*>>): kotlin.Unit
|
||||
internal fun test5(): kotlin.Unit
|
||||
internal fun </*0*/ T> toBeOrNot(): kotlin.Boolean
|
||||
internal fun use(/*0*/ vararg a: kotlin.Any? /*kotlin.Array<out kotlin.Any?>*/): kotlin.Array<out kotlin.Any?>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package
|
||||
|
||||
internal fun </*0*/ T : kotlin.Any> compareBy(/*0*/ a: T?, /*1*/ b: T?, /*2*/ vararg functions: T.() -> kotlin.Comparable<out kotlin.Any?>? /*kotlin.Array<out T.() -> kotlin.Comparable<out kotlin.Any?>?>*/): kotlin.Int
|
||||
internal fun </*0*/ T : kotlin.Any> compareBy(/*0*/ a: T?, /*1*/ b: T?, /*2*/ vararg functions: T.() -> kotlin.Comparable<*>? /*kotlin.Array<out T.() -> kotlin.Comparable<*>?>*/): kotlin.Int
|
||||
|
||||
internal final class Item : kotlin.Comparable<Item> {
|
||||
public constructor Item(/*0*/ name: kotlin.String, /*1*/ rating: kotlin.Int)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package
|
||||
|
||||
package i {
|
||||
internal val kotlin.Collection<kotlin.Any?>.size: kotlin.Int
|
||||
internal val kotlin.Collection<*>.size: kotlin.Int
|
||||
internal fun </*0*/ T> arrayList(/*0*/ vararg values: T /*kotlin.Array<out T>*/): java.util.ArrayList<T>
|
||||
internal fun test(): kotlin.Unit
|
||||
internal fun </*0*/ T, /*1*/ R> kotlin.Collection<T>.map(/*0*/ transform: (T) -> R): kotlin.List<R>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package
|
||||
|
||||
public /*synthesized*/ fun Bar(/*0*/ function: (Foo<out kotlin.CharSequence!>!) -> kotlin.Unit): Bar
|
||||
public /*synthesized*/ fun Bar(/*0*/ function: (Foo<*>!) -> kotlin.Unit): Bar
|
||||
|
||||
public trait Bar {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun f(/*0*/ f: Foo<out kotlin.CharSequence!>!): kotlin.Unit
|
||||
public abstract fun f(/*0*/ f: Foo<*>!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package
|
||||
|
||||
internal fun foo(/*0*/ p: X): Bad<out Bad<out kotlin.Any?>!>!
|
||||
internal fun foo(/*0*/ p: X): Bad<*>!
|
||||
|
||||
public/*package*/ open class Bad</*0*/ T : Bad<out kotlin.Any?>!> {
|
||||
public/*package*/ constructor Bad</*0*/ T : Bad<out kotlin.Any?>!>()
|
||||
@@ -12,7 +12,7 @@ public/*package*/ open class Bad</*0*/ T : Bad<out kotlin.Any?>!> {
|
||||
public/*package*/ open class X {
|
||||
public/*package*/ constructor X()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public/*package*/ open fun foo(): Bad<out Bad<out kotlin.Any?>!>!
|
||||
public/*package*/ open fun foo(): Bad<*>!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ package test {
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var focusCycleRoot: kotlin.Boolean
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var focusListener: [ERROR : Unresolved java classifier: FocusListener]!
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var focusMgr: [ERROR : Unresolved java classifier: FocusManager]!
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var focusTraversalKeys: kotlin.Array<(out) (kotlin.MutableSet<out kotlin.Any?>..kotlin.Set<kotlin.Any?>?)>!
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var focusTraversalKeys: kotlin.Array<(out) kotlin.(Mutable)Set<*>!>!
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var focusTraversalKeysEnabled: kotlin.Boolean
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var focusTraversalPolicy: [ERROR : Unresolved java classifier: FocusTraversalPolicy]!
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var focusTraversalPolicyProvider: kotlin.Boolean
|
||||
@@ -98,7 +98,7 @@ package test {
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var prefSizeSet: kotlin.Boolean
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var preserveBackgroundColor: [ERROR : Unresolved java classifier: Color]!
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var printing: kotlin.Boolean
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var printingThreads: (kotlin.MutableSet<out kotlin.Any?>..kotlin.Set<kotlin.Any?>?)
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var printingThreads: kotlin.(Mutable)Set<*>!
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var resizable: kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ var rootPane: [ERROR : Unresolved java classifier: JRootPane]!
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ var rootPaneCheckingEnabled: kotlin.Boolean
|
||||
@@ -290,7 +290,7 @@ package test {
|
||||
public open override /*1*/ /*fake_override*/ fun getFocusOwner(): java.awt.Component!
|
||||
public open override /*1*/ /*fake_override*/ fun getFocusTraversalKeys(/*0*/ p0: kotlin.Int): kotlin.(Mutable)Set<java.awt.AWTKeyStroke!>!
|
||||
public open override /*1*/ /*fake_override*/ fun getFocusTraversalKeysEnabled(): kotlin.Boolean
|
||||
invisible_fake final override /*1*/ /*fake_override*/ fun getFocusTraversalKeys_NoIDCheck(/*0*/ p0: kotlin.Int): (kotlin.MutableSet<out kotlin.Any?>..kotlin.Set<kotlin.Any?>?)
|
||||
invisible_fake final override /*1*/ /*fake_override*/ fun getFocusTraversalKeys_NoIDCheck(/*0*/ p0: kotlin.Int): kotlin.(Mutable)Set<*>!
|
||||
public open override /*1*/ /*fake_override*/ fun getFocusTraversalPolicy(): [ERROR : Unresolved java classifier: FocusTraversalPolicy]!
|
||||
public open override /*1*/ /*fake_override*/ fun getFocusableWindowState(): kotlin.Boolean
|
||||
[ERROR : java.beans.Transient]() public open override /*1*/ /*fake_override*/ fun getFont(): [ERROR : Unresolved java classifier: Font]!
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package
|
||||
|
||||
internal fun f(/*0*/ c: java.lang.Comparable<out kotlin.Any?>): kotlin.Unit
|
||||
internal fun f(/*0*/ c: java.lang.Comparable<*>): kotlin.Unit
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@ internal val </*0*/ T> T.javaClass: java.lang.Class<T>
|
||||
internal object A {
|
||||
private constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final fun find(/*0*/ clz: java.lang.Class<out kotlin.Any?>): kotlin.Unit
|
||||
internal final fun find(/*0*/ clz: java.lang.Class<*>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
internal final fun toJson2(/*0*/ obj: kotlin.Any): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
@@ -13,7 +13,7 @@ internal object A {
|
||||
public class object <class-object-for-A> : A {
|
||||
private constructor <class-object-for-A>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final override /*1*/ /*fake_override*/ fun find(/*0*/ clz: java.lang.Class<out kotlin.Any?>): kotlin.Unit
|
||||
internal final override /*1*/ /*fake_override*/ fun find(/*0*/ clz: java.lang.Class<*>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
internal final override /*1*/ /*fake_override*/ fun toJson2(/*0*/ obj: kotlin.Any): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package
|
||||
|
||||
internal fun testArrays(/*0*/ ci: kotlin.List<kotlin.Int>): kotlin.Unit
|
||||
internal fun </*0*/ E> kotlin.List<kotlin.Any?>.toArray(/*0*/ ar: kotlin.Array<E>): kotlin.Array<E>
|
||||
internal fun </*0*/ E> kotlin.List<*>.toArray(/*0*/ ar: kotlin.Array<E>): kotlin.Array<E>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package
|
||||
package
|
||||
|
||||
kotlin.js.native() internal final class A {
|
||||
public constructor A()
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package
|
||||
package
|
||||
|
||||
kotlin.js.native() internal final class A {
|
||||
public constructor A()
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package
|
||||
package
|
||||
|
||||
internal final class A {
|
||||
public constructor A()
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package
|
||||
package
|
||||
|
||||
internal final class A {
|
||||
public constructor A()
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package
|
||||
package
|
||||
|
||||
kotlin.js.native() internal final class A {
|
||||
public constructor A()
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package
|
||||
package
|
||||
|
||||
kotlin.js.native() internal final class A {
|
||||
public constructor A()
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package
|
||||
package
|
||||
|
||||
kotlin.js.native() internal final class A {
|
||||
public constructor A()
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package
|
||||
package
|
||||
|
||||
internal final class A {
|
||||
public constructor A()
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package
|
||||
package
|
||||
|
||||
internal final class A {
|
||||
public constructor A()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package
|
||||
package
|
||||
|
||||
kotlin.js.native() internal val baz: kotlin.Int
|
||||
kotlin.js.native() internal val boo: kotlin.Int
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ package
|
||||
package test {
|
||||
|
||||
internal final annotation class AnnClass : kotlin.Annotation {
|
||||
public constructor AnnClass(/*0*/ a: java.lang.Class<out kotlin.Any?>)
|
||||
internal final val a: java.lang.Class<out kotlin.Any?>
|
||||
public constructor AnnClass(/*0*/ a: java.lang.Class<*>)
|
||||
internal final val a: java.lang.Class<*>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
+3
-3
@@ -24,8 +24,8 @@ internal final annotation class AnnAnn : kotlin.Annotation {
|
||||
}
|
||||
|
||||
internal final annotation class AnnJC : kotlin.Annotation {
|
||||
public constructor AnnJC(/*0*/ i: kotlin.Array<java.lang.Class<out kotlin.Any?>>)
|
||||
internal final val i: kotlin.Array<java.lang.Class<out kotlin.Any?>>
|
||||
public constructor AnnJC(/*0*/ i: kotlin.Array<java.lang.Class<*>>)
|
||||
internal final val i: kotlin.Array<java.lang.Class<*>>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
@@ -45,7 +45,7 @@ AnnAnn(i = {Ann(i = {IntegerValueType(1)}: kotlin.IntArray)}: kotlin.Array<Ann>)
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
AnnJC(i = {Test.class}: kotlin.Array<java.lang.Class<out kotlin.Any?>>) AnnJC(i = {}: kotlin.Array<java.lang.Class<out kotlin.Any?>>) internal final class TestJC {
|
||||
AnnJC(i = {Test.class}: kotlin.Array<java.lang.Class<*>>) AnnJC(i = {}: kotlin.Array<java.lang.Class<*>>) internal final class TestJC {
|
||||
public constructor TestJC()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package
|
||||
|
||||
internal val c: java.lang.Class<out kotlin.Any?>
|
||||
internal val c: java.lang.Class<*>
|
||||
|
||||
internal final class A {
|
||||
public constructor A()
|
||||
@@ -10,8 +10,8 @@ internal final class A {
|
||||
}
|
||||
|
||||
internal final annotation class AnnC : kotlin.Annotation {
|
||||
public constructor AnnC(/*0*/ c: java.lang.Class<out kotlin.Any?>)
|
||||
internal final val c: java.lang.Class<out kotlin.Any?>
|
||||
public constructor AnnC(/*0*/ c: java.lang.Class<*>)
|
||||
internal final val c: java.lang.Class<*>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@ internal final annotation class AnnAnn : kotlin.Annotation {
|
||||
}
|
||||
|
||||
internal final annotation class AnnJC : kotlin.Annotation {
|
||||
public constructor AnnJC(/*0*/ vararg i: java.lang.Class<out kotlin.Any?> /*kotlin.Array<out java.lang.Class<out kotlin.Any?>>*/)
|
||||
internal final val i: kotlin.Array<out java.lang.Class<out kotlin.Any?>>
|
||||
public constructor AnnJC(/*0*/ vararg i: java.lang.Class<*> /*kotlin.Array<out java.lang.Class<*>>*/)
|
||||
internal final val i: kotlin.Array<out java.lang.Class<*>>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
@@ -55,8 +55,8 @@ package a {
|
||||
}
|
||||
|
||||
internal final annotation class annJavaClass : kotlin.Annotation {
|
||||
public constructor annJavaClass(/*0*/ p: java.lang.Class<out kotlin.Any?> = ...)
|
||||
internal final val p: java.lang.Class<out kotlin.Any?>
|
||||
public constructor annJavaClass(/*0*/ p: java.lang.Class<*> = ...)
|
||||
internal final val p: java.lang.Class<*>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
+2
-2
@@ -10,10 +10,10 @@ private val INT: CompileTimeType<kotlin.Int>
|
||||
private val LONG: CompileTimeType<kotlin.Long>
|
||||
private val SHORT: CompileTimeType<kotlin.Short>
|
||||
private val STRING: CompileTimeType<kotlin.String>
|
||||
private val binaryOperations: java.util.HashMap<BinaryOperationKey<out kotlin.Any?, out kotlin.Any?>, kotlin.Pair<(kotlin.Any?, kotlin.Any?) -> kotlin.Any, (BigInteger, BigInteger) -> BigInteger>>
|
||||
private val binaryOperations: java.util.HashMap<BinaryOperationKey<*, *>, kotlin.Pair<(kotlin.Any?, kotlin.Any?) -> kotlin.Any, (BigInteger, BigInteger) -> BigInteger>>
|
||||
private val emptyBinaryFun: (BigInteger, BigInteger) -> BigInteger
|
||||
private val emptyUnaryFun: (kotlin.Long) -> kotlin.Long
|
||||
private val unaryOperations: java.util.HashMap<UnaryOperationKey<out kotlin.Any?>, kotlin.Pair<(kotlin.Any?) -> kotlin.Any, (kotlin.Long) -> kotlin.Long>>
|
||||
private val unaryOperations: java.util.HashMap<UnaryOperationKey<*>, kotlin.Pair<(kotlin.Any?) -> kotlin.Any, (kotlin.Long) -> kotlin.Long>>
|
||||
private fun </*0*/ A, /*1*/ B> binaryOperation(/*0*/ a: CompileTimeType<A>, /*1*/ b: CompileTimeType<B>, /*2*/ functionName: kotlin.String, /*3*/ operation: (A, B) -> kotlin.Any, /*4*/ checker: (BigInteger, BigInteger) -> BigInteger): kotlin.Pair<BinaryOperationKey<A, B>, kotlin.Pair<(kotlin.Any?, kotlin.Any?) -> kotlin.Any, (BigInteger, BigInteger) -> BigInteger>>
|
||||
private fun </*0*/ A> unaryOperation(/*0*/ a: CompileTimeType<A>, /*1*/ functionName: kotlin.String, /*2*/ operation: (A) -> kotlin.Any, /*3*/ checker: (kotlin.Long) -> kotlin.Long): kotlin.Pair<UnaryOperationKey<A>, kotlin.Pair<(kotlin.Any?) -> kotlin.Any, (kotlin.Long) -> kotlin.Long>>
|
||||
|
||||
|
||||
@@ -3,5 +3,5 @@ package
|
||||
package j {
|
||||
internal fun testArrays(/*0*/ ci: kotlin.List<kotlin.Int?>, /*1*/ cii: kotlin.List<kotlin.Int?>?): kotlin.Unit
|
||||
internal fun </*0*/ T : kotlin.Any> T?.sure(): T
|
||||
internal fun </*0*/ E> kotlin.List<kotlin.Any?>.toArray(/*0*/ ar: kotlin.Array<E>): kotlin.Array<E>
|
||||
internal fun </*0*/ E> kotlin.List<*>.toArray(/*0*/ ar: kotlin.Array<E>): kotlin.Array<E>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package rendererTest
|
||||
|
||||
class C<T: C<T>> {
|
||||
fun foo(c: C<*>) {}
|
||||
}
|
||||
|
||||
fun foo(c: C<*>) {}
|
||||
fun foo1(c: C<C<*>>) {}
|
||||
|
||||
//package rendererTest
|
||||
//internal final class C<T : rendererTest.C<T>> defined in rendererTest
|
||||
//public constructor C<T : rendererTest.C<T>>() defined in rendererTest.C
|
||||
//<T : rendererTest.C<T>> defined in rendererTest.C
|
||||
//internal final fun foo(c: rendererTest.C<*>): kotlin.Unit defined in rendererTest.C
|
||||
//value-parameter val c: rendererTest.C<*> defined in rendererTest.C.foo
|
||||
//internal fun foo(c: rendererTest.C<*>): kotlin.Unit defined in rendererTest
|
||||
//value-parameter val c: rendererTest.C<*> defined in rendererTest.foo
|
||||
//internal fun foo1(c: rendererTest.C<rendererTest.C<*>>): kotlin.Unit defined in rendererTest
|
||||
//value-parameter val c: rendererTest.C<rendererTest.C<*>> defined in rendererTest.foo1
|
||||
@@ -3,4 +3,4 @@ fun listOfStar(): List<*> = throw Exception()
|
||||
|
||||
// method: _DefaultPackage::listOfStar
|
||||
// jvm signature: ()Ljava/util/List;
|
||||
// generic signature: ()Ljava/util/List<Ljava/lang/Object;>;
|
||||
// generic signature: ()Ljava/util/List<*>;
|
||||
@@ -0,0 +1,7 @@
|
||||
class C<T : C<T>> {
|
||||
fun foo(c: C<*>): C<*> = null!!
|
||||
}
|
||||
|
||||
// method: C::foo
|
||||
// jvm signature: (LC;)LC;
|
||||
// generic signature: (LC<*>;)LC<*>;
|
||||
@@ -0,0 +1,11 @@
|
||||
class C<T : C<T>> {
|
||||
fun foo(c: C<*>) {}
|
||||
}
|
||||
|
||||
open class Super<T>
|
||||
|
||||
class Sub: Super<C<*>>()
|
||||
|
||||
// class: Sub
|
||||
// jvm signature: Sub
|
||||
// generic signature: LSuper<LC<*>;>;Lkotlin/jvm/internal/KObject;
|
||||
@@ -0,0 +1,7 @@
|
||||
class C<T : C<T>>
|
||||
|
||||
fun bar(c: C<*>): C<*> = null!!
|
||||
|
||||
// method: _DefaultPackage::bar
|
||||
// jvm signature: (LC;)LC;
|
||||
// generic signature: (LC<*>;)LC<*>;
|
||||
+6
@@ -116,6 +116,12 @@ public class CompileJavaAgainstKotlinTestGenerated extends AbstractCompileJavaAg
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/class/Simple.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("StarProjection.kt")
|
||||
public void testStarProjection() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/class/StarProjection.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileJavaAgainstKotlin/method")
|
||||
|
||||
@@ -109,6 +109,24 @@ public class WriteSignatureTestGenerated extends AbstractWriteSignatureTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("StarProjectionInClass.kt")
|
||||
public void testStarProjectionInClass() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/writeSignature/StarProjectionInClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("StarProjectionInSuper.kt")
|
||||
public void testStarProjectionInSuper() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/writeSignature/StarProjectionInSuper.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("StarProjectionOutsideClass.kt")
|
||||
public void testStarProjectionOutsideClass() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/writeSignature/StarProjectionOutsideClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("VarargCharSequence.kt")
|
||||
public void testVarargCharSequence() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/writeSignature/VarargCharSequence.kt");
|
||||
|
||||
@@ -90,6 +90,12 @@ public class DescriptorRendererTestGenerated extends AbstractDescriptorRendererT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("StarProjection.kt")
|
||||
public void testStarProjection() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/renderer/StarProjection.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("UnitType.kt")
|
||||
public void testUnitType() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/renderer/UnitType.kt");
|
||||
|
||||
+3
@@ -91,9 +91,12 @@ class LazyJavaTypeResolver(
|
||||
val typeParameter: TypeParameterDescriptor,
|
||||
val attr: JavaTypeAttributes
|
||||
) : TypeProjectionBase() {
|
||||
override fun isStarProjection() = true
|
||||
|
||||
override fun getProjectionKind() =
|
||||
// projections are not allowed in immediate arguments of supertypes
|
||||
if (typeParameter.getVariance() == OUT_VARIANCE || attr.howThisTypeIsUsed == SUPERTYPE) INVARIANT else OUT_VARIANCE
|
||||
|
||||
override fun getType() = typeParameter.getUpperBoundsAsType()
|
||||
}
|
||||
|
||||
|
||||
@@ -480,10 +480,15 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
||||
private void appendTypeProjections(@NotNull List<TypeProjection> typeProjections, @NotNull StringBuilder builder) {
|
||||
for (Iterator<TypeProjection> iterator = typeProjections.iterator(); iterator.hasNext(); ) {
|
||||
TypeProjection typeProjection = iterator.next();
|
||||
if (typeProjection.getProjectionKind() != Variance.INVARIANT) {
|
||||
builder.append(typeProjection.getProjectionKind()).append(" ");
|
||||
if (typeProjection.isStarProjection()) {
|
||||
builder.append("*");
|
||||
}
|
||||
else {
|
||||
if (typeProjection.getProjectionKind() != Variance.INVARIANT) {
|
||||
builder.append(typeProjection.getProjectionKind()).append(" ");
|
||||
}
|
||||
builder.append(renderNormalizedType(typeProjection.getType()));
|
||||
}
|
||||
builder.append(renderNormalizedType(typeProjection.getType()));
|
||||
if (iterator.hasNext()) {
|
||||
builder.append(", ");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.types
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
|
||||
class StarProjectionImpl(
|
||||
private val _type: JetType
|
||||
) : TypeProjectionBase() {
|
||||
override fun isStarProjection() = true
|
||||
|
||||
override fun getProjectionKind() = Variance.OUT_VARIANCE
|
||||
|
||||
override fun getType() = _type
|
||||
}
|
||||
@@ -24,4 +24,6 @@ public interface TypeProjection {
|
||||
|
||||
@NotNull
|
||||
JetType getType();
|
||||
|
||||
boolean isStarProjection();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@ public abstract class TypeProjectionBase implements TypeProjection {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (isStarProjection()) {
|
||||
return "*";
|
||||
}
|
||||
if (getProjectionKind() == Variance.INVARIANT) {
|
||||
return getType().toString();
|
||||
}
|
||||
|
||||
@@ -42,4 +42,9 @@ public class TypeProjectionImpl extends TypeProjectionBase {
|
||||
public JetType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStarProjection() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -584,9 +584,7 @@ public class TypeUtils {
|
||||
|
||||
@NotNull
|
||||
public static TypeProjection makeStarProjection(@NotNull TypeParameterDescriptor parameterDescriptor) {
|
||||
return new TypeProjectionImpl(parameterDescriptor.getVariance() == Variance.OUT_VARIANCE
|
||||
? Variance.INVARIANT
|
||||
: Variance.OUT_VARIANCE, parameterDescriptor.getUpperBoundsAsType());
|
||||
return new StarProjectionImpl(parameterDescriptor.getUpperBoundsAsType());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user