Add MutableMap.remove(K, V) as built-in declaration
Use PlatformDependent annotation to guarantee it's only be available for JDK8 Also adjust type-safe bridges and mutable collection stubs generation
This commit is contained in:
@@ -19,14 +19,16 @@ package org.jetbrains.kotlin.codegen
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.DECLARATION
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.FAKE_OVERRIDE
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature.getSpecialSignatureInfo
|
||||
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature.isBuiltinWithSpecialDescriptorInJvm
|
||||
import org.jetbrains.kotlin.load.java.isFromBuiltins
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.NonReportingOverrideStrategy
|
||||
import org.jetbrains.kotlin.resolve.OverrideResolver
|
||||
import org.jetbrains.kotlin.resolve.OverridingStrategy
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.overriddenTreeUniqueAsSequence
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodGenericSignature
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
||||
@@ -80,7 +82,7 @@ class CollectionStubMethodGenerator(
|
||||
// Bind fake overrides and for each fake override originated from the MutableCollection, save its signature to generate a stub
|
||||
// or save its descriptor to generate all the needed bridges
|
||||
for (method in findFakeOverridesForMethodsFromMutableCollection(child, mutableClass)) {
|
||||
if (method.modality == Modality.ABSTRACT) {
|
||||
if (method.modality == Modality.ABSTRACT || isDefaultInJdk(method)) {
|
||||
// If the fake override is abstract and it's _declared_ as abstract in the class, skip it because the method is already
|
||||
// present in the bytecode (abstract) and we don't want a duplicate signature error
|
||||
if (method.findOverriddenFromDirectSuperClass(descriptor)?.kind == DECLARATION) continue
|
||||
@@ -149,6 +151,12 @@ class CollectionStubMethodGenerator(
|
||||
}
|
||||
}
|
||||
|
||||
private fun isDefaultInJdk(method: FunctionDescriptor) =
|
||||
method.modality != Modality.ABSTRACT &&
|
||||
method.original.overriddenTreeUniqueAsSequence(useOriginal = true).all {
|
||||
(it as FunctionDescriptor).kind == FAKE_OVERRIDE || it.isFromBuiltins()
|
||||
}
|
||||
|
||||
private data class CollectionClassPair(
|
||||
val readOnlyClass: ClassDescriptor,
|
||||
val mutableClass: ClassDescriptor
|
||||
|
||||
@@ -344,7 +344,7 @@ public class FunctionCodegen {
|
||||
KotlinTypeMapper typeMapper = parentCodegen.typeMapper;
|
||||
if (BuiltinSpecialBridgesUtil.shouldHaveTypeSafeBarrier(functionDescriptor, getSignatureMapper(typeMapper))) {
|
||||
generateTypeCheckBarrierIfNeeded(
|
||||
new InstructionAdapter(mv), functionDescriptor, signature.getReturnType(), /* delegateParameterType = */null);
|
||||
new InstructionAdapter(mv), functionDescriptor, signature.getReturnType(), /* delegateParameterTypes = */null);
|
||||
}
|
||||
|
||||
Label methodEnd;
|
||||
@@ -890,8 +890,8 @@ public class FunctionCodegen {
|
||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||
MemberCodegen.markLineNumberForDescriptor(owner.getThisDescriptor(), iv);
|
||||
|
||||
if (delegateTo.getArgumentTypes().length == 1 && isSpecialBridge) {
|
||||
generateTypeCheckBarrierIfNeeded(iv, descriptor, bridge.getReturnType(), delegateTo.getArgumentTypes()[0]);
|
||||
if (delegateTo.getArgumentTypes().length > 0 && isSpecialBridge) {
|
||||
generateTypeCheckBarrierIfNeeded(iv, descriptor, bridge.getReturnType(), delegateTo.getArgumentTypes());
|
||||
}
|
||||
|
||||
iv.load(0, OBJECT_TYPE);
|
||||
@@ -921,37 +921,42 @@ public class FunctionCodegen {
|
||||
@NotNull InstructionAdapter iv,
|
||||
@NotNull FunctionDescriptor descriptor,
|
||||
@NotNull Type returnType,
|
||||
@Nullable final Type delegateParameterType
|
||||
@Nullable Type[] delegateParameterTypes
|
||||
) {
|
||||
BuiltinMethodsWithSpecialGenericSignature.DefaultValue defaultValue =
|
||||
BuiltinMethodsWithSpecialGenericSignature.getDefaultValueForOverriddenBuiltinFunction(descriptor);
|
||||
if (defaultValue == null) return;
|
||||
|
||||
assert descriptor.getValueParameters().size() == 1 : "Should be descriptor with one value parameter, but found: " + descriptor;
|
||||
Label defaultBranch = new Label();
|
||||
|
||||
boolean isCheckForAny = delegateParameterType == null || OBJECT_TYPE.equals(delegateParameterType);
|
||||
for (int i = 0; i < descriptor.getValueParameters().size(); i++) {
|
||||
boolean isCheckForAny = delegateParameterTypes == null || OBJECT_TYPE.equals(delegateParameterTypes[i]);
|
||||
|
||||
final KotlinType kotlinType = descriptor.getValueParameters().get(0).getType();
|
||||
KotlinType kotlinType = descriptor.getValueParameters().get(i).getType();
|
||||
|
||||
if (isCheckForAny && TypeUtils.isNullableType(kotlinType)) return;
|
||||
if (isCheckForAny && TypeUtils.isNullableType(kotlinType)) continue;
|
||||
|
||||
iv.load(1, OBJECT_TYPE);
|
||||
iv.load(1 + i, OBJECT_TYPE);
|
||||
|
||||
Label afterBarrier = new Label();
|
||||
|
||||
if (isCheckForAny) {
|
||||
assert !TypeUtils.isNullableType(kotlinType) : "Only bridges for not-nullable types are necessary";
|
||||
iv.ifnonnull(afterBarrier);
|
||||
}
|
||||
else {
|
||||
CodegenUtilKt.generateIsCheck(iv, kotlinType, boxType(delegateParameterType));
|
||||
iv.ifne(afterBarrier);
|
||||
if (isCheckForAny) {
|
||||
assert !TypeUtils.isNullableType(kotlinType) : "Only bridges for not-nullable types are necessary";
|
||||
iv.ifnull(defaultBranch);
|
||||
}
|
||||
else {
|
||||
CodegenUtilKt.generateIsCheck(iv, kotlinType, boxType(delegateParameterTypes[i]));
|
||||
iv.ifeq(defaultBranch);
|
||||
}
|
||||
}
|
||||
|
||||
Label afterDefaultBranch = new Label();
|
||||
|
||||
iv.goTo(afterDefaultBranch);
|
||||
|
||||
iv.visitLabel(defaultBranch);
|
||||
StackValue.constant(defaultValue.getValue(), returnType).put(returnType, iv);
|
||||
iv.areturn(returnType);
|
||||
|
||||
iv.visitLabel(afterBarrier);
|
||||
iv.visitLabel(afterDefaultBranch);
|
||||
}
|
||||
|
||||
public void genSamDelegate(@NotNull FunctionDescriptor functionDescriptor, FunctionDescriptor overriddenDescriptor, StackValue field) {
|
||||
|
||||
@@ -192,6 +192,7 @@ public interface MutableMap</*0*/ K, /*1*/ V> : kotlin.collections.Map<K, V> {
|
||||
public abstract fun put(/*0*/ key: K, /*1*/ value: V): V?
|
||||
public abstract fun putAll(/*0*/ from: kotlin.collections.Map<out K, V>): kotlin.Unit
|
||||
public abstract fun remove(/*0*/ key: K): V?
|
||||
@kotlin.internal.PlatformDependent() public open fun remove(/*0*/ key: K, /*1*/ value: V): kotlin.Boolean
|
||||
|
||||
public interface MutableEntry</*0*/ K, /*1*/ V> : kotlin.collections.Map.Entry<K, V> {
|
||||
public abstract override /*1*/ /*fake_override*/ val key: K
|
||||
|
||||
@@ -235,7 +235,7 @@ public interface MutableMap</*0*/ K, /*1*/ V> : kotlin.collections.Map<K, V> {
|
||||
public abstract fun putAll(/*0*/ from: kotlin.collections.Map<out K, V>): kotlin.Unit
|
||||
public open fun putIfAbsent(/*0*/ p0: K!, /*1*/ p1: V!): V!
|
||||
public abstract fun remove(/*0*/ key: K): V?
|
||||
public open fun remove(/*0*/ p0: kotlin.Any!, /*1*/ p1: kotlin.Any!): kotlin.Boolean
|
||||
@kotlin.internal.PlatformDependent() public open fun remove(/*0*/ key: K, /*1*/ value: V): kotlin.Boolean
|
||||
public open fun replace(/*0*/ p0: K!, /*1*/ p1: V!): V!
|
||||
public open fun replace(/*0*/ p0: K!, /*1*/ p1: V!, /*2*/ p2: V!): kotlin.Boolean
|
||||
public open fun replaceAll(/*0*/ p0: java.util.function.BiFunction<in K!, in V!, out V!>!): kotlin.Unit
|
||||
|
||||
Vendored
+2
-2
@@ -7,5 +7,5 @@ abstract class A8 : MutableCollection<Any> {
|
||||
// 1 bridge
|
||||
// 1 public final bridge size
|
||||
// 0 INSTANCEOF
|
||||
/* Only 1 IFNONNULL should be within contains method */
|
||||
// 1 IFNONNULL
|
||||
/* Only 1 IFNULL should be within contains method */
|
||||
// 1 IFNULL
|
||||
|
||||
Vendored
+2
-2
@@ -7,5 +7,5 @@ abstract class A<T : Any> : MutableCollection<T> {
|
||||
// 1 bridge
|
||||
// 1 public final bridge size
|
||||
// 0 INSTANCEOF
|
||||
/* Only 1 IFNONNULL should be within contains method (because T is not nullable) */
|
||||
// 1 IFNONNULL
|
||||
/* Only 1 IFNULL should be within contains method (because T is not nullable) */
|
||||
// 1 IFNULL
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
// FULL_JDK
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: A.java
|
||||
public class A {
|
||||
public static void foo(java.util.Map<String, String> x) {
|
||||
x.remove("abc", "cde");
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
class ReadOnlyMap<K, V>(val x: K, val y: V) : Map<K, V> {
|
||||
override val entries: Set<Map.Entry<K, V>>
|
||||
get() = throw UnsupportedOperationException()
|
||||
override val keys: Set<K>
|
||||
get() = throw UnsupportedOperationException()
|
||||
override val size: Int
|
||||
get() = throw UnsupportedOperationException()
|
||||
override val values: Collection<V>
|
||||
get() = throw UnsupportedOperationException()
|
||||
|
||||
override fun containsKey(key: K) = key == x
|
||||
|
||||
override fun containsValue(value: V) = value == y
|
||||
|
||||
override fun get(key: K): V? = if (key == x) y else null
|
||||
|
||||
override fun isEmpty() = false
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
A.foo(ReadOnlyMap("abc", "cde"))
|
||||
return "fail 1"
|
||||
} catch (e: UnsupportedOperationException) { }
|
||||
|
||||
try {
|
||||
// Default Map 'remove' implenetation actually does remove iff entry exists
|
||||
A.foo(ReadOnlyMap("abc", "123"))
|
||||
return "fail 2"
|
||||
} catch (e: UnsupportedOperationException) { }
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// FULL_JDK
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A : MutableMap<String, String> {
|
||||
override val entries: MutableSet<MutableMap.MutableEntry<String, String>>
|
||||
get() = throw UnsupportedOperationException()
|
||||
override val keys: MutableSet<String>
|
||||
get() = throw UnsupportedOperationException()
|
||||
override val values: MutableCollection<String>
|
||||
get() = throw UnsupportedOperationException()
|
||||
|
||||
override fun clear() {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun put(key: String, value: String): String? {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun putAll(from: Map<out String, String>) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun remove(key: String): String? {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override val size: Int
|
||||
get() = throw UnsupportedOperationException()
|
||||
|
||||
override fun containsKey(key: String): Boolean {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun containsValue(value: String): Boolean {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun get(key: String): String? {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun isEmpty(): Boolean {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun remove(key: String, value: String): Boolean {
|
||||
val h = key.hashCode() + value.hashCode()
|
||||
if (h != ("abc".hashCode() + "cde".hashCode())) return false
|
||||
return key == "abc" && value == "cde"
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val a = A()
|
||||
if (!a.remove("abc", "cde")) return "fail 1"
|
||||
if (a.remove("abc", "123")) return "fail 2"
|
||||
|
||||
val mm = a as MutableMap<Any?, Any?>
|
||||
if (!a.remove("abc", "cde")) return "fail 3"
|
||||
if (a.remove("abc", "123")) return "fail 4"
|
||||
if (a.remove(1, "cde")) return "fail 5"
|
||||
if (a.remove(null, "cde")) return "fail 6"
|
||||
if (a.remove("abc", null)) return "fail 7"
|
||||
if (a.remove(null, null)) return "fail 7"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// FULL_JDK
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A : MutableMap<Any, Any> {
|
||||
override val entries: MutableSet<MutableMap.MutableEntry<Any, Any>>
|
||||
get() = throw UnsupportedOperationException()
|
||||
override val keys: MutableSet<Any>
|
||||
get() = throw UnsupportedOperationException()
|
||||
override val values: MutableCollection<Any>
|
||||
get() = throw UnsupportedOperationException()
|
||||
|
||||
override fun clear() {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun put(key: Any, value: Any): Any? {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun putAll(from: Map<out Any, Any>) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun remove(key: Any): Any? {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override val size: Int
|
||||
get() = throw UnsupportedOperationException()
|
||||
|
||||
override fun containsKey(key: Any): Boolean {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun containsValue(value: Any): Boolean {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun get(key: Any): Any? {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun isEmpty(): Boolean {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun remove(key: Any, value: Any): Boolean {
|
||||
val h = key.hashCode() + value.hashCode()
|
||||
if (h != ("abc".hashCode() + "cde".hashCode())) return false
|
||||
return key == "abc" && value == "cde"
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val a = A()
|
||||
if (!a.remove("abc", "cde")) return "fail 1"
|
||||
if (a.remove("abc", "123")) return "fail 2"
|
||||
|
||||
val mm = a as MutableMap<Any?, Any?>
|
||||
if (!a.remove("abc", "cde")) return "fail 3"
|
||||
if (a.remove("abc", "123")) return "fail 4"
|
||||
if (a.remove(1, "cde")) return "fail 5"
|
||||
if (a.remove(null, "cde")) return "fail 6"
|
||||
if (a.remove("abc", null)) return "fail 7"
|
||||
if (a.remove(null, null)) return "fail 7"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
class KotlinMap1<K, V> : java.util.AbstractMap<K, V>() {
|
||||
override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
|
||||
get() = throw UnsupportedOperationException()
|
||||
|
||||
override fun remove(x: K, y: V) = true
|
||||
}
|
||||
|
||||
// method: KotlinMap1::remove
|
||||
// jvm signature: (Ljava/lang/Object;Ljava/lang/Object;)Z
|
||||
// generic signature: null
|
||||
|
||||
class KotlinMap2 : java.util.AbstractMap<String, Int>() {
|
||||
override val entries: MutableSet<MutableMap.MutableEntry<String, Int>>
|
||||
get() = throw UnsupportedOperationException()
|
||||
|
||||
override fun remove(x: String, y: Int) = true
|
||||
}
|
||||
|
||||
// method: KotlinMap2::remove
|
||||
// jvm signature: (Ljava/lang/Object;Ljava/lang/Object;)Z
|
||||
// generic signature: null
|
||||
|
||||
// method: KotlinMap2::remove
|
||||
// jvm signature: (Ljava/lang/String;Ljava/lang/Integer;)Z
|
||||
// generic signature: null
|
||||
+4
-5
@@ -4,17 +4,16 @@ val concurrent: ConcurrentMap<String, Int> = null!!
|
||||
val concurrentHash: ConcurrentHashMap<String, Int> = null!!
|
||||
|
||||
fun foo() {
|
||||
// TODO: Too permissive
|
||||
concurrent.remove("", 1)
|
||||
concurrent.remove("", "")
|
||||
concurrent.remove("", <!TYPE_MISMATCH!>""<!>)
|
||||
concurrentHash.remove("", 1)
|
||||
concurrentHash.remove("", "")
|
||||
concurrentHash.remove("", <!TYPE_MISMATCH!>""<!>)
|
||||
|
||||
// Flexible types
|
||||
concurrent.remove(null, 1)
|
||||
concurrent.remove(null, null)
|
||||
|
||||
// @PurelyImplements
|
||||
concurrentHash.remove(null, 1)
|
||||
concurrentHash.remove(null, null)
|
||||
concurrentHash.remove(<!NULL_FOR_NONNULL_TYPE!>null<!>, 1)
|
||||
concurrentHash.remove(<!NULL_FOR_NONNULL_TYPE!>null<!>, <!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -PARAMETER_NAME_CHANGED_ON_OVERRIDE
|
||||
|
||||
class KotlinMap1<K, V> : java.util.AbstractMap<K, V>() {
|
||||
override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
|
||||
get() = throw UnsupportedOperationException()
|
||||
|
||||
override fun remove(x: K, y: V) = true
|
||||
}
|
||||
|
||||
class KotlinMap2 : java.util.AbstractMap<String, Int>() {
|
||||
override val entries: MutableSet<MutableMap.MutableEntry<String, Int>>
|
||||
get() = throw UnsupportedOperationException()
|
||||
|
||||
override fun remove(x: String, y: Int) = true
|
||||
}
|
||||
|
||||
fun foo(x: MutableMap<String, Int>, y: java.util.HashMap<String, Int>, z: java.util.AbstractMap<String, Int>) {
|
||||
x.remove("", 1)
|
||||
x.remove("", <!TYPE_MISMATCH!>""<!>)
|
||||
x.remove("", <!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
|
||||
y.remove("", 1)
|
||||
y.remove("", <!TYPE_MISMATCH!>""<!>)
|
||||
y.remove("", <!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
|
||||
z.remove("", 1)
|
||||
z.remove("", <!TYPE_MISMATCH!>""<!>)
|
||||
z.remove("", null)
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ x: kotlin.collections.MutableMap<kotlin.String, kotlin.Int>, /*1*/ y: java.util.HashMap<kotlin.String, kotlin.Int>, /*2*/ z: java.util.AbstractMap<kotlin.String, kotlin.Int>): kotlin.Unit
|
||||
|
||||
public final class KotlinMap1</*0*/ K, /*1*/ V> : java.util.AbstractMap<K, V> {
|
||||
public constructor KotlinMap1</*0*/ K, /*1*/ V>()
|
||||
public open override /*1*/ val entries: kotlin.collections.MutableSet<kotlin.collections.MutableMap.MutableEntry<K, V>>
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var keySet: kotlin.collections.(Mutable)Set<K!>!
|
||||
public open override /*1*/ /*fake_override*/ val keys: kotlin.collections.MutableSet<K!>
|
||||
public open override /*1*/ /*fake_override*/ val size: kotlin.Int
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var values: kotlin.collections.(Mutable)Collection<V!>!
|
||||
public open override /*1*/ /*fake_override*/ val values: kotlin.collections.MutableCollection<V!>
|
||||
public open override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit
|
||||
protected/*protected and package*/ open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any!
|
||||
public open override /*1*/ /*fake_override*/ fun compute(/*0*/ p0: K!, /*1*/ p1: java.util.function.BiFunction<in K!, in V!, out V!>!): V!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfAbsent(/*0*/ p0: K!, /*1*/ p1: java.util.function.Function<in K!, out V!>!): V!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfPresent(/*0*/ p0: K!, /*1*/ p1: java.util.function.BiFunction<in K!, in V!, out V!>!): V!
|
||||
public open override /*1*/ /*fake_override*/ fun containsKey(/*0*/ key: K!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun containsValue(/*0*/ value: V!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun forEach(/*0*/ p0: java.util.function.BiConsumer<in K!, in V!>!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun get(/*0*/ key: K!): V?
|
||||
public open override /*1*/ /*fake_override*/ fun getOrDefault(/*0*/ p0: kotlin.Any!, /*1*/ p1: V!): V!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun merge(/*0*/ p0: K!, /*1*/ p1: V!, /*2*/ p2: java.util.function.BiFunction<in V!, in V!, out V!>!): V!
|
||||
public open override /*1*/ /*fake_override*/ fun put(/*0*/ key: K!, /*1*/ value: V!): V?
|
||||
public open override /*1*/ /*fake_override*/ fun putAll(/*0*/ from: kotlin.collections.Map<out K!, V!>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun putIfAbsent(/*0*/ p0: K!, /*1*/ p1: V!): V!
|
||||
public open override /*1*/ fun remove(/*0*/ x: K, /*1*/ y: V): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun remove(/*0*/ key: K!): V?
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: K!, /*1*/ p1: V!): V!
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: K!, /*1*/ p1: V!, /*2*/ p2: V!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun replaceAll(/*0*/ p0: java.util.function.BiFunction<in K!, in V!, out V!>!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class KotlinMap2 : java.util.AbstractMap<kotlin.String, kotlin.Int> {
|
||||
public constructor KotlinMap2()
|
||||
public open override /*1*/ val entries: kotlin.collections.MutableSet<kotlin.collections.MutableMap.MutableEntry<kotlin.String, kotlin.Int>>
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var keySet: kotlin.collections.(Mutable)Set<kotlin.String!>!
|
||||
public open override /*1*/ /*fake_override*/ val keys: kotlin.collections.MutableSet<kotlin.String!>
|
||||
public open override /*1*/ /*fake_override*/ val size: kotlin.Int
|
||||
invisible_fake final override /*1*/ /*fake_override*/ var values: kotlin.collections.(Mutable)Collection<kotlin.Int!>!
|
||||
public open override /*1*/ /*fake_override*/ val values: kotlin.collections.MutableCollection<kotlin.Int!>
|
||||
public open override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit
|
||||
protected/*protected and package*/ open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any!
|
||||
public open override /*1*/ /*fake_override*/ fun compute(/*0*/ p0: kotlin.String!, /*1*/ p1: java.util.function.BiFunction<in kotlin.String!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfAbsent(/*0*/ p0: kotlin.String!, /*1*/ p1: java.util.function.Function<in kotlin.String!, out kotlin.Int!>!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfPresent(/*0*/ p0: kotlin.String!, /*1*/ p1: java.util.function.BiFunction<in kotlin.String!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun containsKey(/*0*/ key: kotlin.String!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun containsValue(/*0*/ value: kotlin.Int!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun forEach(/*0*/ p0: java.util.function.BiConsumer<in kotlin.String!, in kotlin.Int!>!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun get(/*0*/ key: kotlin.String!): kotlin.Int?
|
||||
public open override /*1*/ /*fake_override*/ fun getOrDefault(/*0*/ p0: kotlin.Any!, /*1*/ p1: kotlin.Int!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun merge(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!, /*2*/ p2: java.util.function.BiFunction<in kotlin.Int!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun put(/*0*/ key: kotlin.String!, /*1*/ value: kotlin.Int!): kotlin.Int?
|
||||
public open override /*1*/ /*fake_override*/ fun putAll(/*0*/ from: kotlin.collections.Map<out kotlin.String!, kotlin.Int!>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun putIfAbsent(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!): kotlin.Int!
|
||||
public open override /*1*/ fun remove(/*0*/ x: kotlin.String, /*1*/ y: kotlin.Int): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun remove(/*0*/ key: kotlin.String!): kotlin.Int?
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!, /*2*/ p2: kotlin.Int!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun replaceAll(/*0*/ p0: java.util.function.BiFunction<in kotlin.String!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package test;
|
||||
import java.util.Map;
|
||||
public class MapRemove {
|
||||
public abstract class MyMap<K, V> implements Map<K, V> {
|
||||
public boolean remove(Object x, Object y) { return false; }
|
||||
}
|
||||
|
||||
public abstract class MyMapString implements Map<String, Integer> {
|
||||
public boolean remove(Object x, Object y) { return false; }
|
||||
}
|
||||
|
||||
public abstract class MyMapStringInvalid implements Map<String, Integer> {
|
||||
public boolean remove(String x, Integer y) { return false; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package test
|
||||
|
||||
public open class MapRemove {
|
||||
public constructor MapRemove()
|
||||
|
||||
public abstract inner class MyMap</*0*/ K : kotlin.Any!, /*1*/ V : kotlin.Any!> : kotlin.collections.MutableMap<K!, V!> {
|
||||
public constructor MyMap</*0*/ K : kotlin.Any!, /*1*/ V : kotlin.Any!>()
|
||||
public abstract override /*1*/ /*fake_override*/ val entries: kotlin.collections.MutableSet<kotlin.collections.MutableMap.MutableEntry<K!, V!>>
|
||||
public abstract override /*1*/ /*fake_override*/ val keys: kotlin.collections.MutableSet<K!>
|
||||
public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ val values: kotlin.collections.MutableCollection<V!>
|
||||
public abstract override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun compute(/*0*/ p0: K!, /*1*/ p1: java.util.function.BiFunction<in K!, in V!, out V!>!): V!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfAbsent(/*0*/ p0: K!, /*1*/ p1: java.util.function.Function<in K!, out V!>!): V!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfPresent(/*0*/ p0: K!, /*1*/ p1: java.util.function.BiFunction<in K!, in V!, out V!>!): V!
|
||||
public abstract override /*1*/ /*fake_override*/ fun containsKey(/*0*/ key: K!): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun containsValue(/*0*/ value: V!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun forEach(/*0*/ p0: java.util.function.BiConsumer<in K!, in V!>!): kotlin.Unit
|
||||
public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ key: K!): V?
|
||||
public open override /*1*/ /*fake_override*/ fun getOrDefault(/*0*/ p0: kotlin.Any!, /*1*/ p1: V!): V!
|
||||
public abstract override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun merge(/*0*/ p0: K!, /*1*/ p1: V!, /*2*/ p2: java.util.function.BiFunction<in V!, in V!, out V!>!): V!
|
||||
public abstract override /*1*/ /*fake_override*/ fun put(/*0*/ key: K!, /*1*/ value: V!): V?
|
||||
public abstract override /*1*/ /*fake_override*/ fun putAll(/*0*/ from: kotlin.collections.Map<out K!, V!>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun putIfAbsent(/*0*/ p0: K!, /*1*/ p1: V!): V!
|
||||
public abstract override /*1*/ /*fake_override*/ fun remove(/*0*/ key: K!): V?
|
||||
public open override /*1*/ fun remove(/*0*/ key: K!, /*1*/ value: V!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: K!, /*1*/ p1: V!): V!
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: K!, /*1*/ p1: V!, /*2*/ p2: V!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun replaceAll(/*0*/ p0: java.util.function.BiFunction<in K!, in V!, out V!>!): kotlin.Unit
|
||||
}
|
||||
|
||||
public abstract inner class MyMapString : kotlin.collections.MutableMap<kotlin.String!, kotlin.Int!> {
|
||||
public constructor MyMapString()
|
||||
public abstract override /*1*/ /*fake_override*/ val entries: kotlin.collections.MutableSet<kotlin.collections.MutableMap.MutableEntry<kotlin.String!, kotlin.Int!>>
|
||||
public abstract override /*1*/ /*fake_override*/ val keys: kotlin.collections.MutableSet<kotlin.String!>
|
||||
public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ val values: kotlin.collections.MutableCollection<kotlin.Int!>
|
||||
public abstract override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun compute(/*0*/ p0: kotlin.String!, /*1*/ p1: java.util.function.BiFunction<in kotlin.String!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfAbsent(/*0*/ p0: kotlin.String!, /*1*/ p1: java.util.function.Function<in kotlin.String!, out kotlin.Int!>!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfPresent(/*0*/ p0: kotlin.String!, /*1*/ p1: java.util.function.BiFunction<in kotlin.String!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun containsKey(/*0*/ key: kotlin.String!): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun containsValue(/*0*/ value: kotlin.Int!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun forEach(/*0*/ p0: java.util.function.BiConsumer<in kotlin.String!, in kotlin.Int!>!): kotlin.Unit
|
||||
public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ key: kotlin.String!): kotlin.Int?
|
||||
public open override /*1*/ /*fake_override*/ fun getOrDefault(/*0*/ p0: kotlin.Any!, /*1*/ p1: kotlin.Int!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun merge(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!, /*2*/ p2: java.util.function.BiFunction<in kotlin.Int!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun put(/*0*/ key: kotlin.String!, /*1*/ value: kotlin.Int!): kotlin.Int?
|
||||
public abstract override /*1*/ /*fake_override*/ fun putAll(/*0*/ from: kotlin.collections.Map<out kotlin.String!, kotlin.Int!>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun putIfAbsent(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun remove(/*0*/ key: kotlin.String!): kotlin.Int?
|
||||
public open override /*1*/ fun remove(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!, /*2*/ p2: kotlin.Int!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun replaceAll(/*0*/ p0: java.util.function.BiFunction<in kotlin.String!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Unit
|
||||
}
|
||||
|
||||
public abstract inner class MyMapStringInvalid : kotlin.collections.MutableMap<kotlin.String!, kotlin.Int!> {
|
||||
public constructor MyMapStringInvalid()
|
||||
public abstract override /*1*/ /*fake_override*/ val entries: kotlin.collections.MutableSet<kotlin.collections.MutableMap.MutableEntry<kotlin.String!, kotlin.Int!>>
|
||||
public abstract override /*1*/ /*fake_override*/ val keys: kotlin.collections.MutableSet<kotlin.String!>
|
||||
public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ val values: kotlin.collections.MutableCollection<kotlin.Int!>
|
||||
public abstract override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun compute(/*0*/ p0: kotlin.String!, /*1*/ p1: java.util.function.BiFunction<in kotlin.String!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfAbsent(/*0*/ p0: kotlin.String!, /*1*/ p1: java.util.function.Function<in kotlin.String!, out kotlin.Int!>!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfPresent(/*0*/ p0: kotlin.String!, /*1*/ p1: java.util.function.BiFunction<in kotlin.String!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun containsKey(/*0*/ key: kotlin.String!): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun containsValue(/*0*/ value: kotlin.Int!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun forEach(/*0*/ p0: java.util.function.BiConsumer<in kotlin.String!, in kotlin.Int!>!): kotlin.Unit
|
||||
public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ key: kotlin.String!): kotlin.Int?
|
||||
public open override /*1*/ /*fake_override*/ fun getOrDefault(/*0*/ p0: kotlin.Any!, /*1*/ p1: kotlin.Int!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun merge(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!, /*2*/ p2: java.util.function.BiFunction<in kotlin.Int!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun put(/*0*/ key: kotlin.String!, /*1*/ value: kotlin.Int!): kotlin.Int?
|
||||
public abstract override /*1*/ /*fake_override*/ fun putAll(/*0*/ from: kotlin.collections.Map<out kotlin.String!, kotlin.Int!>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun putIfAbsent(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun remove(/*0*/ key: kotlin.String!): kotlin.Int?
|
||||
public open fun remove(/*0*/ key: kotlin.String!, /*1*/ value: kotlin.Int!): kotlin.Boolean
|
||||
@kotlin.internal.PlatformDependent() public open override /*1*/ /*fake_override*/ /*isHiddenToOvercomeSignatureClash*/ fun remove(/*0*/ key: kotlin.String!, /*1*/ value: kotlin.Int!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!, /*2*/ p2: kotlin.Int!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun replaceAll(/*0*/ p0: java.util.function.BiFunction<in kotlin.String!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Unit
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package test;
|
||||
import java.util.Map;
|
||||
public class MapRemove {
|
||||
public abstract class MyMap<K, V> implements Map<K, V> {
|
||||
public boolean remove(Object x, Object y) { return false; }
|
||||
}
|
||||
|
||||
public abstract class MyMapString implements Map<String, Integer> {
|
||||
public boolean remove(Object x, Object y) { return false; }
|
||||
}
|
||||
|
||||
public abstract class MyMapStringInvalid implements Map<String, Integer> {
|
||||
public boolean remove(String x, Integer y) { return false; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package test
|
||||
|
||||
public open class MapRemove {
|
||||
public constructor MapRemove()
|
||||
|
||||
public abstract inner class MyMap</*0*/ K : kotlin.Any!, /*1*/ V : kotlin.Any!> : kotlin.collections.MutableMap<K!, V!> {
|
||||
public constructor MyMap</*0*/ K : kotlin.Any!, /*1*/ V : kotlin.Any!>()
|
||||
public abstract override /*1*/ /*fake_override*/ val entries: kotlin.collections.MutableSet<kotlin.collections.MutableMap.MutableEntry<K!, V!>>
|
||||
public abstract override /*1*/ /*fake_override*/ val keys: kotlin.collections.MutableSet<K!>
|
||||
public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ val values: kotlin.collections.MutableCollection<V!>
|
||||
public abstract override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun compute(/*0*/ p0: K!, /*1*/ p1: java.util.function.BiFunction<in K!, in V!, out V!>!): V!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfAbsent(/*0*/ p0: K!, /*1*/ p1: java.util.function.Function<in K!, out V!>!): V!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfPresent(/*0*/ p0: K!, /*1*/ p1: java.util.function.BiFunction<in K!, in V!, out V!>!): V!
|
||||
public abstract override /*1*/ /*fake_override*/ fun containsKey(/*0*/ key: K!): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun containsValue(/*0*/ value: V!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun forEach(/*0*/ p0: java.util.function.BiConsumer<in K!, in V!>!): kotlin.Unit
|
||||
public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ key: K!): V?
|
||||
public open override /*1*/ /*fake_override*/ fun getOrDefault(/*0*/ p0: kotlin.Any!, /*1*/ p1: V!): V!
|
||||
public abstract override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun merge(/*0*/ p0: K!, /*1*/ p1: V!, /*2*/ p2: java.util.function.BiFunction<in V!, in V!, out V!>!): V!
|
||||
public abstract override /*1*/ /*fake_override*/ fun put(/*0*/ key: K!, /*1*/ value: V!): V?
|
||||
public abstract override /*1*/ /*fake_override*/ fun putAll(/*0*/ from: kotlin.collections.Map<out K!, V!>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun putIfAbsent(/*0*/ p0: K!, /*1*/ p1: V!): V!
|
||||
public abstract override /*1*/ /*fake_override*/ fun remove(/*0*/ key: K!): V?
|
||||
public open override /*1*/ fun remove(/*0*/ key: K!, /*1*/ value: V!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: K!, /*1*/ p1: V!): V!
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: K!, /*1*/ p1: V!, /*2*/ p2: V!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun replaceAll(/*0*/ p0: java.util.function.BiFunction<in K!, in V!, out V!>!): kotlin.Unit
|
||||
}
|
||||
|
||||
public abstract inner class MyMapString : kotlin.collections.MutableMap<kotlin.String!, kotlin.Int!> {
|
||||
public constructor MyMapString()
|
||||
public abstract override /*1*/ /*fake_override*/ val entries: kotlin.collections.MutableSet<kotlin.collections.MutableMap.MutableEntry<kotlin.String!, kotlin.Int!>>
|
||||
public abstract override /*1*/ /*fake_override*/ val keys: kotlin.collections.MutableSet<kotlin.String!>
|
||||
public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ val values: kotlin.collections.MutableCollection<kotlin.Int!>
|
||||
public abstract override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun compute(/*0*/ p0: kotlin.String!, /*1*/ p1: java.util.function.BiFunction<in kotlin.String!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfAbsent(/*0*/ p0: kotlin.String!, /*1*/ p1: java.util.function.Function<in kotlin.String!, out kotlin.Int!>!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfPresent(/*0*/ p0: kotlin.String!, /*1*/ p1: java.util.function.BiFunction<in kotlin.String!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun containsKey(/*0*/ key: kotlin.String!): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun containsValue(/*0*/ value: kotlin.Int!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun forEach(/*0*/ p0: java.util.function.BiConsumer<in kotlin.String!, in kotlin.Int!>!): kotlin.Unit
|
||||
public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ key: kotlin.String!): kotlin.Int?
|
||||
public open override /*1*/ /*fake_override*/ fun getOrDefault(/*0*/ p0: kotlin.Any!, /*1*/ p1: kotlin.Int!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun merge(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!, /*2*/ p2: java.util.function.BiFunction<in kotlin.Int!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun put(/*0*/ key: kotlin.String!, /*1*/ value: kotlin.Int!): kotlin.Int?
|
||||
public abstract override /*1*/ /*fake_override*/ fun putAll(/*0*/ from: kotlin.collections.Map<out kotlin.String!, kotlin.Int!>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun putIfAbsent(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun remove(/*0*/ key: kotlin.String!): kotlin.Int?
|
||||
public open override /*1*/ fun remove(/*0*/ x: kotlin.String!, /*1*/ y: kotlin.Int!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!, /*2*/ p2: kotlin.Int!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun replaceAll(/*0*/ p0: java.util.function.BiFunction<in kotlin.String!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Unit
|
||||
}
|
||||
|
||||
public abstract inner class MyMapStringInvalid : kotlin.collections.MutableMap<kotlin.String!, kotlin.Int!> {
|
||||
public constructor MyMapStringInvalid()
|
||||
public abstract override /*1*/ /*fake_override*/ val entries: kotlin.collections.MutableSet<kotlin.collections.MutableMap.MutableEntry<kotlin.String!, kotlin.Int!>>
|
||||
public abstract override /*1*/ /*fake_override*/ val keys: kotlin.collections.MutableSet<kotlin.String!>
|
||||
public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ val values: kotlin.collections.MutableCollection<kotlin.Int!>
|
||||
public abstract override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun compute(/*0*/ p0: kotlin.String!, /*1*/ p1: java.util.function.BiFunction<in kotlin.String!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfAbsent(/*0*/ p0: kotlin.String!, /*1*/ p1: java.util.function.Function<in kotlin.String!, out kotlin.Int!>!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun computeIfPresent(/*0*/ p0: kotlin.String!, /*1*/ p1: java.util.function.BiFunction<in kotlin.String!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun containsKey(/*0*/ key: kotlin.String!): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun containsValue(/*0*/ value: kotlin.Int!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun forEach(/*0*/ p0: java.util.function.BiConsumer<in kotlin.String!, in kotlin.Int!>!): kotlin.Unit
|
||||
public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ key: kotlin.String!): kotlin.Int?
|
||||
public open override /*1*/ /*fake_override*/ fun getOrDefault(/*0*/ p0: kotlin.Any!, /*1*/ p1: kotlin.Int!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun merge(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!, /*2*/ p2: java.util.function.BiFunction<in kotlin.Int!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun put(/*0*/ key: kotlin.String!, /*1*/ value: kotlin.Int!): kotlin.Int?
|
||||
public abstract override /*1*/ /*fake_override*/ fun putAll(/*0*/ from: kotlin.collections.Map<out kotlin.String!, kotlin.Int!>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun putIfAbsent(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!): kotlin.Int!
|
||||
public abstract override /*1*/ /*fake_override*/ fun remove(/*0*/ key: kotlin.String!): kotlin.Int?
|
||||
public open fun remove(/*0*/ key: kotlin.String!, /*1*/ value: kotlin.Int!): kotlin.Boolean
|
||||
@kotlin.internal.PlatformDependent() public open override /*1*/ /*fake_override*/ /*isHiddenToOvercomeSignatureClash*/ fun remove(/*0*/ key: kotlin.String!, /*1*/ value: kotlin.Int!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun replace(/*0*/ p0: kotlin.String!, /*1*/ p1: kotlin.Int!, /*2*/ p2: kotlin.Int!): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun replaceAll(/*0*/ p0: java.util.function.BiFunction<in kotlin.String!, in kotlin.Int!, out kotlin.Int!>!): kotlin.Unit
|
||||
}
|
||||
}
|
||||
+6
@@ -133,6 +133,12 @@ public class DiagnosticsWithJava8TestGenerated extends AbstractDiagnosticsWithFu
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("mutableMapRemove.kt")
|
||||
public void testMutableMapRemove() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns/mutableMapRemove.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("removeIf.kt")
|
||||
public void testRemoveIf() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns/removeIf.kt");
|
||||
|
||||
+27
@@ -107,6 +107,33 @@ public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodeg
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/java8/box/mapRemove")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class MapRemove extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInMapRemove() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/box/mapRemove"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("readOnlyMap.kt")
|
||||
public void testReadOnlyMap() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/mapRemove/readOnlyMap.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typeSafeBridge.kt")
|
||||
public void testTypeSafeBridge() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/mapRemove/typeSafeBridge.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typeSafeBridgeNotNullAny.kt")
|
||||
public void testTypeSafeBridgeNotNullAny() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/mapRemove/typeSafeBridgeNotNullAny.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/java8/box/reflection")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.jvm.compiler
|
||||
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
|
||||
abstract class AbstractJava8WriteSignatureTest : AbstractWriteSignatureTest() {
|
||||
override val jdkKind: TestJdkKind
|
||||
get() = TestJdkKind.FULL_JDK
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.jvm.compiler;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/codegen/java8/writeSignature")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class Java8WriteSignatureTestGenerated extends AbstractJava8WriteSignatureTest {
|
||||
public void testAllFilesPresentInWriteSignature() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/writeSignature"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("mutableMapRemove.kt")
|
||||
public void testMutableMapRemove() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/writeSignature/mutableMapRemove.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
+12
@@ -37,6 +37,12 @@ public class LoadJava8TestGenerated extends AbstractLoadJava8Test {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava8/compiledJava"), Pattern.compile("^(.+)\\.java$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("MapRemove.java")
|
||||
public void testMapRemove() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/MapRemove.java");
|
||||
doTestCompiledJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeAnnotations.java")
|
||||
public void testTypeAnnotations() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/TypeAnnotations.java");
|
||||
@@ -58,6 +64,12 @@ public class LoadJava8TestGenerated extends AbstractLoadJava8Test {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava8/sourceJava"), Pattern.compile("^(.+)\\.java$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("MapRemove.java")
|
||||
public void testMapRemove() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/sourceJava/MapRemove.java");
|
||||
doTestSourceJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeAnnotations.java")
|
||||
public void testTypeAnnotations() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/sourceJava/TypeAnnotations.java");
|
||||
|
||||
+6
@@ -35,6 +35,12 @@ public class Jvm8RuntimeDescriptorLoaderTestGenerated extends AbstractJvm8Runtim
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava8/compiledJava"), Pattern.compile("^(.+)\\.java$"), true, "sam", "kotlinSignature/propagation");
|
||||
}
|
||||
|
||||
@TestMetadata("MapRemove.java")
|
||||
public void testMapRemove() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/MapRemove.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeAnnotations.java")
|
||||
public void testTypeAnnotations() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/TypeAnnotations.java");
|
||||
|
||||
+4
-4
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.descriptors.resolveClassByFqName
|
||||
import org.jetbrains.kotlin.frontend.java.di.createContainerForTopDownAnalyzerForJvm
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmBuiltInsAdditionalClassPartsProvider
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmBuiltInsSettings
|
||||
import org.jetbrains.kotlin.load.kotlin.computeJvmDescriptor
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.platform.JvmBuiltIns
|
||||
@@ -61,9 +61,9 @@ class AdditionalBuiltInsMembersSignatureListsTest : KotlinTestWithEnvironment()
|
||||
emptyModule.setDependencies(emptyModule)
|
||||
|
||||
val blackList =
|
||||
JvmBuiltInsAdditionalClassPartsProvider.BLACK_LIST_METHOD_SIGNATURES +
|
||||
JvmBuiltInsAdditionalClassPartsProvider.MUTABLE_METHOD_SIGNATURES +
|
||||
JvmBuiltInsAdditionalClassPartsProvider.BLACK_LIST_CONSTRUCTOR_SIGNATURES
|
||||
JvmBuiltInsSettings.BLACK_LIST_METHOD_SIGNATURES +
|
||||
JvmBuiltInsSettings.MUTABLE_METHOD_SIGNATURES +
|
||||
JvmBuiltInsSettings.BLACK_LIST_CONSTRUCTOR_SIGNATURES
|
||||
|
||||
val groupedByInternalName = blackList.groupBy({ it.split(".")[0] }) { it.split(".")[1] }
|
||||
|
||||
|
||||
@@ -23,8 +23,11 @@ import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.kotlin.cli.common.output.outputUtils.writeAllTo
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.codegen.GenerationUtils
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TestCaseWithTmpdir
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import org.jetbrains.kotlin.utils.sure
|
||||
import org.jetbrains.org.objectweb.asm.*
|
||||
import org.junit.Assert
|
||||
import java.io.File
|
||||
@@ -39,9 +42,14 @@ abstract class AbstractWriteSignatureTest : TestCaseWithTmpdir() {
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
jetCoreEnvironment = KotlinTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(myTestRootDisposable)
|
||||
jetCoreEnvironment =
|
||||
KotlinTestUtils.createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(
|
||||
myTestRootDisposable, ConfigurationKind.ALL, jdkKind)
|
||||
}
|
||||
|
||||
protected open val jdkKind: TestJdkKind
|
||||
get() = TestJdkKind.MOCK_JDK
|
||||
|
||||
override fun tearDown() {
|
||||
jetCoreEnvironment = null
|
||||
super.tearDown()
|
||||
@@ -64,19 +72,35 @@ abstract class AbstractWriteSignatureTest : TestCaseWithTmpdir() {
|
||||
}
|
||||
|
||||
private class SignatureExpectation(val header: String, val name: String, val expectedJvmSignature: String?, expectedGenericSignature: String) {
|
||||
private var checked = false
|
||||
private val expectedSignature = formatSignature(header, expectedJvmSignature, expectedGenericSignature)
|
||||
private val expectedFormattedSignature = formatSignature(header, expectedJvmSignature, expectedGenericSignature)
|
||||
private val jvmDescriptorToFormattedSignature = mutableMapOf<String, String>()
|
||||
|
||||
fun isChecked(): Boolean = checked
|
||||
|
||||
fun check(name: String, actualJvmSignature: String, actualGenericSignature: String) {
|
||||
fun accept(name: String, actualJvmSignature: String, actualGenericSignature: String) {
|
||||
if (this.name == name) {
|
||||
checked = true
|
||||
val actualSignature = formatSignature(header, expectedJvmSignature?.let { actualJvmSignature }, actualGenericSignature)
|
||||
Assert.assertEquals(expectedSignature, actualSignature)
|
||||
Assert.assertFalse(jvmDescriptorToFormattedSignature.containsKey(actualJvmSignature))
|
||||
|
||||
jvmDescriptorToFormattedSignature[actualJvmSignature] =
|
||||
formatSignature(header, expectedJvmSignature?.let { actualJvmSignature }, actualGenericSignature)
|
||||
}
|
||||
}
|
||||
|
||||
fun check() {
|
||||
val formattedActualSignature =
|
||||
if (expectedJvmSignature == null) {
|
||||
Assert.assertTrue(
|
||||
"Expected single declaration, but ${jvmDescriptorToFormattedSignature.keys} found",
|
||||
jvmDescriptorToFormattedSignature.size == 1)
|
||||
|
||||
jvmDescriptorToFormattedSignature.values.single()
|
||||
}
|
||||
else {
|
||||
jvmDescriptorToFormattedSignature[expectedJvmSignature].sure {
|
||||
"Expected $expectedJvmSignature but only ${jvmDescriptorToFormattedSignature.keys} found for $name"
|
||||
}
|
||||
}
|
||||
|
||||
Assert.assertEquals(expectedFormattedSignature, formattedActualSignature)
|
||||
}
|
||||
}
|
||||
|
||||
private inner class PackageExpectationsSuite() {
|
||||
@@ -102,17 +126,17 @@ abstract class AbstractWriteSignatureTest : TestCaseWithTmpdir() {
|
||||
val classFileName = "$tmpdir/${className.replace('.', '/')}.class"
|
||||
val classFile = File(classFileName)
|
||||
|
||||
checkClassFile(checker, classFile)
|
||||
processClassFile(checker, classFile)
|
||||
|
||||
if (className.endsWith("Package")) {
|
||||
// This class is a package facade. We should also check package parts.
|
||||
checkPackageParts(checker, classFile)
|
||||
processPackageParts(checker, classFile)
|
||||
}
|
||||
|
||||
assertAllChecked()
|
||||
checkCollectedSignatures()
|
||||
}
|
||||
|
||||
private fun checkPackageParts(checker: Checker, classFile: File) {
|
||||
private fun processPackageParts(checker: Checker, classFile: File) {
|
||||
// Look for package parts in the same directory.
|
||||
// Package part file names for package SomePackage look like SomePackage$<hash>.class.
|
||||
val classDir = classFile.parentFile
|
||||
@@ -121,21 +145,15 @@ abstract class AbstractWriteSignatureTest : TestCaseWithTmpdir() {
|
||||
classDir.listFiles { dir, lastName ->
|
||||
lastName.startsWith(packageFacadePrefix) && lastName.endsWith(".class")
|
||||
}.forEach { packageFacadeFile ->
|
||||
checkClassFile(checker, packageFacadeFile)
|
||||
processClassFile(checker, packageFacadeFile)
|
||||
}
|
||||
}
|
||||
|
||||
private fun assertAllChecked() {
|
||||
val uncheckedExpectations = ArrayList<SignatureExpectation>()
|
||||
classExpectations.filterNotTo(uncheckedExpectations) { it.isChecked() }
|
||||
methodExpectations.filterNotTo(uncheckedExpectations) { it.isChecked() }
|
||||
fieldExpectations.filterNotTo(uncheckedExpectations) { it.isChecked() }
|
||||
Assert.assertTrue(
|
||||
"Unchecked expectations (${uncheckedExpectations.size} total):\n " + uncheckedExpectations.joinToString("\n "),
|
||||
uncheckedExpectations.isEmpty())
|
||||
private fun checkCollectedSignatures() {
|
||||
(classExpectations + methodExpectations + fieldExpectations).forEach(SignatureExpectation::check)
|
||||
}
|
||||
|
||||
private fun checkClassFile(checker: Checker, classFile: File) {
|
||||
private fun processClassFile(checker: Checker, classFile: File) {
|
||||
val classInputStream = FileInputStream(classFile)
|
||||
try {
|
||||
ClassReader(classInputStream).accept(checker,
|
||||
@@ -148,17 +166,17 @@ abstract class AbstractWriteSignatureTest : TestCaseWithTmpdir() {
|
||||
|
||||
private inner class Checker : ClassVisitor(Opcodes.ASM5) {
|
||||
override fun visit(version: Int, access: Int, name: String, signature: String?, superName: String?, interfaces: Array<out String>?) {
|
||||
classExpectations.forEach { it.check(name, name, signature ?: "null") }
|
||||
classExpectations.forEach { it.accept(name, name, signature ?: "null") }
|
||||
super.visit(version, access, name, signature, superName, interfaces)
|
||||
}
|
||||
|
||||
override fun visitMethod(access: Int, name: String, desc: String, signature: String?, exceptions: Array<out String>?): MethodVisitor? {
|
||||
methodExpectations.forEach { it.check(name, desc, signature ?: "null") }
|
||||
methodExpectations.forEach { it.accept(name, desc, signature ?: "null") }
|
||||
return super.visitMethod(access, name, desc, signature, exceptions)
|
||||
}
|
||||
|
||||
override fun visitField(access: Int, name: String, desc: String, signature: String?, value: Any?): FieldVisitor? {
|
||||
fieldExpectations.forEach { it.check(name, desc, signature ?: "null") }
|
||||
fieldExpectations.forEach { it.accept(name, desc, signature ?: "null") }
|
||||
return super.visitField(access, name, desc, signature, value)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||
import org.jetbrains.kotlin.jvm.compiler.LoadDescriptorUtil.TEST_PACKAGE_FQNAME
|
||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||
import org.jetbrains.kotlin.serialization.deserialization.ClassDescriptorFactory
|
||||
import org.jetbrains.kotlin.serialization.deserialization.PlatformDependentDeclarationFilter
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TestCaseWithTmpdir
|
||||
@@ -43,7 +44,8 @@ class BuiltInsSerializerTest : TestCaseWithTmpdir() {
|
||||
val module = KotlinTestUtils.createEmptyModule("<module>", platform, DefaultBuiltIns.Instance)
|
||||
|
||||
val packageFragmentProvider = createBuiltInPackageFragmentProvider(
|
||||
LockBasedStorageManager(), module, setOf(TEST_PACKAGE_FQNAME), ClassDescriptorFactory.EMPTY
|
||||
LockBasedStorageManager(), module, setOf(TEST_PACKAGE_FQNAME), ClassDescriptorFactory.EMPTY,
|
||||
PlatformDependentDeclarationFilter.All
|
||||
) {
|
||||
val file = File(tmpdir, it)
|
||||
if (file.exists()) FileInputStream(file) else null
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.jetbrains.kotlin.renderer.OverrideRenderingPolicy;
|
||||
import org.jetbrains.kotlin.resolve.lazy.LazyResolveTestUtil;
|
||||
import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyPackageDescriptor;
|
||||
import org.jetbrains.kotlin.serialization.deserialization.AdditionalClassPartsProvider;
|
||||
import org.jetbrains.kotlin.serialization.deserialization.PlatformDependentDeclarationFilter;
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
@@ -112,6 +113,7 @@ public class LoadBuiltinsTest extends KotlinTestWithEnvironment {
|
||||
PackageFragmentProvider packageFragmentProvider = createBuiltInPackageFragmentProvider(
|
||||
storageManager, builtInsModule, BUILT_INS_PACKAGE_FQ_NAMES,
|
||||
new BuiltInFictitiousFunctionClassFactory(storageManager, builtInsModule),
|
||||
PlatformDependentDeclarationFilter.All.INSTANCE,
|
||||
AdditionalClassPartsProvider.None.INSTANCE,
|
||||
new Function1<String, InputStream>() {
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package kotlin.collections
|
||||
|
||||
import kotlin.internal.PlatformDependent
|
||||
|
||||
/**
|
||||
* Classes that inherit from this interface can be represented as a sequence of elements that can
|
||||
* be iterated over.
|
||||
@@ -350,6 +352,17 @@ public interface MutableMap<K, V> : Map<K, V> {
|
||||
*/
|
||||
public fun remove(key: K): V?
|
||||
|
||||
/**
|
||||
* Removes the entry for the specified key only if it is mapped to the specified value.
|
||||
*
|
||||
* @return true if entry was removed
|
||||
*/
|
||||
@PlatformDependent
|
||||
public fun remove(key: K, value: V): Boolean {
|
||||
// See default implementation in JDK sources
|
||||
return true
|
||||
}
|
||||
|
||||
// Bulk Modification Operations
|
||||
/**
|
||||
* Updates this map with key/value pairs from the specified map [from].
|
||||
|
||||
@@ -23,3 +23,13 @@ package kotlin.internal
|
||||
@Target(AnnotationTarget.TYPE_PARAMETER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
internal annotation class PureReifiable
|
||||
|
||||
/**
|
||||
* Specifies that the corresponding built-in method exists depending on platform.
|
||||
* Current implementation for JVM looks whether method with same JVM descriptor exists in the module JDK.
|
||||
* For example MutableMap.remove(K, V) available only if corresponding
|
||||
* method 'java/util/Map.remove(Ljava/lang/Object;Ljava/lang/Object;)Z' is defined in JDK (i.e. for major versions >= 8)
|
||||
*/
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
internal annotation class PlatformDependent
|
||||
|
||||
+3
@@ -112,6 +112,9 @@ object BuiltinMethodsWithSpecialGenericSignature {
|
||||
.method("containsKey", "Ljava/lang/Object;", JvmPrimitiveType.BOOLEAN.desc) to DefaultValue.FALSE,
|
||||
javaUtil("Map")
|
||||
.method("containsValue", "Ljava/lang/Object;", JvmPrimitiveType.BOOLEAN.desc) to DefaultValue.FALSE,
|
||||
javaUtil("Map")
|
||||
.method("remove", "Ljava/lang/Object;Ljava/lang/Object;",
|
||||
JvmPrimitiveType.BOOLEAN.desc) to DefaultValue.FALSE,
|
||||
|
||||
javaUtil("Map")
|
||||
.method("get", "Ljava/lang/Object;", "Ljava/lang/Object;") to DefaultValue.NULL,
|
||||
|
||||
+3
-1
@@ -39,11 +39,13 @@ class DeserializationComponentsForJava(
|
||||
|
||||
init {
|
||||
val localClassResolver = LocalClassResolverImpl()
|
||||
val settings = JvmBuiltInsSettings(moduleDescriptor, { moduleDescriptor })
|
||||
components = DeserializationComponents(
|
||||
storageManager, moduleDescriptor, classDataFinder, annotationAndConstantLoader, packageFragmentProvider, localClassResolver,
|
||||
errorReporter, lookupTracker, FlexibleJavaClassifierTypeFactory, ClassDescriptorFactory.EMPTY,
|
||||
notFoundClasses, JavaTypeCapabilitiesLoader,
|
||||
additionalClassPartsProvider = JvmBuiltInsAdditionalClassPartsProvider(moduleDescriptor, { moduleDescriptor })
|
||||
additionalClassPartsProvider = settings,
|
||||
platformDependentDeclarationFilter = settings
|
||||
)
|
||||
localClassResolver.setDeserializationComponents(components)
|
||||
}
|
||||
|
||||
+33
-5
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.load.kotlin
|
||||
|
||||
import org.jetbrains.kotlin.builtins.DefaultBuiltIns
|
||||
import org.jetbrains.kotlin.builtins.BuiltInsInitializer
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorImpl
|
||||
@@ -35,7 +35,10 @@ import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType
|
||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.serialization.deserialization.AdditionalClassPartsProvider
|
||||
import org.jetbrains.kotlin.serialization.deserialization.PLATFORM_DEPENDENT_ANNOTATION_FQ_NAME
|
||||
import org.jetbrains.kotlin.serialization.deserialization.PlatformDependentDeclarationFilter
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||
import org.jetbrains.kotlin.types.DelegatingType
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.utils.DFS
|
||||
@@ -44,10 +47,10 @@ import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
import java.io.Serializable
|
||||
import java.util.*
|
||||
|
||||
open class JvmBuiltInsAdditionalClassPartsProvider(
|
||||
open class JvmBuiltInsSettings(
|
||||
private val moduleDescriptor: ModuleDescriptor,
|
||||
deferredOwnerModuleDescriptor: () -> ModuleDescriptor
|
||||
) : AdditionalClassPartsProvider {
|
||||
) : AdditionalClassPartsProvider, PlatformDependentDeclarationFilter {
|
||||
private val j2kClassMap = JavaToKotlinClassMap.INSTANCE
|
||||
|
||||
private val ownerModuleDescriptor: ModuleDescriptor by lazy(deferredOwnerModuleDescriptor)
|
||||
@@ -107,7 +110,7 @@ open class JvmBuiltInsAdditionalClassPartsProvider(
|
||||
): Collection<SimpleFunctionDescriptor> {
|
||||
val javaAnalogueDescriptor = classDescriptor.getJavaAnalogue() ?: return emptyList()
|
||||
|
||||
val kotlinClassDescriptors = j2kClassMap.mapPlatformClass(javaAnalogueDescriptor.fqNameSafe, DefaultBuiltIns.Instance)
|
||||
val kotlinClassDescriptors = j2kClassMap.mapPlatformClass(javaAnalogueDescriptor.fqNameSafe, FallbackBuiltIns.Instance)
|
||||
val kotlinMutableClassIfContainer = kotlinClassDescriptors.lastOrNull() ?: return emptyList()
|
||||
val kotlinVersions = SmartSet.create(kotlinClassDescriptors.map { it.fqNameSafe })
|
||||
|
||||
@@ -181,7 +184,7 @@ open class JvmBuiltInsAdditionalClassPartsProvider(
|
||||
val javaAnalogueDescriptor = classDescriptor.getJavaAnalogue() ?: return emptyList()
|
||||
|
||||
val defaultKotlinVersion =
|
||||
j2kClassMap.mapJavaToKotlin(javaAnalogueDescriptor.fqNameSafe, DefaultBuiltIns.Instance) ?: return emptyList()
|
||||
j2kClassMap.mapJavaToKotlin(javaAnalogueDescriptor.fqNameSafe, FallbackBuiltIns.Instance) ?: return emptyList()
|
||||
|
||||
val substitutor = createMappedTypeParametersSubstitution(defaultKotlinVersion, javaAnalogueDescriptor).buildSubstitutor()
|
||||
|
||||
@@ -207,6 +210,17 @@ open class JvmBuiltInsAdditionalClassPartsProvider(
|
||||
}
|
||||
}
|
||||
|
||||
override fun isFunctionAvailable(classDescriptor: DeserializedClassDescriptor, functionDescriptor: SimpleFunctionDescriptor): Boolean {
|
||||
if (!functionDescriptor.annotations.hasAnnotation(PLATFORM_DEPENDENT_ANNOTATION_FQ_NAME)) return true
|
||||
val javaAnalogueClassDescriptor = classDescriptor.getJavaAnalogue() ?: return true
|
||||
|
||||
val jvmDescriptor = functionDescriptor.computeJvmDescriptor()
|
||||
return javaAnalogueClassDescriptor
|
||||
.unsubstitutedMemberScope
|
||||
.getContributedFunctions(functionDescriptor.name, NoLookupLocation.FROM_BUILTINS)
|
||||
.any { it.computeJvmDescriptor() == jvmDescriptor }
|
||||
}
|
||||
|
||||
private fun ConstructorDescriptor.isTrivialCopyConstructorFor(classDescriptor: DeserializedClassDescriptor): Boolean
|
||||
= valueParameters.size == 1 &&
|
||||
valueParameters.single().type.constructor.declarationDescriptor?.fqNameUnsafe == classDescriptor.fqNameUnsafe
|
||||
@@ -318,3 +332,17 @@ open class JvmBuiltInsAdditionalClassPartsProvider(
|
||||
}
|
||||
|
||||
private val ClassDescriptor.isAny: Boolean get() = fqNameUnsafe == KotlinBuiltIns.FQ_NAMES.any
|
||||
|
||||
private class FallbackBuiltIns private constructor() : KotlinBuiltIns(LockBasedStorageManager()) {
|
||||
companion object {
|
||||
private val initializer = BuiltInsInitializer {
|
||||
FallbackBuiltIns()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
val Instance: KotlinBuiltIns
|
||||
get() = initializer.get()
|
||||
}
|
||||
|
||||
override fun getPlatformDependentDeclarationFilter() = PlatformDependentDeclarationFilter.All
|
||||
}
|
||||
@@ -18,8 +18,9 @@ package org.jetbrains.kotlin.platform
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmBuiltInsAdditionalClassPartsProvider
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmBuiltInsSettings
|
||||
import org.jetbrains.kotlin.serialization.deserialization.AdditionalClassPartsProvider
|
||||
import org.jetbrains.kotlin.serialization.deserialization.PlatformDependentDeclarationFilter
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
import org.jetbrains.kotlin.utils.sure
|
||||
|
||||
@@ -32,9 +33,17 @@ class JvmBuiltIns(storageManager: StorageManager) : KotlinBuiltIns(storageManage
|
||||
this.ownerModuleDescriptor = moduleDescriptor
|
||||
}
|
||||
|
||||
override fun getAdditionalClassPartsProvider(): AdditionalClassPartsProvider {
|
||||
return JvmBuiltInsAdditionalClassPartsProvider(builtInsModule, {
|
||||
ownerModuleDescriptor.sure { "JvmBuiltins has not been initialized properly" }
|
||||
})
|
||||
private lateinit var settings: JvmBuiltInsSettings
|
||||
|
||||
// Here we know order in which KotlinBuiltIns constructor calls these methods
|
||||
override fun getPlatformDependentDeclarationFilter(): PlatformDependentDeclarationFilter {
|
||||
settings = JvmBuiltInsSettings(
|
||||
builtInsModule,
|
||||
{ ownerModuleDescriptor.sure { "JvmBuiltins has not been initialized properly" } }
|
||||
)
|
||||
|
||||
return settings
|
||||
}
|
||||
|
||||
override fun getAdditionalClassPartsProvider() = settings
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
|
||||
import org.jetbrains.kotlin.serialization.deserialization.AdditionalClassPartsProvider;
|
||||
import org.jetbrains.kotlin.serialization.deserialization.PlatformDependentDeclarationFilter;
|
||||
import org.jetbrains.kotlin.storage.StorageManager;
|
||||
import org.jetbrains.kotlin.types.*;
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
|
||||
@@ -82,6 +83,7 @@ public abstract class KotlinBuiltIns {
|
||||
PackageFragmentProvider packageFragmentProvider = BuiltInsPackageFragmentProviderKt.createBuiltInPackageFragmentProvider(
|
||||
storageManager, builtInsModule, BUILT_INS_PACKAGE_FQ_NAMES,
|
||||
new BuiltInFictitiousFunctionClassFactory(storageManager, builtInsModule),
|
||||
getPlatformDependentDeclarationFilter(),
|
||||
getAdditionalClassPartsProvider(),
|
||||
new Function1<String, InputStream>() {
|
||||
@Override
|
||||
@@ -116,6 +118,11 @@ public abstract class KotlinBuiltIns {
|
||||
return AdditionalClassPartsProvider.None.INSTANCE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected PlatformDependentDeclarationFilter getPlatformDependentDeclarationFilter() {
|
||||
return PlatformDependentDeclarationFilter.NoPlatformDependent.INSTANCE;
|
||||
}
|
||||
|
||||
private void makePrimitive(@NotNull PrimitiveType primitiveType) {
|
||||
KotlinType type = getBuiltInTypeByClassName(primitiveType.getTypeName().asString());
|
||||
KotlinType arrayType = getBuiltInTypeByClassName(primitiveType.getArrayTypeName().asString());
|
||||
|
||||
+3
-1
@@ -31,6 +31,7 @@ fun createBuiltInPackageFragmentProvider(
|
||||
module: ModuleDescriptor,
|
||||
packageFqNames: Set<FqName>,
|
||||
classDescriptorFactory: ClassDescriptorFactory,
|
||||
platformDependentDeclarationFilter: PlatformDependentDeclarationFilter,
|
||||
additionalClassPartsProvider: AdditionalClassPartsProvider = AdditionalClassPartsProvider.None,
|
||||
loadResource: (String) -> InputStream?
|
||||
): PackageFragmentProvider {
|
||||
@@ -54,7 +55,8 @@ fun createBuiltInPackageFragmentProvider(
|
||||
FlexibleTypeFactory.ThrowException,
|
||||
classDescriptorFactory,
|
||||
notFoundClasses,
|
||||
additionalClassPartsProvider = additionalClassPartsProvider
|
||||
additionalClassPartsProvider = additionalClassPartsProvider,
|
||||
platformDependentDeclarationFilter = platformDependentDeclarationFilter
|
||||
)
|
||||
|
||||
localClassResolver.setDeserializationComponents(components)
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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.serialization.deserialization
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
||||
|
||||
interface PlatformDependentDeclarationFilter {
|
||||
|
||||
fun isFunctionAvailable(classDescriptor: DeserializedClassDescriptor, functionDescriptor: SimpleFunctionDescriptor): Boolean
|
||||
|
||||
object All : PlatformDependentDeclarationFilter {
|
||||
override fun isFunctionAvailable(classDescriptor: DeserializedClassDescriptor, functionDescriptor: SimpleFunctionDescriptor) = true
|
||||
}
|
||||
|
||||
object NoPlatformDependent : PlatformDependentDeclarationFilter {
|
||||
override fun isFunctionAvailable(classDescriptor: DeserializedClassDescriptor, functionDescriptor: SimpleFunctionDescriptor) =
|
||||
!functionDescriptor.annotations.hasAnnotation(PLATFORM_DEPENDENT_ANNOTATION_FQ_NAME)
|
||||
}
|
||||
}
|
||||
|
||||
val PLATFORM_DEPENDENT_ANNOTATION_FQ_NAME = FqName("kotlin.internal.PlatformDependent")
|
||||
+2
-1
@@ -39,7 +39,8 @@ class DeserializationComponents(
|
||||
val fictitiousClassDescriptorFactory: ClassDescriptorFactory,
|
||||
val notFoundClasses: NotFoundClasses,
|
||||
val typeCapabilitiesLoader: TypeCapabilitiesLoader = TypeCapabilitiesLoader.NONE,
|
||||
val additionalClassPartsProvider: AdditionalClassPartsProvider = AdditionalClassPartsProvider.None
|
||||
val additionalClassPartsProvider: AdditionalClassPartsProvider = AdditionalClassPartsProvider.None,
|
||||
val platformDependentDeclarationFilter: PlatformDependentDeclarationFilter = PlatformDependentDeclarationFilter.All
|
||||
) {
|
||||
val classDeserializer: ClassDeserializer = ClassDeserializer(this)
|
||||
|
||||
|
||||
+4
@@ -201,6 +201,10 @@ class DeserializedClassDescriptor(
|
||||
fromSupertypes.addAll(supertype.memberScope.getContributedFunctions(name, NoLookupLocation.FOR_ALREADY_TRACKED))
|
||||
}
|
||||
|
||||
functions.retainAll {
|
||||
c.components.platformDependentDeclarationFilter.isFunctionAvailable(this@DeserializedClassDescriptor, it)
|
||||
}
|
||||
|
||||
functions.addAll(c.components.additionalClassPartsProvider.getFunctions(name, this@DeserializedClassDescriptor))
|
||||
generateFakeOverrides(name, fromSupertypes, functions)
|
||||
}
|
||||
|
||||
@@ -367,6 +367,10 @@ fun main(args: Array<String>) {
|
||||
testClass<AbstractCompileKotlinAgainstKotlinTest>() {
|
||||
model("compileKotlinAgainstKotlinJava8")
|
||||
}
|
||||
|
||||
testClass<AbstractJava8WriteSignatureTest>() {
|
||||
model("codegen/java8/writeSignature")
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("idea/tests", "idea/testData") {
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.idea.stubindex.KotlinSourceFilterScope
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelFunctionFqnNameIndex
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelPropertyFqnNameIndex
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmBuiltInsAdditionalClassPartsProvider
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmBuiltInsSettings
|
||||
import org.jetbrains.kotlin.psi.KtCallableDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
@@ -125,7 +125,7 @@ object ByDescriptorIndexer : DecompiledTextIndexer<String> {
|
||||
if (descriptor !is ClassDescriptor) return null
|
||||
|
||||
val classFqName = descriptor.fqNameSafe
|
||||
if (JvmBuiltInsAdditionalClassPartsProvider.isSerializableInJava(classFqName)) {
|
||||
if (JvmBuiltInsSettings.isSerializableInJava(classFqName)) {
|
||||
val builtInDescriptor = DefaultBuiltIns.Instance.builtInsModule.resolveTopLevelClass(classFqName, NoLookupLocation.FROM_IDE)
|
||||
return builtInDescriptor?.let { file.getDeclaration(this, it.toStringKey()) }
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<include name="src/kotlin/Range.kt"/>
|
||||
<include name="src/kotlin/FloatingPointConstants.kt"/>
|
||||
<include name="src/kotlin/IntegerConstants.kt"/>
|
||||
<include name="src/kotlin/internal/InternalAnnotations.kt"/>
|
||||
</fileset>
|
||||
|
||||
<union id="js.lib.files">
|
||||
|
||||
Reference in New Issue
Block a user