@@ -21,16 +21,14 @@ package org.jetbrains.kotlin.script.util.resolvers
21
21
import com.jcabi.aether.Aether
22
22
import org.jetbrains.kotlin.script.util.DependsOn
23
23
import org.jetbrains.kotlin.script.util.Repository
24
- import org.jetbrains.kotlin.utils.addToStdlib.check
25
- import org.jetbrains.kotlin.utils.rethrow
26
- import java.io.File
27
- import java.util.*
28
24
import org.sonatype.aether.repository.RemoteRepository
29
25
import org.sonatype.aether.resolution.DependencyResolutionException
30
26
import org.sonatype.aether.util.artifact.DefaultArtifact
31
27
import org.sonatype.aether.util.artifact.JavaScopes
28
+ import java.io.File
32
29
import java.net.MalformedURLException
33
30
import java.net.URL
31
+ import java.util.*
34
32
35
33
val mavenCentral = RemoteRepository (" maven-central" , " default" , " http://repo1.maven.org/maven2/" )
36
34
@@ -51,7 +49,7 @@ class MavenResolver(val reportError: ((String) -> Unit)? = null): Resolver {
51
49
reportError?.invoke(msg) ? : throw RuntimeException (msg)
52
50
}
53
51
54
- fun String?.orNullIfBlank (): String? = this ?.check (String ::isNotBlank )
52
+ fun String?.orNullIfBlank (): String? = this ?.takeUnless (String ::isBlank )
55
53
56
54
val artifactId: DefaultArtifact = when {
57
55
dependsOn.groupId.isValidParam() || dependsOn.artifactId.isValidParam() -> {
@@ -75,13 +73,13 @@ class MavenResolver(val reportError: ((String) -> Unit)? = null): Resolver {
75
73
}
76
74
}
77
75
catch (e: DependencyResolutionException ) {
78
- reportError?.invoke(" resolving ${artifactId.artifactId} failed: $e " ) ? : rethrow(e)
76
+ reportError?.invoke(" resolving ${artifactId.artifactId} failed: $e " ) ? : throw e
79
77
}
80
78
return null
81
79
}
82
80
83
81
fun tryAddRepo (annotation : Repository ): Boolean {
84
- val urlStr = annotation.url.check { it.isValidParam() } ? : annotation.value.check { it.isValidParam() } ? : return false
82
+ val urlStr = annotation.url.takeIf { it.isValidParam() } ? : annotation.value.takeIf { it.isValidParam() } ? : return false
85
83
try {
86
84
URL (urlStr)
87
85
} catch (_: MalformedURLException ) {
0 commit comments