Skip to content

Commit 292b28d

Browse files
Make Intellij happy with groovy
1 parent f5c04bc commit 292b28d

File tree

1 file changed

+8
-8
lines changed
  • buildSrc/src/main/groovy/com/cleanroommc/gradle/helpers/tasks

1 file changed

+8
-8
lines changed

buildSrc/src/main/groovy/com/cleanroommc/gradle/helpers/tasks/Util.groovy

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ class Util {
1010
static void init() {
1111
File.metaClass.sha1 = { ->
1212
MessageDigest md = MessageDigest.getInstance('SHA-1')
13-
delegate.eachByte 4096, { bytes, size ->
13+
delegate.eachByte 4096, {byte[] bytes, int size ->
1414
md.update(bytes, 0, size)
1515
}
1616
return md.digest().collect {String.format "%02x", it}.join()
1717
}
1818

19-
File.metaClass.json = { -> new JsonSlurper().parseText(delegate.text) }
19+
File.metaClass.json = { -> new JsonSlurper().parseText(delegate.text as String) }
2020

2121
Date.metaClass.iso8601 = { ->
2222
def format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
@@ -81,7 +81,7 @@ class Util {
8181
artifact: [
8282
path: path,
8383
url: url,
84-
sha1: sha1(art.file),
84+
sha1: sha1(art.file as File),
8585
size: art.file.length()
8686
]
8787
]
@@ -125,7 +125,7 @@ class Util {
125125
artifact: [
126126
path: path,
127127
url : url,
128-
sha1: sha1(file),
128+
sha1: sha1(file as File),
129129
size: file.length()
130130
]
131131
],
@@ -154,13 +154,13 @@ class Util {
154154
]
155155
try {
156156
return urlList.stream().map(original -> original + path)
157-
.filter(it -> this::checkExists(it)).findFirst().get()
157+
.filter((String it) -> this::checkExists(it)).findFirst().get()
158158
} catch (NoSuchElementException ignored) {
159159
throw new GradleException("Can't find " + filename + " from defined repositories.\n"
160160
+ "Please check and make sure all repositories are setup properly.\n"
161161
+ "At: com.cleanroommc.gradle.helpers.tasks.Util#getNativeURL(String, String)\n"
162162
+ "Current defined repositories: (Sort by order)\n"
163-
+ String.join("\n" , urlList))
163+
+ String.join("\n" , urlList) as String)
164164
}
165165
}
166166

@@ -215,9 +215,9 @@ class Util {
215215
return getArtifacts(project, cfg, true)
216216
}
217217

218-
private static boolean checkExists(url) {
218+
private static boolean checkExists(String url) {
219219
try {
220-
def code = new URL(url).openConnection().with {
220+
def code = new URI(url).toURL().openConnection().with {
221221
requestMethod = 'HEAD'
222222
connect()
223223
responseCode

0 commit comments

Comments
 (0)