Skip to content

Commit c9539d8

Browse files
committed
[GR-59640] Add IOException checked exception to InternalResource.versionHash(Env).
PullRequest: graal/19237
2 parents 806c89a + 5da3ef9 commit c9539d8

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
@@ -12,6 +12,7 @@ This changelog summarizes major changes between Truffle versions relevant to lan
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).
1313
* GR-46292 The deprecated `TruffleInstrument.Provider` and `TruffleLanguage.Provider` interfaces, deprecated since version 23.1, have now been removed. They are replaced by the `com.oracle.truffle.api.provider.TruffleLanguageProvider` and `com.oracle.truffle.api.instrumentation.provider.TruffleInstrumentProvider` interfaces. The implementations of these interfaces are automatically generated by the annotation processor and this change requires no source code modifications, only recompilation.
1414
* GR-46293 The deprecated `com.oracle.truffle.api.library.DefaultExportProvider` and `com.oracle.truffle.api.library.EagerExportProvider` interfaces, deprecated since version 23.1, have now been removed. They are replaced by the `com.oracle.truffle.api.library.provider.DefaultExportProvider` and `com.oracle.truffle.api.library.provider.EagerExportProvider` interfaces. The implementations of these interfaces are automatically generated by the annotation processor and this change requires no source code modifications, only recompilation.
15+
* GR-59640 `InternalResource.versionHash(Env)` may now throw an `IOException` to indicate problems when reading the version from disk.
1516

1617

1718
## 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
@@ -726,13 +726,9 @@ public void unpackFiles(Env env, Path targetDirectory) throws IOException {
726726
}
727727

728728
@Override
729-
public String versionHash(Env env) {
730-
try {
731-
Path base = basePath(env);
732-
return env.readResourceLines(base.resolve("sha256")).get(0);
733-
} catch (IOException ioe) {
734-
throw new InternalError(ioe);
735-
}
729+
public String versionHash(Env env) throws IOException {
730+
Path base = basePath(env);
731+
return env.readResourceLines(base.resolve("sha256")).get(0);
736732
}
737733

738734
private static Path basePath(Env env) {

0 commit comments

Comments
 (0)