Introduce predefined enhancement info
It can be used to specify enhanced signature for standard JDK methods without them be actually annotated #KT-9194 In Progress #KT-5175 In Progress #KT-10370 In Progress #KT-7127 In Progress
This commit is contained in:
+12
-12
@@ -2,7 +2,7 @@ package-fragment kotlin.collections
|
|||||||
|
|
||||||
public abstract class BooleanIterator : kotlin.collections.Iterator<kotlin.Boolean> {
|
public abstract class BooleanIterator : kotlin.collections.Iterator<kotlin.Boolean> {
|
||||||
/*primary*/ public constructor BooleanIterator()
|
/*primary*/ public constructor BooleanIterator()
|
||||||
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Boolean!>!): kotlin.Unit
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Boolean>): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
public final override /*1*/ fun next(): kotlin.Boolean
|
public final override /*1*/ fun next(): kotlin.Boolean
|
||||||
public abstract fun nextBoolean(): kotlin.Boolean
|
public abstract fun nextBoolean(): kotlin.Boolean
|
||||||
@@ -10,7 +10,7 @@ public abstract class BooleanIterator : kotlin.collections.Iterator<kotlin.Boole
|
|||||||
|
|
||||||
public abstract class ByteIterator : kotlin.collections.Iterator<kotlin.Byte> {
|
public abstract class ByteIterator : kotlin.collections.Iterator<kotlin.Byte> {
|
||||||
/*primary*/ public constructor ByteIterator()
|
/*primary*/ public constructor ByteIterator()
|
||||||
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Byte!>!): kotlin.Unit
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Byte>): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
public final override /*1*/ fun next(): kotlin.Byte
|
public final override /*1*/ fun next(): kotlin.Byte
|
||||||
public abstract fun nextByte(): kotlin.Byte
|
public abstract fun nextByte(): kotlin.Byte
|
||||||
@@ -18,7 +18,7 @@ public abstract class ByteIterator : kotlin.collections.Iterator<kotlin.Byte> {
|
|||||||
|
|
||||||
public abstract class CharIterator : kotlin.collections.Iterator<kotlin.Char> {
|
public abstract class CharIterator : kotlin.collections.Iterator<kotlin.Char> {
|
||||||
/*primary*/ public constructor CharIterator()
|
/*primary*/ public constructor CharIterator()
|
||||||
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Char!>!): kotlin.Unit
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Char>): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
public final override /*1*/ fun next(): kotlin.Char
|
public final override /*1*/ fun next(): kotlin.Char
|
||||||
public abstract fun nextChar(): kotlin.Char
|
public abstract fun nextChar(): kotlin.Char
|
||||||
@@ -39,7 +39,7 @@ public interface Collection</*0*/ out E> : kotlin.collections.Iterable<E> {
|
|||||||
|
|
||||||
public abstract class DoubleIterator : kotlin.collections.Iterator<kotlin.Double> {
|
public abstract class DoubleIterator : kotlin.collections.Iterator<kotlin.Double> {
|
||||||
/*primary*/ public constructor DoubleIterator()
|
/*primary*/ public constructor DoubleIterator()
|
||||||
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Double!>!): kotlin.Unit
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Double>): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
public final override /*1*/ fun next(): kotlin.Double
|
public final override /*1*/ fun next(): kotlin.Double
|
||||||
public abstract fun nextDouble(): kotlin.Double
|
public abstract fun nextDouble(): kotlin.Double
|
||||||
@@ -47,7 +47,7 @@ public abstract class DoubleIterator : kotlin.collections.Iterator<kotlin.Double
|
|||||||
|
|
||||||
public abstract class FloatIterator : kotlin.collections.Iterator<kotlin.Float> {
|
public abstract class FloatIterator : kotlin.collections.Iterator<kotlin.Float> {
|
||||||
/*primary*/ public constructor FloatIterator()
|
/*primary*/ public constructor FloatIterator()
|
||||||
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Float!>!): kotlin.Unit
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Float>): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
public final override /*1*/ fun next(): kotlin.Float
|
public final override /*1*/ fun next(): kotlin.Float
|
||||||
public abstract fun nextFloat(): kotlin.Float
|
public abstract fun nextFloat(): kotlin.Float
|
||||||
@@ -55,7 +55,7 @@ public abstract class FloatIterator : kotlin.collections.Iterator<kotlin.Float>
|
|||||||
|
|
||||||
public abstract class IntIterator : kotlin.collections.Iterator<kotlin.Int> {
|
public abstract class IntIterator : kotlin.collections.Iterator<kotlin.Int> {
|
||||||
/*primary*/ public constructor IntIterator()
|
/*primary*/ public constructor IntIterator()
|
||||||
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Int!>!): kotlin.Unit
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Int>): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
public final override /*1*/ fun next(): kotlin.Int
|
public final override /*1*/ fun next(): kotlin.Int
|
||||||
public abstract fun nextInt(): kotlin.Int
|
public abstract fun nextInt(): kotlin.Int
|
||||||
@@ -68,7 +68,7 @@ public interface Iterable</*0*/ out T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface Iterator</*0*/ out T> {
|
public interface Iterator</*0*/ out T> {
|
||||||
public open fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in T!>!): kotlin.Unit
|
public open fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in T>): kotlin.Unit
|
||||||
public abstract operator fun hasNext(): kotlin.Boolean
|
public abstract operator fun hasNext(): kotlin.Boolean
|
||||||
public abstract operator fun next(): T
|
public abstract operator fun next(): T
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ public interface List</*0*/ out E> : kotlin.collections.Collection<E> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface ListIterator</*0*/ out T> : kotlin.collections.Iterator<T> {
|
public interface ListIterator</*0*/ out T> : kotlin.collections.Iterator<T> {
|
||||||
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in T!>!): kotlin.Unit
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in T>): kotlin.Unit
|
||||||
public abstract override /*1*/ fun hasNext(): kotlin.Boolean
|
public abstract override /*1*/ fun hasNext(): kotlin.Boolean
|
||||||
public abstract fun hasPrevious(): kotlin.Boolean
|
public abstract fun hasPrevious(): kotlin.Boolean
|
||||||
public abstract override /*1*/ fun next(): T
|
public abstract override /*1*/ fun next(): T
|
||||||
@@ -104,7 +104,7 @@ public interface ListIterator</*0*/ out T> : kotlin.collections.Iterator<T> {
|
|||||||
|
|
||||||
public abstract class LongIterator : kotlin.collections.Iterator<kotlin.Long> {
|
public abstract class LongIterator : kotlin.collections.Iterator<kotlin.Long> {
|
||||||
/*primary*/ public constructor LongIterator()
|
/*primary*/ public constructor LongIterator()
|
||||||
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Long!>!): kotlin.Unit
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Long>): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
public final override /*1*/ fun next(): kotlin.Long
|
public final override /*1*/ fun next(): kotlin.Long
|
||||||
public abstract fun nextLong(): kotlin.Long
|
public abstract fun nextLong(): kotlin.Long
|
||||||
@@ -161,7 +161,7 @@ public interface MutableIterable</*0*/ out T> : kotlin.collections.Iterable<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface MutableIterator</*0*/ out T> : kotlin.collections.Iterator<T> {
|
public interface MutableIterator</*0*/ out T> : kotlin.collections.Iterator<T> {
|
||||||
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in T!>!): kotlin.Unit
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in T>): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
public abstract override /*1*/ /*fake_override*/ fun next(): T
|
public abstract override /*1*/ /*fake_override*/ fun next(): T
|
||||||
public abstract fun remove(): kotlin.Unit
|
public abstract fun remove(): kotlin.Unit
|
||||||
@@ -201,7 +201,7 @@ public interface MutableList</*0*/ E> : kotlin.collections.List<E>, kotlin.colle
|
|||||||
|
|
||||||
public interface MutableListIterator</*0*/ T> : kotlin.collections.ListIterator<T>, kotlin.collections.MutableIterator<T> {
|
public interface MutableListIterator</*0*/ T> : kotlin.collections.ListIterator<T>, kotlin.collections.MutableIterator<T> {
|
||||||
public abstract fun add(/*0*/ element: T): kotlin.Unit
|
public abstract fun add(/*0*/ element: T): kotlin.Unit
|
||||||
public open override /*2*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in T!>!): kotlin.Unit
|
public open override /*2*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in T>): kotlin.Unit
|
||||||
public abstract override /*2*/ fun hasNext(): kotlin.Boolean
|
public abstract override /*2*/ fun hasNext(): kotlin.Boolean
|
||||||
public abstract override /*1*/ /*fake_override*/ fun hasPrevious(): kotlin.Boolean
|
public abstract override /*1*/ /*fake_override*/ fun hasPrevious(): kotlin.Boolean
|
||||||
public abstract override /*2*/ fun next(): T
|
public abstract override /*2*/ fun next(): T
|
||||||
@@ -285,7 +285,7 @@ public interface Set</*0*/ out E> : kotlin.collections.Collection<E> {
|
|||||||
|
|
||||||
public abstract class ShortIterator : kotlin.collections.Iterator<kotlin.Short> {
|
public abstract class ShortIterator : kotlin.collections.Iterator<kotlin.Short> {
|
||||||
/*primary*/ public constructor ShortIterator()
|
/*primary*/ public constructor ShortIterator()
|
||||||
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Short!>!): kotlin.Unit
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Short>): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
public final override /*1*/ fun next(): kotlin.Short
|
public final override /*1*/ fun next(): kotlin.Short
|
||||||
public abstract fun nextShort(): kotlin.Short
|
public abstract fun nextShort(): kotlin.Short
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ internal final class CharProgressionIterator : kotlin.collections.CharIterator {
|
|||||||
private final fun <set-next>(/*0*/ <set-?>: kotlin.Int): kotlin.Unit
|
private final fun <set-next>(/*0*/ <set-?>: kotlin.Int): kotlin.Unit
|
||||||
public final val step: kotlin.Int
|
public final val step: kotlin.Int
|
||||||
public final fun <get-step>(): kotlin.Int
|
public final fun <get-step>(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Char!>!): kotlin.Unit
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Char>): kotlin.Unit
|
||||||
public open override /*1*/ fun hasNext(): kotlin.Boolean
|
public open override /*1*/ fun hasNext(): kotlin.Boolean
|
||||||
public final override /*1*/ /*fake_override*/ fun next(): kotlin.Char
|
public final override /*1*/ /*fake_override*/ fun next(): kotlin.Char
|
||||||
public open override /*1*/ fun nextChar(): kotlin.Char
|
public open override /*1*/ fun nextChar(): kotlin.Char
|
||||||
@@ -102,7 +102,7 @@ internal final class IntProgressionIterator : kotlin.collections.IntIterator {
|
|||||||
private final fun <set-next>(/*0*/ <set-?>: kotlin.Int): kotlin.Unit
|
private final fun <set-next>(/*0*/ <set-?>: kotlin.Int): kotlin.Unit
|
||||||
public final val step: kotlin.Int
|
public final val step: kotlin.Int
|
||||||
public final fun <get-step>(): kotlin.Int
|
public final fun <get-step>(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Int!>!): kotlin.Unit
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Int>): kotlin.Unit
|
||||||
public open override /*1*/ fun hasNext(): kotlin.Boolean
|
public open override /*1*/ fun hasNext(): kotlin.Boolean
|
||||||
public final override /*1*/ /*fake_override*/ fun next(): kotlin.Int
|
public final override /*1*/ /*fake_override*/ fun next(): kotlin.Int
|
||||||
public open override /*1*/ fun nextInt(): kotlin.Int
|
public open override /*1*/ fun nextInt(): kotlin.Int
|
||||||
@@ -164,7 +164,7 @@ internal final class LongProgressionIterator : kotlin.collections.LongIterator {
|
|||||||
private final fun <set-next>(/*0*/ <set-?>: kotlin.Long): kotlin.Unit
|
private final fun <set-next>(/*0*/ <set-?>: kotlin.Long): kotlin.Unit
|
||||||
public final val step: kotlin.Long
|
public final val step: kotlin.Long
|
||||||
public final fun <get-step>(): kotlin.Long
|
public final fun <get-step>(): kotlin.Long
|
||||||
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Long!>!): kotlin.Unit
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.Long>): kotlin.Unit
|
||||||
public open override /*1*/ fun hasNext(): kotlin.Boolean
|
public open override /*1*/ fun hasNext(): kotlin.Boolean
|
||||||
public final override /*1*/ /*fake_override*/ fun next(): kotlin.Long
|
public final override /*1*/ /*fake_override*/ fun next(): kotlin.Long
|
||||||
public open override /*1*/ fun nextLong(): kotlin.Long
|
public open override /*1*/ fun nextLong(): kotlin.Long
|
||||||
|
|||||||
Vendored
+39
@@ -0,0 +1,39 @@
|
|||||||
|
import java.util.function.Consumer
|
||||||
|
|
||||||
|
abstract class MyIt1<out T> : Iterator<T> {
|
||||||
|
override fun forEachRemaining(x: Consumer<in T>) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class MyIt2<out T> : Iterator<T> {
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun forEachRemaining(x: Consumer<in T?>) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class MyIt3<out T> : Iterator<T> {
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun forEachRemaining(x: Consumer<in T>?) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class MyIt4 : Iterator<String?> {
|
||||||
|
override fun forEachRemaining(x: Consumer<in String?>) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class MyIt5 : Iterator<String> {
|
||||||
|
override fun forEachRemaining(x: Consumer<in String>) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class MyIt6 : Iterator<String?> {
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun forEachRemaining(x: Consumer<in String>) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class MyIt7 : Iterator<String> {
|
||||||
|
<!NOTHING_TO_OVERRIDE!>override<!> fun forEachRemaining(x: Consumer<in String?>) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun foo(x: Iterator<String>, y: Iterator<String?>) {
|
||||||
|
x.<!TYPE_INFERENCE_INCORPORATION_ERROR!>forEachRemaining<!>(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||||
|
|
||||||
|
x.forEachRemaining { it -> it.length }
|
||||||
|
x.forEachRemaining { it -> it<!UNNECESSARY_SAFE_CALL!>?.<!>length }
|
||||||
|
y.forEachRemaining { it -> it<!UNSAFE_CALL!>.<!>length }
|
||||||
|
y.forEachRemaining { it -> it?.length }
|
||||||
|
}
|
||||||
Vendored
+77
@@ -0,0 +1,77 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun foo(/*0*/ x: kotlin.collections.Iterator<kotlin.String>, /*1*/ y: kotlin.collections.Iterator<kotlin.String?>): kotlin.Unit
|
||||||
|
|
||||||
|
public abstract class MyIt1</*0*/ out T> : kotlin.collections.Iterator<T> {
|
||||||
|
public constructor MyIt1</*0*/ out T>()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ fun forEachRemaining(/*0*/ x: java.util.function.Consumer<in T>): kotlin.Unit
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun next(): T
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class MyIt2</*0*/ out T> : kotlin.collections.Iterator<T> {
|
||||||
|
public constructor MyIt2</*0*/ out T>()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in T>): kotlin.Unit
|
||||||
|
public open fun forEachRemaining(/*0*/ x: java.util.function.Consumer<in T?>): kotlin.Unit
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun next(): T
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class MyIt3</*0*/ out T> : kotlin.collections.Iterator<T> {
|
||||||
|
public constructor MyIt3</*0*/ out T>()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in T>): kotlin.Unit
|
||||||
|
public open fun forEachRemaining(/*0*/ x: java.util.function.Consumer<in T>?): kotlin.Unit
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun next(): T
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class MyIt4 : kotlin.collections.Iterator<kotlin.String?> {
|
||||||
|
public constructor MyIt4()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ fun forEachRemaining(/*0*/ x: java.util.function.Consumer<in kotlin.String?>): kotlin.Unit
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun next(): kotlin.String?
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class MyIt5 : kotlin.collections.Iterator<kotlin.String> {
|
||||||
|
public constructor MyIt5()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ fun forEachRemaining(/*0*/ x: java.util.function.Consumer<in kotlin.String>): kotlin.Unit
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun next(): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class MyIt6 : kotlin.collections.Iterator<kotlin.String?> {
|
||||||
|
public constructor MyIt6()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open fun forEachRemaining(/*0*/ x: java.util.function.Consumer<in kotlin.String>): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.String?>): kotlin.Unit
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun next(): kotlin.String?
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class MyIt7 : kotlin.collections.Iterator<kotlin.String> {
|
||||||
|
public constructor MyIt7()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun forEachRemaining(/*0*/ p0: java.util.function.Consumer<in kotlin.String>): kotlin.Unit
|
||||||
|
public open fun forEachRemaining(/*0*/ x: java.util.function.Consumer<in kotlin.String?>): kotlin.Unit
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun next(): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
+6
@@ -121,6 +121,12 @@ public class DiagnosticsWithJava8TestGenerated extends AbstractDiagnosticsWithFu
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns"), Pattern.compile("^(.+)\\.kt$"), true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("forEachRemainingNullability.kt")
|
||||||
|
public void testForEachRemainingNullability() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns/forEachRemainingNullability.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("removeIf.kt")
|
@TestMetadata("removeIf.kt")
|
||||||
public void testRemoveIf() throws Exception {
|
public void testRemoveIf() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns/removeIf.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns/removeIf.kt");
|
||||||
|
|||||||
+46
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2016 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.load.java.typeEnhancement
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.load.kotlin.signatures
|
||||||
|
|
||||||
|
class TypeEnhancementInfo(val map: Map<Int, JavaTypeQualifiers>) {
|
||||||
|
constructor(vararg pairs: Pair<Int, JavaTypeQualifiers>) : this(mapOf(*pairs))
|
||||||
|
}
|
||||||
|
|
||||||
|
class PredefinedFunctionEnhancementInfo(
|
||||||
|
val returnTypeInfo: TypeEnhancementInfo? = null,
|
||||||
|
val parametersInfo: List<TypeEnhancementInfo?> = emptyList()
|
||||||
|
)
|
||||||
|
|
||||||
|
private val NOT_NULLABLE = JavaTypeQualifiers(NullabilityQualifier.NOT_NULL, null, isNotNullTypeParameter = false)
|
||||||
|
|
||||||
|
val PREDEFINED_FUNCTION_ENHANCEMENT_INFO_BY_SIGNATURE = signatures {
|
||||||
|
mapOf(
|
||||||
|
signature(javaUtil("Iterator"), "forEachRemaining(Ljava/util/function/Consumer;)V") to
|
||||||
|
PredefinedFunctionEnhancementInfo(
|
||||||
|
parametersInfo = listOf(
|
||||||
|
TypeEnhancementInfo(
|
||||||
|
0 to NOT_NULLABLE,
|
||||||
|
1 to NOT_NULLABLE
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
signature("java/util/function/Consumer", "accept($objectType)V") to
|
||||||
|
PredefinedFunctionEnhancementInfo(parametersInfo = listOf(TypeEnhancementInfo(0 to NOT_NULLABLE)))
|
||||||
|
)
|
||||||
|
}
|
||||||
+31
-5
@@ -17,7 +17,11 @@
|
|||||||
package org.jetbrains.kotlin.load.java.typeEnhancement
|
package org.jetbrains.kotlin.load.java.typeEnhancement
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||||
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor
|
import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor
|
||||||
|
import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor
|
||||||
|
import org.jetbrains.kotlin.load.kotlin.SignatureBuildingComponents
|
||||||
|
import org.jetbrains.kotlin.load.kotlin.computeJvmDescriptor
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
|
|
||||||
fun <D : CallableMemberDescriptor> enhanceSignatures(platformSignatures: Collection<D>): Collection<D> {
|
fun <D : CallableMemberDescriptor> enhanceSignatures(platformSignatures: Collection<D>): Collection<D> {
|
||||||
@@ -41,11 +45,26 @@ private fun <D : CallableMemberDescriptor> D.enhanceSignature(): D {
|
|||||||
parts(isCovariant = false) { it.extensionReceiverParameter!!.type }.enhance()
|
parts(isCovariant = false) { it.extensionReceiverParameter!!.type }.enhance()
|
||||||
else null
|
else null
|
||||||
|
|
||||||
val valueParameterEnhancements = valueParameters.map {
|
|
||||||
p -> parts(isCovariant = false) { it.valueParameters[p.index].type }.enhance()
|
val predefinedEnhancementInfo =
|
||||||
|
if (this is JavaMethodDescriptor)
|
||||||
|
PREDEFINED_FUNCTION_ENHANCEMENT_INFO_BY_SIGNATURE[
|
||||||
|
SignatureBuildingComponents.signature(this.containingDeclaration as ClassDescriptor, this.computeJvmDescriptor())]
|
||||||
|
else null
|
||||||
|
|
||||||
|
predefinedEnhancementInfo?.let {
|
||||||
|
assert(it.parametersInfo.size == valueParameters.size) {
|
||||||
|
"Predefined enhancement info for $this has ${it.parametersInfo.size}, but ${valueParameters.size} expected"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val returnTypeEnhancement = parts(isCovariant = true) { it.returnType!! }.enhance()
|
val valueParameterEnhancements = valueParameters.map {
|
||||||
|
p ->
|
||||||
|
parts(isCovariant = false) { it.valueParameters[p.index].type }
|
||||||
|
.enhance(predefinedEnhancementInfo?.parametersInfo?.getOrNull(p.index))
|
||||||
|
}
|
||||||
|
|
||||||
|
val returnTypeEnhancement = parts(isCovariant = true) { it.returnType!! }.enhance(predefinedEnhancementInfo?.returnTypeInfo)
|
||||||
|
|
||||||
if ((receiverTypeEnhancement?.wereChanges ?: false)
|
if ((receiverTypeEnhancement?.wereChanges ?: false)
|
||||||
|| returnTypeEnhancement.wereChanges || valueParameterEnhancements.any { it.wereChanges }) {
|
|| returnTypeEnhancement.wereChanges || valueParameterEnhancements.any { it.wereChanges }) {
|
||||||
@@ -61,9 +80,16 @@ private class SignatureParts(
|
|||||||
val fromOverridden: Collection<KotlinType>,
|
val fromOverridden: Collection<KotlinType>,
|
||||||
val isCovariant: Boolean
|
val isCovariant: Boolean
|
||||||
) {
|
) {
|
||||||
fun enhance(): PartEnhancementResult {
|
fun enhance(predefined: TypeEnhancementInfo? = null): PartEnhancementResult {
|
||||||
val qualifiers = fromOverride.computeIndexedQualifiersForOverride(this.fromOverridden, isCovariant)
|
val qualifiers = fromOverride.computeIndexedQualifiersForOverride(this.fromOverridden, isCovariant)
|
||||||
return fromOverride.enhance(qualifiers)?.let {
|
|
||||||
|
val qualifiersWithPredefined: ((Int) -> JavaTypeQualifiers)? = predefined?.let {
|
||||||
|
{
|
||||||
|
index -> predefined.map[index] ?: qualifiers(index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fromOverride.enhance(qualifiersWithPredefined ?: qualifiers)?.let {
|
||||||
enhanced -> PartEnhancementResult(enhanced, wereChanges = true)
|
enhanced -> PartEnhancementResult(enhanced, wereChanges = true)
|
||||||
} ?: PartEnhancementResult(fromOverride, wereChanges = false)
|
} ?: PartEnhancementResult(fromOverride, wereChanges = false)
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-22
@@ -149,10 +149,10 @@ open class JvmBuiltInsAdditionalClassPartsProvider(
|
|||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
javaClassDescriptor ->
|
javaClassDescriptor ->
|
||||||
signature(javaClassDescriptor, jvmDescriptor) in BLACK_LIST_METHOD_SIGNATURES
|
SignatureBuildingComponents.signature(javaClassDescriptor, jvmDescriptor) in BLACK_LIST_METHOD_SIGNATURES
|
||||||
}) return true
|
}) return true
|
||||||
|
|
||||||
if ((signature(owner, jvmDescriptor) in MUTABLE_METHOD_SIGNATURES) xor isMutable) return true
|
if ((SignatureBuildingComponents.signature(owner, jvmDescriptor) in MUTABLE_METHOD_SIGNATURES) xor isMutable) return true
|
||||||
|
|
||||||
return DFS.ifAny<CallableMemberDescriptor>(
|
return DFS.ifAny<CallableMemberDescriptor>(
|
||||||
listOf(this),
|
listOf(this),
|
||||||
@@ -164,8 +164,6 @@ open class JvmBuiltInsAdditionalClassPartsProvider(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun signature(javaClassDescriptor: ClassDescriptor, jvmDescriptor: String) = javaClassDescriptor.internalName + "." + jvmDescriptor
|
|
||||||
|
|
||||||
private fun ClassDescriptor.getJavaAnalogue(): LazyJavaClassDescriptor? {
|
private fun ClassDescriptor.getJavaAnalogue(): LazyJavaClassDescriptor? {
|
||||||
// Prevents recursive dependency: memberScope(Any) -> memberScope(Object) -> memberScope(Any)
|
// Prevents recursive dependency: memberScope(Any) -> memberScope(Object) -> memberScope(Any)
|
||||||
// No additional members should be added to Any
|
// No additional members should be added to Any
|
||||||
@@ -197,7 +195,7 @@ open class JvmBuiltInsAdditionalClassPartsProvider(
|
|||||||
defaultKotlinVersion.constructors.none { it.isEffectivelyTheSameAs(javaConstructor) } &&
|
defaultKotlinVersion.constructors.none { it.isEffectivelyTheSameAs(javaConstructor) } &&
|
||||||
!javaConstructor.isTrivialCopyConstructorFor(classDescriptor) &&
|
!javaConstructor.isTrivialCopyConstructorFor(classDescriptor) &&
|
||||||
!KotlinBuiltIns.isDeprecated(javaConstructor) &&
|
!KotlinBuiltIns.isDeprecated(javaConstructor) &&
|
||||||
signature(javaAnalogueDescriptor, javaConstructor.computeJvmDescriptor()) !in BLACK_LIST_CONSTRUCTOR_SIGNATURES
|
SignatureBuildingComponents.signature(javaAnalogueDescriptor, javaConstructor.computeJvmDescriptor()) !in BLACK_LIST_CONSTRUCTOR_SIGNATURES
|
||||||
}.map {
|
}.map {
|
||||||
javaConstructor ->
|
javaConstructor ->
|
||||||
javaConstructor.newCopyBuilder().apply {
|
javaConstructor.newCopyBuilder().apply {
|
||||||
@@ -230,6 +228,7 @@ open class JvmBuiltInsAdditionalClassPartsProvider(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val BLACK_LIST_METHOD_SIGNATURES: Set<String> =
|
private val BLACK_LIST_METHOD_SIGNATURES: Set<String> =
|
||||||
|
signatures {
|
||||||
buildPrimitiveValueMethodsSet() +
|
buildPrimitiveValueMethodsSet() +
|
||||||
|
|
||||||
"java/lang/annotation/Annotation.annotationType()${javaLang("Class").t}" +
|
"java/lang/annotation/Annotation.annotationType()${javaLang("Class").t}" +
|
||||||
@@ -261,17 +260,21 @@ open class JvmBuiltInsAdditionalClassPartsProvider(
|
|||||||
inJavaLang("Float", "isInfinite()Z", "isNaN()Z") +
|
inJavaLang("Float", "isInfinite()Z", "isNaN()Z") +
|
||||||
|
|
||||||
inJavaUtil("Collection", "toArray([$objectType)[$objectType", "toArray()[$objectType")
|
inJavaUtil("Collection", "toArray([$objectType)[$objectType", "toArray()[$objectType")
|
||||||
|
}
|
||||||
|
|
||||||
private fun buildPrimitiveValueMethodsSet(): Set<String> =
|
private fun buildPrimitiveValueMethodsSet(): Set<String> =
|
||||||
|
signatures {
|
||||||
JvmPrimitiveType.values().flatMapTo(LinkedHashSet()) {
|
JvmPrimitiveType.values().flatMapTo(LinkedHashSet()) {
|
||||||
inJavaLang(it.wrapperFqName.shortName().asString(), "${it.javaKeywordName}Value()${it.desc}")
|
inJavaLang(it.wrapperFqName.shortName().asString(), "${it.javaKeywordName}Value()${it.desc}")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private val MUTABLE_METHOD_SIGNATURES: Set<String> =
|
private val MUTABLE_METHOD_SIGNATURES: Set<String> =
|
||||||
|
signatures {
|
||||||
inJavaUtil("Collection", "removeIf(Ljava/util/function/Predicate;)Z") +
|
inJavaUtil("Collection", "removeIf(Ljava/util/function/Predicate;)Z") +
|
||||||
|
|
||||||
inJavaUtil("List",
|
inJavaUtil("List",
|
||||||
"sort(Ljava/util/Comparator;)V", "replaceAll(Ljava/util/function/UnaryOperator;)V") +
|
"sort(Ljava/util/Comparator;)V", "replaceAll(Ljava/util/function/UnaryOperator;)V") +
|
||||||
|
|
||||||
inJavaUtil("Map",
|
inJavaUtil("Map",
|
||||||
"computeIfAbsent(${objectType}Ljava/util/function/Function;)$objectType",
|
"computeIfAbsent(${objectType}Ljava/util/function/Function;)$objectType",
|
||||||
@@ -282,8 +285,10 @@ open class JvmBuiltInsAdditionalClassPartsProvider(
|
|||||||
"remove($objectType$objectType)Z", "replaceAll(Ljava/util/function/BiFunction;)V",
|
"remove($objectType$objectType)Z", "replaceAll(Ljava/util/function/BiFunction;)V",
|
||||||
"replace($objectType$objectType)$objectType",
|
"replace($objectType$objectType)$objectType",
|
||||||
"replace($objectType$objectType$objectType)Z")
|
"replace($objectType$objectType$objectType)Z")
|
||||||
|
}
|
||||||
|
|
||||||
private val BLACK_LIST_CONSTRUCTOR_SIGNATURES: Set<String> =
|
private val BLACK_LIST_CONSTRUCTOR_SIGNATURES: Set<String> =
|
||||||
|
signatures {
|
||||||
buildPrimitiveStringConstructorsSet() +
|
buildPrimitiveStringConstructorsSet() +
|
||||||
inJavaLang("Float", *constructors("D")) +
|
inJavaLang("Float", *constructors("D")) +
|
||||||
inJavaLang("String", *constructors(
|
inJavaLang("String", *constructors(
|
||||||
@@ -295,28 +300,15 @@ open class JvmBuiltInsAdditionalClassPartsProvider(
|
|||||||
"Ljava/lang/StringBuffer;",
|
"Ljava/lang/StringBuffer;",
|
||||||
"Ljava/lang/StringBuilder;"
|
"Ljava/lang/StringBuilder;"
|
||||||
))
|
))
|
||||||
|
}
|
||||||
|
|
||||||
private fun buildPrimitiveStringConstructorsSet(): Set<String> =
|
private fun buildPrimitiveStringConstructorsSet(): Set<String> =
|
||||||
|
signatures {
|
||||||
JvmPrimitiveType.values().flatMapTo(LinkedHashSet()) {
|
JvmPrimitiveType.values().flatMapTo(LinkedHashSet()) {
|
||||||
inJavaLang(it.wrapperFqName.shortName().asString(), *constructors(stringType))
|
inJavaLang(it.wrapperFqName.shortName().asString(), *constructors(stringType))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val ClassDescriptor.isAny: Boolean get() = fqNameUnsafe == KotlinBuiltIns.FQ_NAMES.any
|
private val ClassDescriptor.isAny: Boolean get() = fqNameUnsafe == KotlinBuiltIns.FQ_NAMES.any
|
||||||
|
|
||||||
private val String.t: String
|
|
||||||
get() = "L$this;"
|
|
||||||
|
|
||||||
private val stringType = javaLang("String").t
|
|
||||||
private val objectType = javaLang("Object").t
|
|
||||||
|
|
||||||
private fun javaLang(name: String) = "java/lang/$name"
|
|
||||||
private fun javaUtil(name: String) = "java/util/$name"
|
|
||||||
|
|
||||||
private fun constructors(vararg signatures: String) = signatures.map { "<init>($it)V" }.toTypedArray()
|
|
||||||
|
|
||||||
private fun inJavaLang(name: String, vararg signatures: String) = inClass(javaLang(name), *signatures)
|
|
||||||
private fun inJavaUtil(name: String, vararg signatures: String) = inClass(javaUtil(name), *signatures)
|
|
||||||
|
|
||||||
private fun inClass(internalName: String, vararg signatures: String) = signatures.mapTo(LinkedHashSet()) { internalName + "." + it }
|
|
||||||
|
|||||||
+44
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2016 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.load.kotlin
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
fun <T> signatures(block: SignatureBuildingComponents.() -> T) = with(SignatureBuildingComponents, block)
|
||||||
|
|
||||||
|
object SignatureBuildingComponents {
|
||||||
|
|
||||||
|
val stringType = javaLang("String").t
|
||||||
|
val objectType = javaLang("Object").t
|
||||||
|
|
||||||
|
val String.t: String
|
||||||
|
get() = "L$this;"
|
||||||
|
|
||||||
|
fun javaLang(name: String) = "java/lang/$name"
|
||||||
|
fun javaUtil(name: String) = "java/util/$name"
|
||||||
|
|
||||||
|
fun constructors(vararg signatures: String) = signatures.map { "<init>($it)V" }.toTypedArray()
|
||||||
|
|
||||||
|
fun inJavaLang(name: String, vararg signatures: String) = inClass(javaLang(name), *signatures)
|
||||||
|
fun inJavaUtil(name: String, vararg signatures: String) = inClass(javaUtil(name), *signatures)
|
||||||
|
|
||||||
|
fun inClass(internalName: String, vararg signatures: String) = signatures.mapTo(LinkedHashSet()) { internalName + "." + it }
|
||||||
|
|
||||||
|
fun signature(classDescriptor: ClassDescriptor, jvmDescriptor: String) = signature(classDescriptor.internalName, jvmDescriptor)
|
||||||
|
fun signature(internalName: String, jvmDescriptor: String) = internalName + "." + jvmDescriptor
|
||||||
|
}
|
||||||
+6
@@ -20,6 +20,8 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
|||||||
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
|
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
|
import org.jetbrains.kotlin.platform.JavaToKotlinClassMap
|
||||||
|
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||||
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType
|
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
@@ -46,6 +48,10 @@ fun FunctionDescriptor.computeJvmDescriptor()
|
|||||||
|
|
||||||
val ClassDescriptor.internalName: String
|
val ClassDescriptor.internalName: String
|
||||||
get() {
|
get() {
|
||||||
|
JavaToKotlinClassMap.INSTANCE.mapKotlinToJava(fqNameSafe.toUnsafe())?.let {
|
||||||
|
return JvmClassName.byClassId(it).internalName
|
||||||
|
}
|
||||||
|
|
||||||
return computeInternalName(this)
|
return computeInternalName(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user