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:
Denis Zharkov
2016-04-28 09:09:25 +03:00
parent 55c4f875c8
commit d259b91143
41 changed files with 875 additions and 77 deletions
@@ -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");
@@ -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)
@@ -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
}
@@ -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);
}
}
@@ -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");
@@ -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");
@@ -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] }