Skip to content

Commit 5da3ef9

Browse files
committed
Add IOException checked exception to InternalResource.versionHash(Env).
1 parent b8dd73b commit 5da3ef9

File tree

5 files changed

+11
-19
lines changed

5 files changed

+11
-19
lines changed

truffle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This changelog summarizes major changes between Truffle versions relevant to lan
1010
* GR-57550 Added support for long-width dispatch targets to Bytecode OSR.
1111
* PR-8266 Allow control of `throwDeniedThreadAccess` via `TruffleContext.threadAccessDeniedHandler`
1212
* 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).
13+
* GR-59640 `InternalResource.versionHash(Env)` may now throw an `IOException` to indicate problems when reading the version from disk.
1314

1415

1516
## Version 24.1.0

truffle/src/com.oracle.truffle.api/snapshot.sigtest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ innr public abstract interface static !annotation Id
168168
innr public final static !enum CPUArchitecture
169169
innr public final static !enum OS
170170
innr public final static Env
171-
meth public abstract java.lang.String versionHash(com.oracle.truffle.api.InternalResource$Env)
171+
meth public abstract java.lang.String versionHash(com.oracle.truffle.api.InternalResource$Env) throws java.io.IOException
172172
meth public abstract void unpackFiles(com.oracle.truffle.api.InternalResource$Env,java.nio.file.Path) throws java.io.IOException
173173

174174
CLSS public final static !enum com.oracle.truffle.api.InternalResource$CPUArchitecture

truffle/src/com.oracle.truffle.api/src/com/oracle/truffle/api/InternalResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public interface InternalResource {
142142
*
143143
* @since 23.1
144144
*/
145-
String versionHash(Env env);
145+
String versionHash(Env env) throws IOException;
146146

147147
/**
148148
* Access to common utilities for unpacking resource files.

truffle/src/com.oracle.truffle.nfi.backend.libffi/src/com/oracle/truffle/nfi/backend/libffi/LibNFIResource.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@
4040
*/
4141
package com.oracle.truffle.nfi.backend.libffi;
4242

43-
import com.oracle.truffle.api.CompilerDirectives;
44-
import com.oracle.truffle.api.InternalResource;
45-
4643
import java.io.IOException;
4744
import java.nio.file.Path;
4845

46+
import com.oracle.truffle.api.InternalResource;
47+
4948
@InternalResource.Id(LibNFIResource.ID)
5049
final class LibNFIResource implements InternalResource {
5150

@@ -63,13 +62,9 @@ public void unpackFiles(Env env, Path targetDirectory) throws IOException {
6362
}
6463

6564
@Override
66-
public String versionHash(Env env) {
67-
try {
68-
Path base = basePath(env);
69-
return env.readResourceLines(base.resolve("sha256")).get(0);
70-
} catch (IOException ioe) {
71-
throw CompilerDirectives.shouldNotReachHere(ioe);
72-
}
65+
public String versionHash(Env env) throws IOException {
66+
Path base = basePath(env);
67+
return env.readResourceLines(base.resolve("sha256")).get(0);
7368
}
7469

7570
private static Path basePath(Env env) {

truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/JDKSupport.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -736,13 +736,9 @@ public void unpackFiles(Env env, Path targetDirectory) throws IOException {
736736
}
737737

738738
@Override
739-
public String versionHash(Env env) {
740-
try {
741-
Path base = basePath(env);
742-
return env.readResourceLines(base.resolve("sha256")).get(0);
743-
} catch (IOException ioe) {
744-
throw new InternalError(ioe);
745-
}
739+
public String versionHash(Env env) throws IOException {
740+
Path base = basePath(env);
741+
return env.readResourceLines(base.resolve("sha256")).get(0);
746742
}
747743

748744
private static Path basePath(Env env) {

0 commit comments

Comments
 (0)