mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 11:53:49 +07:00
Eel API: remove deprecated methods in EelPath
No significant reason for a long support for old method was found, i.e., there were no feature branches that the change could break. IJ-CR-147046 (cherry picked from commit 27708f33e75969090970c7230e8f1b3ff63e5b63) GitOrigin-RevId: 2e33872c365fbd9807c5837d1f3c542ab86a58f1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
12e8ddbcae
commit
650e3a7632
@@ -19,15 +19,6 @@ fun EelFileSystemApi.getPathE(string: String, vararg other: String): EelPath.Abs
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("Use `getPathE`")
|
|
||||||
fun EelFileSystemApi.getPath(string: String, vararg other: String): EelResult<out EelPath.Absolute, EelPathError> {
|
|
||||||
return EelPath.Absolute.build(listOf(string, *other), when (this) {
|
|
||||||
is EelFileSystemPosixApi -> EelPath.Absolute.OS.UNIX
|
|
||||||
is EelFileSystemWindowsApi -> EelPath.Absolute.OS.WINDOWS
|
|
||||||
else -> throw UnsupportedOperationException("Unsupported OS: ${this::class.java}")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO Integrate case-(in)sensitiveness into the interface.
|
// TODO Integrate case-(in)sensitiveness into the interface.
|
||||||
|
|
||||||
interface EelFileSystemApi {
|
interface EelFileSystemApi {
|
||||||
|
|||||||
@@ -56,9 +56,6 @@ internal class ArrayListEelAbsolutePath private constructor(
|
|||||||
return ArrayListEelAbsolutePath(_root, result)
|
return ArrayListEelAbsolutePath(_root, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
override fun normalize(): EelResult<out EelPath.Absolute, EelPathError> = exceptionAdapter { normalizeE() }
|
|
||||||
|
|
||||||
override fun resolveE(other: EelPath.Relative): EelPath.Absolute {
|
override fun resolveE(other: EelPath.Relative): EelPath.Absolute {
|
||||||
val result = parts.toMutableList()
|
val result = parts.toMutableList()
|
||||||
for (index in 0..<other.nameCount) {
|
for (index in 0..<other.nameCount) {
|
||||||
@@ -72,9 +69,6 @@ internal class ArrayListEelAbsolutePath private constructor(
|
|||||||
return ArrayListEelAbsolutePath(_root, result)
|
return ArrayListEelAbsolutePath(_root, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
override fun resolve(other: EelPath.Relative): EelResult<out EelPath.Absolute, EelPathError> = exceptionAdapter { resolveE(other) }
|
|
||||||
|
|
||||||
override fun getChildE(name: String): EelPath.Absolute {
|
override fun getChildE(name: String): EelPath.Absolute {
|
||||||
val error = checkFileName(name)
|
val error = checkFileName(name)
|
||||||
return if (error == null)
|
return if (error == null)
|
||||||
@@ -83,9 +77,6 @@ internal class ArrayListEelAbsolutePath private constructor(
|
|||||||
throw EelPathException(name, error)
|
throw EelPathException(name, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
override fun getChild(name: String): EelResult<out EelPath.Absolute, EelPathError> = exceptionAdapter { getChildE(name) }
|
|
||||||
|
|
||||||
override fun scan(): Sequence<EelPath.Absolute> =
|
override fun scan(): Sequence<EelPath.Absolute> =
|
||||||
parts.asSequence().scan(ArrayListEelAbsolutePath(_root, listOf())) { parent, name ->
|
parts.asSequence().scan(ArrayListEelAbsolutePath(_root, listOf())) { parent, name ->
|
||||||
ArrayListEelAbsolutePath(_root, parent.parts + name)
|
ArrayListEelAbsolutePath(_root, parent.parts + name)
|
||||||
@@ -167,9 +158,6 @@ internal class ArrayListEelAbsolutePath private constructor(
|
|||||||
return EelPath.Relative.buildE(result)
|
return EelPath.Relative.buildE(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
override fun relativize(other: EelPath.Absolute): EelResult<out EelPath.Relative, EelPathError> = exceptionAdapter { relativizeE(other) }
|
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean =
|
override fun equals(other: Any?): Boolean =
|
||||||
other is EelPath.Absolute &&
|
other is EelPath.Absolute &&
|
||||||
nameCount == other.nameCount &&
|
nameCount == other.nameCount &&
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||||
package com.intellij.platform.eel.path
|
package com.intellij.platform.eel.path
|
||||||
|
|
||||||
import com.intellij.platform.eel.EelResult
|
|
||||||
import kotlin.Throws
|
|
||||||
|
|
||||||
internal class ArrayListEelRelativePath private constructor(
|
internal class ArrayListEelRelativePath private constructor(
|
||||||
private val parts: List<String>,
|
private val parts: List<String>,
|
||||||
) : EelPath.Relative {
|
) : EelPath.Relative {
|
||||||
@@ -39,9 +36,6 @@ internal class ArrayListEelRelativePath private constructor(
|
|||||||
return ArrayListEelRelativePath(result)
|
return ArrayListEelRelativePath(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
override fun resolve(other: EelPath.Relative): EelResult<out EelPath.Relative, EelPathError> = exceptionAdapter { resolveE(other) }
|
|
||||||
|
|
||||||
override fun getChildE(name: String): ArrayListEelRelativePath =
|
override fun getChildE(name: String): ArrayListEelRelativePath =
|
||||||
when {
|
when {
|
||||||
name.isEmpty() -> throw EelPathException(name, "Empty child name is not allowed")
|
name.isEmpty() -> throw EelPathException(name, "Empty child name is not allowed")
|
||||||
@@ -49,9 +43,6 @@ internal class ArrayListEelRelativePath private constructor(
|
|||||||
else -> ArrayListEelRelativePath(parts + name)
|
else -> ArrayListEelRelativePath(parts + name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
override fun getChild(name: String): EelResult<out EelPath.Relative, EelPathError> = exceptionAdapter { getChildE(name) }
|
|
||||||
|
|
||||||
override fun compareTo(other: EelPath.Relative): Int {
|
override fun compareTo(other: EelPath.Relative): Int {
|
||||||
for (i in 0..<nameCount.coerceAtMost(other.nameCount)) {
|
for (i in 0..<nameCount.coerceAtMost(other.nameCount)) {
|
||||||
val comparison = getName(i).fileName.compareTo(other.getName(i).fileName)
|
val comparison = getName(i).fileName.compareTo(other.getName(i).fileName)
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.intellij.platform.eel.EelResult
|
|||||||
import com.intellij.platform.eel.getOrThrow
|
import com.intellij.platform.eel.getOrThrow
|
||||||
import com.intellij.platform.eel.path.EelPath.Absolute.OS
|
import com.intellij.platform.eel.path.EelPath.Absolute.OS
|
||||||
import java.nio.file.InvalidPathException
|
import java.nio.file.InvalidPathException
|
||||||
import kotlin.Throws
|
|
||||||
|
|
||||||
interface EelPathError {
|
interface EelPathError {
|
||||||
val raw: String
|
val raw: String
|
||||||
@@ -30,11 +29,6 @@ sealed interface EelPath {
|
|||||||
fun parseE(raw: String, os: OS?): EelPath =
|
fun parseE(raw: String, os: OS?): EelPath =
|
||||||
ArrayListEelAbsolutePath.parseOrNull(raw, os)
|
ArrayListEelAbsolutePath.parseOrNull(raw, os)
|
||||||
?: Relative.parseE(raw)
|
?: Relative.parseE(raw)
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
fun parse(raw: String, os: OS?): EelResult<out EelPath, EelPathError> =
|
|
||||||
exceptionAdapter { parseE(raw, os) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val fileName: String
|
val fileName: String
|
||||||
@@ -109,9 +103,6 @@ sealed interface EelPath {
|
|||||||
@Throws(EelPathException::class)
|
@Throws(EelPathException::class)
|
||||||
fun resolveE(other: Relative): EelPath
|
fun resolveE(other: Relative): EelPath
|
||||||
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
fun resolve(other: Relative): EelResult<out EelPath, EelPathError>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ```kotlin
|
* ```kotlin
|
||||||
* IjentRelativePath.parse("", false).getChild("abc") == Ok(IjentRelativePath.parse("abc", false))
|
* IjentRelativePath.parse("", false).getChild("abc") == Ok(IjentRelativePath.parse("abc", false))
|
||||||
@@ -125,9 +116,6 @@ sealed interface EelPath {
|
|||||||
@Throws(EelPathException::class)
|
@Throws(EelPathException::class)
|
||||||
fun getChildE(name: String): EelPath
|
fun getChildE(name: String): EelPath
|
||||||
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
fun getChild(name: String): EelResult<out EelPath, EelPathError>
|
|
||||||
|
|
||||||
override fun toString(): String
|
override fun toString(): String
|
||||||
|
|
||||||
interface Relative : EelPath, Comparable<Relative> {
|
interface Relative : EelPath, Comparable<Relative> {
|
||||||
@@ -137,11 +125,6 @@ sealed interface EelPath {
|
|||||||
fun parseE(raw: String): Relative =
|
fun parseE(raw: String): Relative =
|
||||||
ArrayListEelRelativePath.parse(raw)
|
ArrayListEelRelativePath.parse(raw)
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
fun parse(raw: String): EelResult<out Relative, EelPathError> =
|
|
||||||
exceptionAdapter { parseE(raw) }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The parts of the path must not contain / or \.
|
* The parts of the path must not contain / or \.
|
||||||
*/
|
*/
|
||||||
@@ -150,11 +133,6 @@ sealed interface EelPath {
|
|||||||
fun buildE(vararg parts: String): Relative =
|
fun buildE(vararg parts: String): Relative =
|
||||||
buildE(listOf(*parts))
|
buildE(listOf(*parts))
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
fun build(vararg parts: String): EelResult<out Relative, EelPathError> =
|
|
||||||
exceptionAdapter { buildE(*parts) }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The parts of the path must not contain / or \.
|
* The parts of the path must not contain / or \.
|
||||||
*/
|
*/
|
||||||
@@ -163,11 +141,6 @@ sealed interface EelPath {
|
|||||||
fun buildE(parts: List<String>): Relative =
|
fun buildE(parts: List<String>): Relative =
|
||||||
ArrayListEelRelativePath.build(parts)
|
ArrayListEelRelativePath.build(parts)
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
fun build(parts: List<String>): EelResult<out Relative, EelPathError> =
|
|
||||||
exceptionAdapter { buildE(parts) }
|
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
val EMPTY: Relative = ArrayListEelRelativePath.EMPTY
|
val EMPTY: Relative = ArrayListEelRelativePath.EMPTY
|
||||||
}
|
}
|
||||||
@@ -180,15 +153,9 @@ sealed interface EelPath {
|
|||||||
@Throws(EelPathException::class)
|
@Throws(EelPathException::class)
|
||||||
override fun resolveE(other: Relative): Relative
|
override fun resolveE(other: Relative): Relative
|
||||||
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
override fun resolve(other: Relative): EelResult<out Relative, EelPathError>
|
|
||||||
|
|
||||||
@Throws(EelPathException::class)
|
@Throws(EelPathException::class)
|
||||||
override fun getChildE(name: String): Relative
|
override fun getChildE(name: String): Relative
|
||||||
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
override fun getChild(name: String): EelResult<out Relative, EelPathError>
|
|
||||||
|
|
||||||
override fun compareTo(other: Relative): Int
|
override fun compareTo(other: Relative): Int
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -219,30 +186,15 @@ sealed interface EelPath {
|
|||||||
ArrayListEelAbsolutePath.parseOrNull(raw, os)
|
ArrayListEelAbsolutePath.parseOrNull(raw, os)
|
||||||
?: throw EelPathException(raw, "Not an absolute path")
|
?: throw EelPathException(raw, "Not an absolute path")
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
fun parse(raw: String, os: OS?): EelResult<out Absolute, EelPathError> =
|
|
||||||
exceptionAdapter { parseE(raw, os) }
|
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Throws(EelPathException::class)
|
@Throws(EelPathException::class)
|
||||||
fun buildE(vararg parts: String): Absolute =
|
fun buildE(vararg parts: String): Absolute =
|
||||||
buildE(listOf(*parts), null)
|
buildE(listOf(*parts), null)
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
fun build(vararg parts: String): EelResult<out Absolute, EelPathError> =
|
|
||||||
exceptionAdapter { buildE(*parts) }
|
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Throws(EelPathException::class)
|
@Throws(EelPathException::class)
|
||||||
fun buildE(parts: List<String>, os: OS?): Absolute =
|
fun buildE(parts: List<String>, os: OS?): Absolute =
|
||||||
ArrayListEelAbsolutePath.build(parts, os)
|
ArrayListEelAbsolutePath.build(parts, os)
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
fun build(parts: List<String>, os: OS?): EelResult<out Absolute, EelPathError> =
|
|
||||||
exceptionAdapter { buildE(parts, os) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class OS {
|
enum class OS {
|
||||||
@@ -263,16 +215,10 @@ sealed interface EelPath {
|
|||||||
@Throws(EelPathException::class)
|
@Throws(EelPathException::class)
|
||||||
fun normalizeE(): Absolute
|
fun normalizeE(): Absolute
|
||||||
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
fun normalize(): EelResult<out Absolute, EelPathError>
|
|
||||||
|
|
||||||
/** See [java.nio.file.Path.resolve] */
|
/** See [java.nio.file.Path.resolve] */
|
||||||
@Throws(EelPathException::class)
|
@Throws(EelPathException::class)
|
||||||
override fun resolveE(other: Relative): Absolute
|
override fun resolveE(other: Relative): Absolute
|
||||||
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
override fun resolve(other: Relative): EelResult<out Absolute, EelPathError>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See [java.nio.file.Path.relativize].
|
* See [java.nio.file.Path.relativize].
|
||||||
*
|
*
|
||||||
@@ -284,15 +230,9 @@ sealed interface EelPath {
|
|||||||
@Throws(EelPathException::class)
|
@Throws(EelPathException::class)
|
||||||
fun relativizeE(other: Absolute): Relative
|
fun relativizeE(other: Absolute): Relative
|
||||||
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
fun relativize(other: Absolute): EelResult<out Relative, EelPathError>
|
|
||||||
|
|
||||||
@Throws(EelPathException::class)
|
@Throws(EelPathException::class)
|
||||||
override fun getChildE(name: String): Absolute
|
override fun getChildE(name: String): Absolute
|
||||||
|
|
||||||
@Deprecated("Use the method with EelPathException")
|
|
||||||
override fun getChild(name: String): EelResult<out Absolute, EelPathError>
|
|
||||||
|
|
||||||
fun scan(): Sequence<Absolute>
|
fun scan(): Sequence<Absolute>
|
||||||
|
|
||||||
/** See [java.nio.file.Path.toString] */
|
/** See [java.nio.file.Path.toString] */
|
||||||
@@ -312,13 +252,4 @@ val EelPlatform.pathOs: OS
|
|||||||
get() = when (this) {
|
get() = when (this) {
|
||||||
is EelPlatform.Posix -> OS.UNIX
|
is EelPlatform.Posix -> OS.UNIX
|
||||||
is EelPlatform.Windows -> OS.WINDOWS
|
is EelPlatform.Windows -> OS.WINDOWS
|
||||||
}
|
|
||||||
|
|
||||||
internal inline fun <T : EelPath> exceptionAdapter(body: () -> T): EelResult<T, EelPathError> =
|
|
||||||
try {
|
|
||||||
val result = body()
|
|
||||||
OkResult(result)
|
|
||||||
}
|
|
||||||
catch (e: EelPathException) {
|
|
||||||
ErrorResult(e)
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user