Replace Paths.get() with Path.of()

Paths.get() may be deprecated in a future release.

Signed-off-by: Graham <gpe@openrs2.org>
Graham 4 years ago
parent 986d23e876
commit f90b9df505
  1. 1
      .idea/codeInsightSettings.xml
  2. 4
      cache/src/test/kotlin/org/openrs2/cache/DiskStoreTest.kt
  3. 3
      cache/src/test/kotlin/org/openrs2/cache/FlatFileStoreTest.kt
  4. 4
      cache/src/test/kotlin/org/openrs2/cache/Js5MasterIndexTest.kt
  5. 6
      cache/src/test/kotlin/org/openrs2/cache/StoreTest.kt
  6. 6
      conf/src/main/kotlin/org/openrs2/conf/ConfigProvider.kt
  7. 4
      crypto/src/main/kotlin/org/openrs2/crypto/RsaKeyProvider.kt
  8. 4
      deob-ast/src/main/kotlin/org/openrs2/deob/ast/gl/GlRegistryProvider.kt
  9. 6
      deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/DeobfuscateBytecodeCommand.kt
  10. 4
      deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/ProfileProvider.kt
  11. 3
      deob-processor/src/main/kotlin/org/openrs2/deob/processor/NameMapProcessor.kt
  12. 5
      deob-util/src/main/kotlin/org/openrs2/deob/util/Module.kt
  13. 3
      deob-util/src/main/kotlin/org/openrs2/deob/util/map/NameMapProvider.kt
  14. 8
      patcher/src/main/kotlin/org/openrs2/patcher/PatchCommand.kt

@ -8,6 +8,7 @@
<name>com.google.inject.Provider</name>
<name>com.google.inject.ScopeAnnotation</name>
<name>com.google.inject.Singleton</name>
<name>java.nio.file.Paths.get</name>
<name>org.junit.jupiter.api.AfterEach</name>
<name>org.junit.jupiter.api.Assertions.assertEquals</name>
<name>org.junit.jupiter.api.Assertions.assertFalse</name>

