Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Deprecation Warnings #1187

Merged
merged 1 commit into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions AndroidCompat/src/main/java/app/cash/quickjs/QuickJs.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ public <T> void set(String name, Class<T> ignoredType, T object) {
context.getBindings("js").putMember(name, object);
}


@Override
public void close() {
this.context.leave();
this.context.close();
this.context = null;
if (this.context != null) {
this.context.leave();
this.context.close();
this.context = null;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package eu.kanade.tachiyomi.network

import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.ExperimentalSerializationApi
Expand Down Expand Up @@ -68,7 +67,6 @@ fun Call.asObservableSuccess(): Observable<Response> =
}

// Based on https://github.com/gildor/kotlin-coroutines-okhttp
@OptIn(ExperimentalCoroutinesApi::class)
private suspend fun Call.await(callStack: Array<StackTraceElement>): Response {
return suspendCancellableCoroutine { continuation ->
val callback =
Expand All @@ -77,8 +75,9 @@ private suspend fun Call.await(callStack: Array<StackTraceElement>): Response {
call: Call,
response: Response,
) {
continuation.resume(response) {
continuation.resume(response) { _, resourceToClose, _ ->
response.body.close()
resourceToClose.close()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import java.net.URLClassLoader
import java.nio.file.Files
import java.nio.file.Path
import javax.xml.parsers.DocumentBuilderFactory
import kotlin.io.path.Path

object PackageTools {
private val logger = KotlinLogging.logger {}
Expand Down Expand Up @@ -152,7 +153,7 @@ object PackageTools {
): Any {
try {
logger.debug { "loading jar with path: $jarPath" }
val classLoader = jarLoaderMap[jarPath] ?: URLClassLoader(arrayOf<URL>(URL("file:$jarPath")))
val classLoader = jarLoaderMap[jarPath] ?: URLClassLoader(arrayOf<URL>(Path(jarPath).toUri().toURL()))
val classToLoad = Class.forName(className, false, classLoader)

jarLoaderMap[jarPath] = classLoader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package suwayomi.tachidesk.manga.impl.util.network
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.suspendCancellableCoroutine
import okhttp3.Call
import okhttp3.Callback
Expand All @@ -17,7 +16,6 @@ import java.io.IOException
import kotlin.coroutines.resumeWithException

// Based on https://github.com/gildor/kotlin-coroutines-okhttp
@OptIn(ExperimentalCoroutinesApi::class)
suspend fun Call.await(): Response {
return suspendCancellableCoroutine { continuation ->
enqueue(
Expand All @@ -31,8 +29,9 @@ suspend fun Call.await(): Response {
return
}

continuation.resume(response) {
continuation.resume(response) { _, resourceToClose, _ ->
response.body.closeQuietly()
resourceToClose.closeQuietly()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import uy.kohesive.injekt.injectLazy
import java.io.File
import java.io.InputStream
import java.net.HttpURLConnection
import java.net.URL
import java.net.URI
import java.nio.charset.StandardCharsets
import java.security.MessageDigest
import java.util.Date
Expand Down Expand Up @@ -723,7 +723,7 @@ object WebInterfaceManager {

zipFile.outputStream().use { webUIZipFileOut ->

val connection = URL(url).openConnection() as HttpURLConnection
val connection = URI.create(url).toURL().openConnection() as HttpURLConnection
connection.connect()
val contentLength = connection.contentLength

Expand Down
Loading