required Kotlin version increased to M14, code updated for M15 compatibility

This commit is contained in:
Dmitry Jemerov
2015-10-15 09:19:27 +02:00
parent de80a43a26
commit 2b7d9ad525
19 changed files with 73 additions and 69 deletions
+1 -1
View File
@@ -9,6 +9,6 @@
<plugin id="com.intellij.properties" />
<plugin id="com.intellij.uiDesigner" />
<plugin id="org.intellij.groovy" />
<plugin id="org.jetbrains.kotlin" min-version="0.13.1511" max-version="0.14.9999" />
<plugin id="org.jetbrains.kotlin" min-version="0.14.449" max-version="0.15.9999" />
</component>
</project>
@@ -124,7 +124,7 @@ class MockPackageFacadeGenerator : ModuleLevelBuilder(BuilderCategory.SOURCE_PRO
val files = dirsToCheck.map { it.listFiles() }.filterNotNull().flatMap { it.toList() }.filter { isCompilable(it) && packageName == getPackageName(it) }
if (files.isEmpty()) continue
val classNames = files.map { FileUtilRt.getNameWithoutExtension(it.getName()) }.sort()
val classNames = files.map { FileUtilRt.getNameWithoutExtension(it.getName()) }.sorted()
val dirtySource = dirtyFiles.map { it.getAbsolutePath() }
val allSources = files.map { it.getAbsolutePath() }
@@ -48,6 +48,5 @@ class PathInfo(val ioFile: File?, val file: VirtualFile?, val root: VirtualFile,
get() = if (ioFile == null) file!!.fileType else FileTypeManager.getInstance().getFileTypeByFileName(ioFile.name)
val isDirectory: Boolean
get() = if (ioFile == null) file!!.isDirectory else ioFile.isDirectory
fun isDirectory(): Boolean = if (ioFile == null) file!!.isDirectory else ioFile.isDirectory
}
@@ -53,7 +53,7 @@ private class DefaultWebServerPathHandler : WebServerPathHandler() {
pathToFileManager.pathToInfoCache.put(path, pathInfo)
}
if (pathInfo.isDirectory) {
if (pathInfo.isDirectory()) {
if (!endsWithSlash(decodedRawPath)) {
WebServerPathHandler.redirectToDirectory(request, channel, if (isCustomHost) path else ("$projectName/$path"))
return true
@@ -734,7 +734,7 @@ public class SchemeManagerImpl<T : Scheme, E : ExternalizableScheme>(private val
toReplace = i
if (replaceExisting && existing is ExternalizableScheme) {
val oldInfo = schemeToInfo.remove(existing)
val oldInfo = schemeToInfo.remove(existing as E)
if (oldInfo != null && scheme is ExternalizableScheme && !schemeToInfo.containsKey(scheme)) {
@Suppress("UNCHECKED_CAST")
schemeToInfo.put(scheme as E, oldInfo)
@@ -813,7 +813,7 @@ public class SchemeManagerImpl<T : Scheme, E : ExternalizableScheme>(private val
}
if (s is ExternalizableScheme) {
schemeToInfo.remove(s)?.scheduleDelete()
schemeToInfo.remove(s as E)?.scheduleDelete()
}
schemes.remove(i)
break
@@ -171,7 +171,7 @@ internal class ApplicationStoreTest {
val componentKey = A::class.java.name
picoContainer.registerComponent(InstanceComponentAdapter(componentKey, component))
try {
assertThat(getExportableComponentsMap(false, false, storageManager, relativePaths)).containsOnly(componentFile to list, additionalFile to list)
assertThat(getExportableComponentsMap(false, false, storageManager, relativePaths)).containsOnly(componentFile.to(list), additionalFile.to(list))
}
finally {
picoContainer.unregisterComponent(componentKey)
@@ -190,14 +190,14 @@ public abstract class DiffTestCase : UsefulTestCase() {
// Helpers
//
public data open class Trio<T>(val data1: T, val data2: T, val data3: T) {
public open class Trio<T: Any>(val data1: T, val data2: T, val data3: T) {
companion object {
public fun <V> from(f: (ThreeSide) -> V): Trio<V> = Trio(f(ThreeSide.LEFT), f(ThreeSide.BASE), f(ThreeSide.RIGHT))
public fun <V: Any> from(f: (ThreeSide) -> V): Trio<V> = Trio(f(ThreeSide.LEFT), f(ThreeSide.BASE), f(ThreeSide.RIGHT))
}
public fun <V> map(f: (T) -> V): Trio<V> = Trio(f(data1), f(data2), f(data3))
public fun <V: Any> map(f: (T) -> V): Trio<V> = Trio(f(data1), f(data2), f(data3))
public fun <V> map(f: (T, ThreeSide) -> V): Trio<V> = Trio(f(data1, ThreeSide.LEFT), f(data2, ThreeSide.BASE), f(data3, ThreeSide.RIGHT))
public fun <V: Any> map(f: (T, ThreeSide) -> V): Trio<V> = Trio(f(data1, ThreeSide.LEFT), f(data2, ThreeSide.BASE), f(data3, ThreeSide.RIGHT))
public fun forEach(f: (T, ThreeSide) -> Unit): Unit {
f(data1, ThreeSide.LEFT)
@@ -210,5 +210,13 @@ public abstract class DiffTestCase : UsefulTestCase() {
override fun toString(): String {
return "($data1, $data2, $data3)"
}
override fun equals(other: Any?): Boolean {
return other is Trio<*> && other.data1 == data1 && other.data2 == data2 && other.data3 == data3
}
override fun hashCode(): Int {
return data1.hashCode() * 37 * 37 + data2.hashCode() * 37 + data3.hashCode()
}
}
}
@@ -165,7 +165,7 @@ public abstract class ComparisonMergeUtilTestBase : DiffTestCase() {
}
public data class Change(start1: Int, end1: Int, start2: Int, end2: Int, start3: Int, end3: Int)
public class Change(start1: Int, end1: Int, start2: Int, end2: Int, start3: Int, end3: Int)
: Trio<IntPair>(IntPair(start1, end1), IntPair(start2, end2), IntPair(start3, end3)) {
val start1 = start(ThreeSide.LEFT)
@@ -341,7 +341,7 @@ public abstract class MergeTestBase : DiffTestCase() {
public inner class LineColHelper(val line: Int) {
}
public inner data class LineCol(val line: Int, val col: Int) {
public inner class LineCol(val line: Int, val col: Int) {
public fun toOffset(): Int = editor.getDocument().getLineStartOffset(line) + col
}
}
@@ -36,16 +36,16 @@ public abstract class BreakpointBase<L : Any>(override val target: BreakpointTar
override var condition: String? = condition
set(value: String?) {
if (condition != value) {
$condition = value
if (field != value) {
field = value
dirty = true
}
}
override var enabled: Boolean = enabled
set(value: Boolean) {
if (value != enabled) {
$enabled = value
if (value != field) {
field = value
dirty = true
}
}
@@ -10,7 +10,7 @@ import java.util.*
internal class XmlSerializerMapTest {
@Test fun beanValueUsingSkipDefaultsFilter() {
@Tag("bean")
private class BeanWithMapWithBeanValue2 {
class BeanWithMapWithBeanValue2 {
@MapAnnotation(surroundWithTag = false, surroundKeyWithTag = false, surroundValueWithTag = false)
public var values: Map<String, BeanWithProperty> = THashMap()
}
@@ -15,15 +15,15 @@
*/
package com.intellij.vcs.log.graph
import com.intellij.vcs.log.graph.api.LinearGraph
import com.intellij.vcs.log.graph.api.elements.GraphNode
import com.intellij.vcs.log.graph.parser.EdgeNodeCharConverter.*
import com.intellij.vcs.log.graph.api.elements.GraphEdge
import com.intellij.vcs.log.graph.parser.CommitParser
import com.intellij.vcs.log.graph.api.printer.PrintElementGenerator
import com.intellij.vcs.log.graph.api.elements.GraphElement
import com.intellij.vcs.log.graph.api.EdgeFilter
import com.intellij.vcs.log.graph.api.LinearGraph
import com.intellij.vcs.log.graph.api.elements.GraphEdge
import com.intellij.vcs.log.graph.api.elements.GraphElement
import com.intellij.vcs.log.graph.api.elements.GraphNode
import com.intellij.vcs.log.graph.api.printer.PrintElementGenerator
import com.intellij.vcs.log.graph.impl.print.elements.PrintElementWithGraphElement
import com.intellij.vcs.log.graph.parser.CommitParser
import com.intellij.vcs.log.graph.parser.EdgeNodeCharConverter.toChar
fun LinearGraph.asString(sorted: Boolean = false): String {
val s = StringBuilder()
@@ -34,7 +34,7 @@ fun LinearGraph.asString(sorted: Boolean = false): String {
var adjEdges = getAdjacentEdges(nodeIndex, EdgeFilter.ALL)
if (sorted) {
adjEdges = adjEdges.sortBy(GraphStrUtils.GRAPH_ELEMENT_COMPARATOR)
adjEdges = adjEdges.sortedWith(GraphStrUtils.GRAPH_ELEMENT_COMPARATOR)
}
adjEdges.map { it.asString() }.joinTo(s, separator = " ")
}
@@ -83,7 +83,7 @@ fun PrintElementGenerator.asString(size: Int): String {
for (row in 0..size - 1) {
if (row > 0) s.append("\n")
val elements = getPrintElements(row).sortBy {
val elements = getPrintElements(row).sortedBy {
val pos = it.getPositionInCurrentRow()
if (it is NodePrintElement) {
1024 * pos
@@ -15,29 +15,29 @@
*/
package com.intellij.vcs.log.graph
import com.intellij.vcs.log.graph.api.elements.GraphEdgeType
import java.util.ArrayList
import com.intellij.vcs.log.graph.api.LinearGraph
import com.intellij.vcs.log.graph.api.elements.GraphEdge
import com.intellij.vcs.log.graph.api.elements.GraphNode
import com.intellij.util.containers.MultiMap
import com.intellij.util.containers.ContainerUtil
import com.intellij.util.containers.HashMap
import com.intellij.vcs.log.graph.api.elements.GraphNodeType
import com.intellij.util.containers.MultiMap
import com.intellij.vcs.log.graph.BaseTestGraphBuilder.SimpleEdge
import com.intellij.vcs.log.graph.BaseTestGraphBuilder.SimpleNode
import com.intellij.vcs.log.graph.api.permanent.PermanentGraphInfo
import com.intellij.vcs.log.graph.api.permanent.PermanentCommitsInfo
import com.intellij.util.containers.ContainerUtil
import com.intellij.vcs.log.graph.utils.TimestampGetter
import com.intellij.vcs.log.graph.impl.permanent.GraphLayoutBuilder
import kotlin.test.assertEquals
import kotlin.test.assertTrue
import kotlin.test.assertNull
import com.intellij.vcs.log.graph.utils.LinearGraphUtils
import com.intellij.vcs.log.graph.api.EdgeFilter
import com.intellij.vcs.log.graph.impl.permanent.PermanentLinearGraphImpl
import com.intellij.vcs.log.graph.api.LinearGraph
import com.intellij.vcs.log.graph.api.elements.GraphEdge
import com.intellij.vcs.log.graph.api.elements.GraphEdgeType
import com.intellij.vcs.log.graph.api.elements.GraphNode
import com.intellij.vcs.log.graph.api.elements.GraphNodeType
import com.intellij.vcs.log.graph.api.permanent.PermanentCommitsInfo
import com.intellij.vcs.log.graph.api.permanent.PermanentGraphInfo
import com.intellij.vcs.log.graph.impl.facade.LinearGraphController
import com.intellij.vcs.log.graph.impl.facade.VisibleGraphImpl
import com.intellij.vcs.log.graph.impl.permanent.GraphLayoutBuilder
import com.intellij.vcs.log.graph.impl.permanent.PermanentLinearGraphImpl
import com.intellij.vcs.log.graph.utils.LinearGraphUtils
import com.intellij.vcs.log.graph.utils.TimestampGetter
import java.util.*
import kotlin.test.assertEquals
import kotlin.test.assertNull
import kotlin.test.assertTrue
public interface BaseTestGraphBuilder {
public val Int.U: SimpleNode get() = SimpleNode(this, GraphNodeType.USUAL)
@@ -181,7 +181,7 @@ public fun LinearGraph.asTestGraphString(sorted: Boolean = false): String = Stri
// edges
var adjacentEdges = getAdjacentEdges(nodeIndex, EdgeFilter.ALL)
if (sorted) {
adjacentEdges = adjacentEdges.sortBy(GraphStrUtils.GRAPH_ELEMENT_COMPARATOR)
adjacentEdges = adjacentEdges.sortedWith(GraphStrUtils.GRAPH_ELEMENT_COMPARATOR)
}
append("(")
@@ -16,19 +16,19 @@
package com.intellij.vcs.log.graph.impl
import org.junit.Assert.*
import org.junit.Test
import com.intellij.vcs.log.graph.api.LinearGraph
import com.intellij.vcs.log.graph.api.LiteLinearGraph
import com.intellij.vcs.log.graph.collapsing.FragmentGenerator
import com.intellij.vcs.log.graph.graph
import com.intellij.vcs.log.graph.utils.LinearGraphUtils
import com.intellij.vcs.log.graph.api.LinearGraph
import com.intellij.vcs.log.graph.api.LiteLinearGraph
import org.junit.Assert.assertEquals
import org.junit.Test
private val LinearGraph.lite: LiteLinearGraph get() = LinearGraphUtils.asLiteLinearGraph(this)
private fun LinearGraph.getMiddleNodes(upNode: Int, downNode: Int) = FragmentGenerator(lite) { false }.getMiddleNodes(upNode, downNode, false)
private fun Collection<Int>.assert(s: String) = assertEquals(s, sort().joinToString(","))
private fun Collection<Int>.assert(s: String) = assertEquals(s, sorted().joinToString(","))
private fun Int?.assert(i: Int?) = assertEquals(i, this)
private fun LinearGraph.redNodes(vararg redNode: Int = IntArray(0)): FragmentGenerator {
@@ -42,7 +42,7 @@ private fun LinearGraph.redNodes(vararg redNode: Int = IntArray(0)): FragmentGen
private val Int?.s: String get() = if (this == null) "n" else toString()
private fun FragmentGenerator.GreenFragment.assert(s: String)
= assertEquals(s, "${getUpRedNode().s}|${getDownRedNode().s}|${getMiddleGreenNodes().sort().joinToString(",")}")
= assertEquals(s, "${getUpRedNode().s}|${getDownRedNode().s}|${getMiddleGreenNodes().sorted().joinToString(",")}")
/*
0
@@ -16,7 +16,7 @@
package com.intellij.vcs.log.graph.utils
import com.intellij.util.containers.MultiMap
import org.junit.Assert.*
import org.junit.Assert.assertEquals
import org.junit.Test
@@ -39,11 +39,11 @@ private class MapTester {
fun compareMaps() {
val keys = compareKeys()
val correctStr = keys.joinLines {
"$it:" + correctMap.get(it).sort().joinToString()
"$it:" + correctMap.get(it).sorted().joinToString()
}
val testedStr = keys.joinLines {
"$it:" + testedMap.get(it).sort().joinToString()
"$it:" + testedMap.get(it).sorted().joinToString()
}
val testedArrayStr = keys.joinLines {
@@ -54,10 +54,10 @@ private class MapTester {
}
fun compareKeys(): List<Int> {
val correctKeys = correctMap.keySet().sort().joinToString()
val correctKeys = correctMap.keySet().sorted().joinToString()
val testedKeys = testedMap.keys().sortR().joinToString()
assertEquals(correctKeys, testedKeys)
return correctMap.keySet().sort()
return correctMap.keySet().sorted()
}
}
@@ -16,7 +16,6 @@
package com.intellij.vcs.log.data
import com.intellij.mock.MockVirtualFile
import com.intellij.openapi.Disposable
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.util.Function
import com.intellij.vcs.log.*
@@ -30,9 +29,7 @@ import com.intellij.vcs.log.impl.TestVcsLogProvider.DEFAULT_USER
import com.intellij.vcs.log.ui.filter.VcsLogUserFilterImpl
import com.intellij.vcs.log.ui.tables.GraphTableModel
import org.junit.Test
import java.util.ArrayList
import java.util.HashMap
import java.util.HashSet
import java.util.*
import kotlin.test.assertEquals
import kotlin.test.assertTrue
@@ -130,7 +127,7 @@ class VisiblePackBuilderTest {
inner class Graph(val commits: List<GraphCommit<Int>>,
val refs: Set<VisiblePackBuilderTest.Ref>,
val data: HashMap<GraphCommit<Int>, Data>) {
val root = MockVirtualFile("root") : VirtualFile
val root: VirtualFile = MockVirtualFile("root")
val providers: Map<VirtualFile, TestVcsLogProvider> = mapOf(root to TestVcsLogProvider(root))
val hashMap = generateHashMap(commits.maxBy { it.getId() }!!.getId())
@@ -54,7 +54,7 @@ public class RepoBuilder(val repo: GitRepository) {
}
}
else {
if (git("branch").splitBy("\n").map({ it.replace("*", "") }).contains(branch)) {
if (git("branch").split("\n").map({ it.replace("*", "") }).contains(branch)) {
git("checkout $branch")
}
else {
+1 -1
View File
@@ -25,7 +25,7 @@ private var ourBundle: Reference<ResourceBundle>? = null
private const val BUNDLE: String = "messages.IcsBundle"
internal fun icsMessage(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
fun icsMessage(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
return CommonBundle.message(getBundle(), key, *params)
}
@@ -163,7 +163,7 @@ internal class GitTest : GitTestCase() {
.compare()
}
@Test fun `overwrite local: second merge is null`() {
@Test fun `overwrite local - second merge is null`() {
createLocalAndRemoteRepositories(initialCommit = true)
sync(SyncType.MERGE)
@@ -266,7 +266,7 @@ internal class GitTest : GitTestCase() {
doSyncWithUninitializedUpstream(SyncType.MERGE)
}
@Test fun `overwrite remote: uninitialized upstream`() {
@Test fun `overwrite remote - uninitialized upstream`() {
doSyncWithUninitializedUpstream(SyncType.OVERWRITE_REMOTE)
}
@@ -299,19 +299,19 @@ internal class GitTest : GitTestCase() {
}
}
@Test fun `initial copy to repository: no local files`() {
@Test fun `initial copy to repository - no local files`() {
createRemoteRepository(initialCommit = false)
// check error during findRemoteRefUpdatesFor (no master ref)
testInitialCopy(false)
}
@Test fun `initial copy to repository: some local files`() {
@Test fun `initial copy to repository - some local files`() {
createRemoteRepository(initialCommit = false)
// check error during findRemoteRefUpdatesFor (no master ref)
testInitialCopy(true)
}
@Test fun `initial copy to repository: remote files removed`() {
@Test fun `initial copy to repository - remote files removed`() {
createRemoteRepository(initialCommit = true)
// check error during findRemoteRefUpdatesFor (no master ref)