mirror of
https://github.com/apple/pkl.git
synced 2026-06-29 08:46:22 +02:00
Support building with JDK 21 (#234)
- Update google-java-format to a version compatible with JDK 21 and run "gw spotlessApply". - Fix wrong test assumption JavaCodeGenerator writes a properties file using java.util.Properties, which doesn't guarantee order of entries. - Fix most deprecation warnings - Add CI job for JDK 21
This commit is contained in:
@@ -304,8 +304,7 @@ public final class ResourceReaders {
|
||||
}
|
||||
|
||||
try {
|
||||
var url = IoUtils.toUrl(uri);
|
||||
var content = IoUtils.readBytes(url);
|
||||
var content = IoUtils.readBytes(uri);
|
||||
return Optional.of(new Resource(uri, content));
|
||||
} catch (FileNotFoundException e) {
|
||||
return Optional.empty();
|
||||
|
||||
@@ -111,11 +111,11 @@ public final class IoUtils {
|
||||
return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public static byte[] readBytes(URL url) throws IOException {
|
||||
if (HttpUtils.isHttpUrl(url)) {
|
||||
throw new IllegalArgumentException("Should use HTTP client to GET " + url);
|
||||
public static byte[] readBytes(URI uri) throws IOException {
|
||||
if (HttpUtils.isHttpUrl(uri)) {
|
||||
throw new IllegalArgumentException("Should use HTTP client to GET " + uri);
|
||||
}
|
||||
try (var stream = url.openStream()) {
|
||||
try (var stream = IoUtils.toUrl(uri).openStream()) {
|
||||
return stream.readAllBytes();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user