From 4a5beb010296ca7c0d6e866ebbc87a8177c69094 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Fri, 25 Nov 2022 10:36:46 +0100 Subject: [PATCH] Make Java runfiles library compilable with JDK 8 The `FileReader(String,Charset)` constructor is not available in Java 8. --- tools/java/runfiles/Runfiles.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/java/runfiles/Runfiles.java b/tools/java/runfiles/Runfiles.java index 171d1b2078ade4..a573cad922ad0c 100644 --- a/tools/java/runfiles/Runfiles.java +++ b/tools/java/runfiles/Runfiles.java @@ -410,7 +410,8 @@ private static Map loadRepositoryMapping(Strin return Collections.emptyMap(); } - try (BufferedReader r = new BufferedReader(new FileReader(path, StandardCharsets.UTF_8))) { + try (BufferedReader r = new BufferedReader( + new InputStreamReader(new FileInputStream(path), StandardCharsets.UTF_8))) { return Collections.unmodifiableMap( r.lines() .filter(line -> !line.isEmpty())