Cleanup as36 patchset files (KTI-315)

This commit is contained in:
Yunir Salimzyanov
2020-08-13 18:59:30 +03:00
parent 0a9089bc72
commit 27b2e16141
57 changed files with 0 additions and 2245 deletions
@@ -1,45 +0,0 @@
class A {
fun someOther() = false
private fun formatElement(element: PsiElement): String {
var element = element
element = JetPsiUtil.ascendIfPropertyAccessor(element)
if (element is JetNamedFunction || element is JetProperty) {
val bindingContext =
AnalyzerFacadeWithCache.analyzeFileWithCache(element.getContainingJetFile())
.getBindingContext()
val declarationDescriptor =
bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, element)
if (declarationDescriptor is CallableMemberDescriptor) {
val containingDescriptor = declarationDescriptor.getContainingDeclaration()
if (containingDescriptor is ClassDescriptor) {
return JetBundle.message(
"override.declaration.x.in.y",
DescriptorRenderer.COMPACT.render(declarationDescriptor),
IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_NO_ANNOTATIONS.render(
containingDescriptor
)
)
}
}
}
assert(element is PsiMethod) { "Method accepts only kotlin functions/properties and java methods, but '" + element.getText() + "' was found" }
return JetRefactoringUtil.formatPsiMethod(element as PsiMethod, true, false)
}
protected fun getDimensionServiceKey(): String {
return "#org.jetbrains.kotlin.idea.refactoring.safeDelete.KotlinOverridingDialog"
}
fun getSelected(): ArrayList<UsageInfo> {
val result = ArrayList<UsageInfo>()
for (i in 0 until myChecked.length) {
if (myChecked[i]) {
result.add(myOverridingMethods.get(i))
}
}
return result
}
}
@@ -1,35 +0,0 @@
import test.ToBeImportedJava.staticMethod
import test.ToBeImportedJava.TO_BE_IMPORTED_CONST
import test.ToBeImportedJava
import test.ToBeImportedKotlin
import java.util.HashMap
import java.util.ArrayList
class Target {
var listOfPlatformType: List<String> = ArrayList()
var unresolved: UnresolvedInterface<UnresolvedGeneric> =
UnresolvedImplementation() // Should not add import
var hashMapOfNotImported: Map<ToBeImportedJava, ToBeImportedKotlin> = HashMap()
fun acceptKotlinClass(tbi: ToBeImportedKotlin) {
}
fun acceptJavaClass(tbi: ToBeImportedJava) {
}
var ambiguousKotlin: IAmbiguousKotlin =
AmbiguousKotlin() // Should not add import in case of 2 declarations in Kotlin
var ambiguous: IAmbiguous =
Ambiguous() // Should not add import in case of ambiguous declarations in Kotlin and in Java
var ambiguousJava: IAmbiguousJava =
AmbiguousJava() // Should not add import in case of 2 declarations in Java
fun workWithStatics() {
val a = TO_BE_IMPORTED_CONST
staticMethod()
}
}
@@ -1,7 +0,0 @@
import org.junit.Test
class <lineMarker descr="Run Test" settings="Nothing here">MyKotlinTest</lineMarker> {
@Test
fun <lineMarker descr="Run Test" settings="Nothing here">testA</lineMarker>() {
}
}
@@ -1,11 +0,0 @@
import org.junit.Test
class <lineMarker descr="Run Test" settings="Nothing here">MyKotlinTest</lineMarker> {
@Test
fun <lineMarker descr="Run Test" settings="Nothing here">testA</lineMarker>() {
}
@Test
fun <lineMarker descr="Run Test" settings="Nothing here">testB</lineMarker>() {
}
}
@@ -1,6 +0,0 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
val mapIndexedTo: MutableList<Int> = list.asSequence().filter { it > 1 }
.mapIndexedTo(mutableListOf()) { index, i -> i }
}
@@ -1,6 +0,0 @@
// WITH_RUNTIME
fun test() {
val pair: Pair<List<Int>, List<Int>> = listOf(1 to 2, 3 to 4).asSequence().filter { it.first > 1 }
.filter { it.second > 2 }.unzip()
}
@@ -1,9 +0,0 @@
class DefaultValueChain(
val x1: Int,
x2: Int = x1,
val x3: Int = x2,
x4: Int = x3,
val x5: Int = x4
) {
}
@@ -1,12 +0,0 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'firstOrNull{}'"
// IS_APPLICABLE_2: false
fun getFirstValue() = "value"
fun foo(list: List<String?>): String? {
val value = getFirstValue()
val found: String? =
list.firstOrNull { it != null && !it.startsWith("IMG:") && it.contains(value) }
return found
}
@@ -1,21 +0,0 @@
annotation class Ann1(val i: Int, val j: Int)
@Target(AnnotationTarget.PROPERTY)
annotation class Ann2(val i: Int, val j: Int)
@Target(AnnotationTarget.FIELD)
annotation class Ann3(val i: Int, val j: Int)
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FIELD, AnnotationTarget.PROPERTY)
annotation class Ann4(val i: Int, val j: Int)
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FIELD)
annotation class Ann5(val i: Int, val j: Int)
class Test(
@get:Ann1(0, 0) @property:Ann1(1, 11) @Ann2(2, 22) @Ann3(3, 33) @property:Ann4(
4,
44
) @field:Ann5(5, 55) val foo: String = ""
) {
}
@@ -1,11 +0,0 @@
annotation class Annotation1(val a: Int = 0)
annotation class Annotation2(val a: Int = 0)
annotation class Annotation3(val a: Int = 0)
class TestClass(
private @property:Annotation1(42) @field:Annotation2(42) @Annotation1(42) @Annotation3(
42
) val text: String = "LoremIpsum"
) {
}
@@ -1,5 +0,0 @@
// Ann: to be implemented
actual annotation class <caret>Ann actual constructor(
actual val x: Int,
actual val y: String
)
@@ -1,11 +0,0 @@
import org.jetbrains.annotations.NotNull;
import kotlin.properties.ReadOnlyProperty;
class J {
public static class Foo<T> implements ReadOnlyProperty<A<T>, B> {
public Foo(T t, @NotNull String s) {
}
}
}
@@ -1,10 +0,0 @@
// "Mark as @Deprecated(..., level = DeprecationLevel.HIDDEN)" "true"
import java.io.File
@Deprecated(
"Is replaced with automatic synthetic extension",
ReplaceWith("name"),
level = DeprecationLevel.HIDDEN
)
val File.<caret>name: String
get() = getName()
@@ -1,38 +0,0 @@
// WITH_RUNTIME
// SUGGESTED_NAMES: triple, getT
// PARAM_TYPES: kotlin.Int
// PARAM_TYPES: kotlin.Int
// PARAM_TYPES: kotlin.Int
// PARAM_DESCRIPTOR: value-parameter a: kotlin.Int defined in foo
// PARAM_DESCRIPTOR: var b: kotlin.Int defined in foo
// PARAM_DESCRIPTOR: var c: kotlin.Int defined in foo
// SIBLING:
fun foo(a: Int): Int {
var b: Int = 1
var c: Int = 2
val triple = triple(a, b, c)
b = triple.second
c = triple.third
val t = triple.first
println(b + c)
return t
}
private fun triple(
a: Int,
b: Int,
c: Int
): Triple<Int, Int, Int> {
var b1 = b
var c1 = c
val i = if (a > 0) {
b1 += a
c1 -= b1
b1
} else {
a
}
return Triple(i, b1, c1)
}
@@ -1,4 +0,0 @@
// WITH_RUNTIME
fun foo(list: List<String>, function: (String) -> Boolean = { it.length > 6 }) = list.filter(
function
)