From 5300fefa865384b9e642c6e19eed48de10038f8f Mon Sep 17 00:00:00 2001 From: dgelessus <dgelessus@users.noreply.github.com> Date: Wed, 31 Jul 2024 15:35:12 +0200 Subject: [PATCH] Declare that Translator cannot throw IOException The current BParser APIs don't throw IOExceptions directly anymore and instead wrap them in BCompoundExceptions. --- src/main/java/de/tlc4b/TLC4B.java | 7 +++---- src/main/java/de/tlc4b/Translator.java | 4 +--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/tlc4b/TLC4B.java b/src/main/java/de/tlc4b/TLC4B.java index 5ede59b..96f6562 100644 --- a/src/main/java/de/tlc4b/TLC4B.java +++ b/src/main/java/de/tlc4b/TLC4B.java @@ -108,11 +108,10 @@ public class TLC4B { * Be aware that this method may take a long time to run for large/complex machines. * * @param path path to B machine file - * @throws IOException if files could not be read * @throws BCompoundException if the machine file could not be parsed * @throws TLC4BException if translation fails for any other reason */ - public static void checkTLC4BIsApplicable(String path) throws IOException, BCompoundException { + public static void checkTLC4BIsApplicable(String path) throws BCompoundException { TLC4B tlc4B = new TLC4B(); tlc4B.processArgs(new String[]{path, SILENT.cliArg()}); tlc4B.translate(); @@ -134,7 +133,7 @@ public class TLC4B { try { checkTLC4BIsApplicable(path); return null; - } catch (BCompoundException | IOException | TLC4BException e) { + } catch (BCompoundException | TLC4BException e) { return e; } }); @@ -386,7 +385,7 @@ public class TLC4B { printlnVerbose(""); } - private void translate() throws IOException, BCompoundException { + private void translate() throws BCompoundException { StopWatch.start(PARSING_TIME); MP.printSilent("Parsing... "); translator = new Translator(machineFileNameWithoutFileExtension, diff --git a/src/main/java/de/tlc4b/Translator.java b/src/main/java/de/tlc4b/Translator.java index 9bc7246..ca4c6d1 100644 --- a/src/main/java/de/tlc4b/Translator.java +++ b/src/main/java/de/tlc4b/Translator.java @@ -1,7 +1,6 @@ package de.tlc4b; import java.io.File; -import java.io.IOException; import java.util.Map; import java.util.Set; @@ -58,8 +57,7 @@ public class Translator { start = parser.parseMachine(machineString); } - public Translator(String machineName, File machineFile, String ltlFormula, String constantSetup) - throws BCompoundException, IOException { + public Translator(String machineName, File machineFile, String ltlFormula, String constantSetup) throws BCompoundException { this.machineName = machineName; this.ltlFormula = ltlFormula; -- GitLab