Add IOException checked exception to InternalResource.versionHash(Env).

This commit is contained in:
Christian Humer 2024-11-06 15:14:44 +01:00
parent b8dd73b432
commit 5da3ef9065
5 changed files with 11 additions and 19 deletions

View File

@ -10,6 +10,7 @@ This changelog summarizes major changes between Truffle versions relevant to lan
* GR-57550 Added support for long-width dispatch targets to Bytecode OSR.
* PR-8266 Allow control of `throwDeniedThreadAccess` via `TruffleContext.threadAccessDeniedHandler`
* GR-57817 Java Native access for [JEP-472](https://openjdk.org/jeps/472) is now automatically provided for all languages and tools by Truffle. For more information, refer to the [GraalVM SDK Changelog](https://github.com/oracle/graal/blob/master/sdk/CHANGELOG.md).
* GR-59640 `InternalResource.versionHash(Env)` may now throw an `IOException` to indicate problems when reading the version from disk.
## Version 24.1.0

View File

@ -168,7 +168,7 @@ innr public abstract interface static !annotation Id
innr public final static !enum CPUArchitecture
innr public final static !enum OS
innr public final static Env
meth public abstract java.lang.String versionHash(com.oracle.truffle.api.InternalResource$Env)
meth public abstract java.lang.String versionHash(com.oracle.truffle.api.InternalResource$Env) throws java.io.IOException
meth public abstract void unpackFiles(com.oracle.truffle.api.InternalResource$Env,java.nio.file.Path) throws java.io.IOException
CLSS public final static !enum com.oracle.truffle.api.InternalResource$CPUArchitecture

View File

@ -142,7 +142,7 @@ public interface InternalResource {
*
* @since 23.1
*/
String versionHash(Env env);
String versionHash(Env env) throws IOException;
/**
* Access to common utilities for unpacking resource files.

View File

@ -40,12 +40,11 @@
*/
package com.oracle.truffle.nfi.backend.libffi;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.InternalResource;
import java.io.IOException;
import java.nio.file.Path;
import com.oracle.truffle.api.InternalResource;
@InternalResource.Id(LibNFIResource.ID)
final class LibNFIResource implements InternalResource {
@ -63,13 +62,9 @@ final class LibNFIResource implements InternalResource {
}
@Override
public String versionHash(Env env) {
try {
Path base = basePath(env);
return env.readResourceLines(base.resolve("sha256")).get(0);
} catch (IOException ioe) {
throw CompilerDirectives.shouldNotReachHere(ioe);
}
public String versionHash(Env env) throws IOException {
Path base = basePath(env);
return env.readResourceLines(base.resolve("sha256")).get(0);
}
private static Path basePath(Env env) {

View File

@ -736,13 +736,9 @@ final class JDKSupport {
}
@Override
public String versionHash(Env env) {
try {
Path base = basePath(env);
return env.readResourceLines(base.resolve("sha256")).get(0);
} catch (IOException ioe) {
throw new InternalError(ioe);
}
public String versionHash(Env env) throws IOException {
Path base = basePath(env);
return env.readResourceLines(base.resolve("sha256")).get(0);
}
private static Path basePath(Env env) {