From 4f22e76d2b95949b0032471a9b6b52cc70322708 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sat, 25 Nov 2023 20:22:16 +0200 Subject: [PATCH] fix: make code java 11 compatible --- src/me/topchetoeu/jscript/engine/values/FunctionValue.java | 2 +- src/me/topchetoeu/jscript/filesystem/FilesystemException.java | 4 ++-- src/me/topchetoeu/jscript/permissions/Permission.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/me/topchetoeu/jscript/engine/values/FunctionValue.java b/src/me/topchetoeu/jscript/engine/values/FunctionValue.java index 01eb281..4506cb0 100644 --- a/src/me/topchetoeu/jscript/engine/values/FunctionValue.java +++ b/src/me/topchetoeu/jscript/engine/values/FunctionValue.java @@ -11,7 +11,7 @@ public abstract class FunctionValue extends ObjectValue { @Override public String toString() { - return "function %s(...)".formatted(name); + return String.format("function %s(...)", name); } public abstract Object call(Context ctx, Object thisArg, Object ...args); diff --git a/src/me/topchetoeu/jscript/filesystem/FilesystemException.java b/src/me/topchetoeu/jscript/filesystem/FilesystemException.java index 63745e3..21028e3 100644 --- a/src/me/topchetoeu/jscript/filesystem/FilesystemException.java +++ b/src/me/topchetoeu/jscript/filesystem/FilesystemException.java @@ -34,13 +34,13 @@ public class FilesystemException extends RuntimeException { public final FSCode code; public FilesystemException(String message, String filename, FSCode code) { - super(code + ": " + message.formatted(filename)); + super(code + ": " + String.format(message, filename)); this.message = message; this.code = code; this.filename = filename; } public FilesystemException(String filename, FSCode code) { - super(code + ": " + MESSAGES[code.code].formatted(filename)); + super(code + ": " + String.format(MESSAGES[code.code], filename)); this.message = MESSAGES[code.code]; this.code = code; this.filename = filename; diff --git a/src/me/topchetoeu/jscript/permissions/Permission.java b/src/me/topchetoeu/jscript/permissions/Permission.java index 7c8b591..c5dae7d 100644 --- a/src/me/topchetoeu/jscript/permissions/Permission.java +++ b/src/me/topchetoeu/jscript/permissions/Permission.java @@ -9,7 +9,7 @@ public class Permission { @Override public String toString() { - return "State [pr=%s;trg=%s;wildN=%s;wild=%s]".formatted(predI, trgI, wildcardI, wildcard); + return String.format("State [pr=%s;trg=%s;wildN=%s;wild=%s]", predI, trgI, wildcardI, wildcard); } public State(int predicateI, int targetI, int wildcardI, boolean wildcard) {