@ -8,7 +8,7 @@ import org.openrs2.buffer.use
import org.openrs2.util.io.recursiveCopy
import org.openrs2.util.io.recursiveEquals
import java.io.FileNotFoundException
import java.nio.file.Paths
import java.nio.file.Path
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
@ -16,7 +16,7 @@ import kotlin.test.assertFalse
import kotlin.test.assertTrue
object DiskStoreTest {
private val ROOT = Paths.get(DiskStoreTest::class.java.getResource("disk-store").toURI())
private val ROOT = Path.of(DiskStoreTest::class.java.getResource("disk-store").toURI())
@Test
fun testBounds() {

@ -9,7 +9,6 @@ import org.openrs2.util.io.recursiveCopy
import org.openrs2.util.io.recursiveEquals
import java.io.FileNotFoundException
import java.nio.file.Path
import java.nio.file.Paths
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
@ -18,7 +17,7 @@ import kotlin.test.assertTrue
object FlatFileStoreTest {
private val IGNORE_GIT_EMPTY = { path: Path -> path.fileName.toString() != ".gitempty" }
private val ROOT = Paths.get(FlatFileStoreTest::class.java.getResource("flat-file-store").toURI())
private val ROOT = Path.of(FlatFileStoreTest::class.java.getResource("flat-file-store").toURI())
@Test
fun testBounds() {

@ -3,12 +3,12 @@ package org.openrs2.cache
import io.netty.buffer.ByteBufAllocator
import io.netty.buffer.Unpooled
import org.openrs2.buffer.use
import java.nio.file.Paths
import java.nio.file.Path
import kotlin.test.Test
import kotlin.test.assertEquals
object Js5MasterIndexTest {
private val ROOT = Paths.get(FlatFileStoreTest::class.java.getResource("master-index").toURI())
private val ROOT = Path.of(FlatFileStoreTest::class.java.getResource("master-index").toURI())
private val encoded = byteArrayOf(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4)
private val decoded = Js5MasterIndex(
mutableListOf(

@ -1,12 +1,12 @@
package org.openrs2.cache
import java.nio.file.Paths
import java.nio.file.Path
import kotlin.test.Test
import kotlin.test.assertTrue
object StoreTest {
private val DISK_ROOT = Paths.get(StoreTest::class.java.getResource("disk-store/empty").toURI())
private val FLAT_FILE_ROOT = Paths.get(StoreTest::class.java.getResource("flat-file-store/empty").toURI())
private val DISK_ROOT = Path.of(StoreTest::class.java.getResource("disk-store/empty").toURI())
private val FLAT_FILE_ROOT = Path.of(StoreTest::class.java.getResource("flat-file-store/empty").toURI())
@Test
fun testOpen() {

@ -3,7 +3,7 @@ package org.openrs2.conf
import com.fasterxml.jackson.databind.ObjectMapper
import org.openrs2.yaml.Yaml
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.Path
import javax.inject.Inject
import javax.inject.Provider
@ -19,7 +19,7 @@ public class ConfigProvider @Inject constructor(@Yaml private val mapper: Object
}
private companion object {
private val CONFIG_PATH = Paths.get("etc/config.yaml")
private val EXAMPLE_CONFIG_PATH = Paths.get("etc/config.example.yaml")
private val CONFIG_PATH = Path.of("etc/config.yaml")
private val EXAMPLE_CONFIG_PATH = Path.of("etc/config.example.yaml")
}
}

@ -2,7 +2,7 @@ package org.openrs2.crypto
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.Path
import javax.inject.Provider
public class RsaKeyProvider : Provider<RSAPrivateCrtKeyParameters> {
@ -17,6 +17,6 @@ public class RsaKeyProvider : Provider<RSAPrivateCrtKeyParameters> {
}
private companion object {
private val PATH = Paths.get("etc/game.key")
private val PATH = Path.of("etc/game.key")
}
}

@ -1,7 +1,7 @@
package org.openrs2.deob.ast.gl
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.Path
import javax.inject.Provider
public class GlRegistryProvider : Provider<GlRegistry> {
@ -12,6 +12,6 @@ public class GlRegistryProvider : Provider<GlRegistry> {
}
private companion object {
private val PATH = Paths.get("share/deob/gl.xml")
private val PATH = Path.of("share/deob/gl.xml")
}
}

@ -2,7 +2,7 @@ package org.openrs2.deob.bytecode
import com.github.ajalt.clikt.core.CliktCommand
import com.google.inject.Guice
import java.nio.file.Paths
import java.nio.file.Path
public fun main(args: Array<String>): Unit = DeobfuscateBytecodeCommand().main(args)
@ -11,8 +11,8 @@ public class DeobfuscateBytecodeCommand : CliktCommand(name = "bytecode") {
val injector = Guice.createInjector(BytecodeDeobfuscatorModule)
val deobfuscator = injector.getInstance(BytecodeDeobfuscator::class.java)
deobfuscator.run(
input = Paths.get("nonfree/lib"),
output = Paths.get("nonfree/var/cache/deob")
input = Path.of("nonfree/lib"),
output = Path.of("nonfree/var/cache/deob")
)
}
}

@ -3,7 +3,7 @@ package org.openrs2.deob.bytecode
import com.fasterxml.jackson.databind.ObjectMapper
import org.openrs2.yaml.Yaml
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.Path
import javax.inject.Inject
import javax.inject.Provider
@ -15,6 +15,6 @@ public class ProfileProvider @Inject constructor(@Yaml private val mapper: Objec
}
private companion object {
private val PATH = Paths.get("share/deob/profile.yaml")
private val PATH = Path.of("share/deob/profile.yaml")
}
}

@ -16,7 +16,6 @@ import org.openrs2.util.io.useAtomicBufferedWriter
import org.openrs2.yaml.Yaml
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import java.util.TreeMap
import javax.annotation.processing.AbstractProcessor
import javax.annotation.processing.ProcessingEnvironment
@ -58,7 +57,7 @@ public class NameMapProcessor : AbstractProcessor() {
private fun getPath(): Path? {
val map = processingEnv.options["map"] ?: return null
return Paths.get(map)
return Path.of(map)
}
override fun process(annotations: Set<TypeElement>, env: RoundEnvironment): Boolean {

@ -1,11 +1,10 @@
package org.openrs2.deob.util
import java.nio.file.Path
import java.nio.file.Paths
public class Module(public val name: String, public val dependencies: Set<Module> = emptySet()) {
public val jar: Path = Paths.get("nonfree/var/cache/deob").resolve("$name.jar")
public val sources: Path = Paths.get("nonfree").resolve(name).resolve("src/main/java")
public val jar: Path = Path.of("nonfree/var/cache/deob").resolve("$name.jar")
public val sources: Path = Path.of("nonfree").resolve(name).resolve("src/main/java")
public val transitiveDependencies: Set<Module> =
dependencies.plus(dependencies.flatMap { it.transitiveDependencies })

@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.ObjectMapper
import org.openrs2.yaml.Yaml
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import javax.inject.Inject
import javax.inject.Provider
@ -31,7 +30,7 @@ public class NameMapProvider @Inject constructor(@Yaml private val mapper: Objec
}
private companion object {
private val PATH = Paths.get("share/deob/map")
private val PATH = Path.of("share/deob/map")
private const val YAML_SUFFIX = ".yaml"
}
}

@ -2,7 +2,7 @@ package org.openrs2.patcher
import com.github.ajalt.clikt.core.CliktCommand
import com.google.inject.Guice
import java.nio.file.Paths
import java.nio.file.Path
public fun main(args: Array<String>): Unit = PatchCommand().main(args)
@ -11,9 +11,9 @@ public class PatchCommand : CliktCommand(name = "patch") {
val injector = Guice.createInjector(PatcherModule)
val patcher = injector.getInstance(Patcher::class.java)
patcher.run(
input = Paths.get("nonfree/lib"),
output = Paths.get("nonfree/var/cache/client"),
keyStorePath = Paths.get("etc/loader.p12")
input = Path.of("nonfree/lib"),
output = Path.of("nonfree/var/cache/client"),
keyStorePath = Path.of("etc/loader.p12")
)
}
}

Loading…
Cancel
Save