rulesDirs = new OptionKey<>("");
-
- /**
- * Option to specify rules that the user instantiated for a run. The provided value must follow
- * the JSON encoding standard for rule instances:
- *
- *
- * {
- * "instance_id_1": {...},
- * "instance_id_2": {...}
- * }
- *
- *
- * The default value if this option is an empty object. See the {@link
- * com.adacore.lkql_jit.options.RuleInstance RuleInstance} class for more information about rule
- * instance JSON encoding.
- */
- @Option(
- help = "The JSON encoded rule instances, the value must be a JSON object",
category = OptionCategory.INTERNAL,
stability = OptionStability.STABLE)
- public static final OptionKey ruleInstances = new OptionKey<>("{}");
-
- /** The option to control what should be done when no rules are provided */
- @Option(
- help = "If true, consider that an empty value for 'rules' means to run all the rules",
- category = OptionCategory.USER,
- stability = OptionStability.STABLE)
- static final OptionKey fallbackToAllRules = new OptionKey<>(true);
-
- /** The option to control what should be done when a source file cannot be found. */
- @Option(
- help = "If true, do not stop the engine when a source file cannot be found",
- category = OptionCategory.USER,
- stability = OptionStability.STABLE)
- static final OptionKey keepGoingOnMissingFile = new OptionKey<>(false);
-
- /**
- * The option to control whether to display the instantiation chains when reporting something on
- * a generic construct.
- */
- @Option(
- help = "If true, display generic instantiation chain",
- category = OptionCategory.USER,
- stability = OptionStability.STABLE)
- static final OptionKey showInstantiationChain = new OptionKey<>(false);
-
- /** The option to specify the files to ignore during the checking. */
- @Option(
- help = "Files to ignore during the analysis",
- category = OptionCategory.USER,
- stability = OptionStability.STABLE)
- static final OptionKey ignores = new OptionKey<>("");
-
- /** The option to specify the error recovery mode. */
- @Option(
- help = "The mode of error recovery in the checker",
- category = OptionCategory.USER,
- stability = OptionStability.STABLE)
- static final OptionKey errorMode = new OptionKey<>("");
-
- @Option(
- help = "The message emitter",
- category = OptionCategory.USER,
- stability = OptionStability.STABLE)
- static final OptionKey diagnosticOutputMode =
- new OptionKey<>(DiagnosticOutputMode.PRETTY);
+ static final OptionKey options = new OptionKey<>("{}");
Liblkqllang.AnalysisContext lkqlAnalysisContext;
diff --git a/lkql_jit/options/pom.xml b/lkql_jit/options/pom.xml
new file mode 100644
index 000000000..88bfc3a3e
--- /dev/null
+++ b/lkql_jit/options/pom.xml
@@ -0,0 +1,37 @@
+
+
+ 4.0.0
+
+
+ lkql_jit
+ com.adacore
+ 0.1.0
+
+
+ options
+
+
+
+
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ 2.40.0
+
+ true
+
+
+
+
+
+
+
+ org.json
+ json
+ 20240303
+
+
+
+
diff --git a/lkql_jit/options/src/main/java/com/adacore/lkql_jit/JSONUtils.java b/lkql_jit/options/src/main/java/com/adacore/lkql_jit/JSONUtils.java
new file mode 100644
index 000000000..41db05a01
--- /dev/null
+++ b/lkql_jit/options/src/main/java/com/adacore/lkql_jit/JSONUtils.java
@@ -0,0 +1,20 @@
+//
+// Copyright (C) 2005-2024, AdaCore
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+package com.adacore.lkql_jit; //
+
+import java.util.Map;
+import java.util.stream.Collectors;
+import org.json.JSONObject;
+
+/** This class contains all util functions to handle JSON */
+public final class JSONUtils {
+ /** Given a JSON object, parse it as a String to String map and return the result. */
+ public static Map parseStringMap(JSONObject jsonObject) {
+ return jsonObject.toMap().entrySet().stream()
+ .map(e -> Map.entry(e.getKey(), (String) e.getValue()))
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+ }
+}
diff --git a/lkql_jit/options/src/main/java/com/adacore/lkql_jit/LKQLOptions.java b/lkql_jit/options/src/main/java/com/adacore/lkql_jit/LKQLOptions.java
new file mode 100644
index 000000000..8018dcbc5
--- /dev/null
+++ b/lkql_jit/options/src/main/java/com/adacore/lkql_jit/LKQLOptions.java
@@ -0,0 +1,294 @@
+//
+// Copyright (C) 2005-2024, AdaCore
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+package com.adacore.lkql_jit;
+
+import java.util.*;
+import java.util.stream.Collectors;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+/**
+ * This record contains all options to tune the LKQL engine. It is serializable and deserializable
+ * using the JSON format.
+ */
+public record LKQLOptions(
+ boolean verbose,
+ Optional charset,
+ Optional projectFile,
+ Optional subprojectFile,
+ Optional runtime,
+ Optional target,
+ Optional configFile,
+ Map scenarioVariables,
+ List files,
+ List ignores,
+ List rulesDirs,
+ Map ruleInstances,
+ boolean checkerDebug,
+ boolean fallbackToAllRules,
+ boolean keepGoingOnMissingFile,
+ boolean showInstantiationChain,
+ DiagnosticOutputMode diagnosticOutputMode) {
+
+ // ----- Constructors -----
+
+ public LKQLOptions {
+ // Ensure that there is no null values in the LKQL options, also ensure that all
+ // contained values are strictly unmodifiable.
+ if (scenarioVariables == null) {
+ scenarioVariables = Map.of();
+ } else {
+ scenarioVariables = Collections.unmodifiableMap(scenarioVariables);
+ }
+
+ if (files == null) {
+ files = List.of();
+ } else {
+ files = Collections.unmodifiableList(files);
+ }
+
+ if (ignores == null) {
+ ignores = List.of();
+ } else {
+ ignores = Collections.unmodifiableList(ignores);
+ }
+
+ if (rulesDirs == null) {
+ rulesDirs = List.of();
+ } else {
+ rulesDirs = Collections.unmodifiableList(rulesDirs);
+ }
+
+ if (ruleInstances == null) {
+ ruleInstances = Map.of();
+ } else {
+ ruleInstances = Collections.unmodifiableMap(ruleInstances);
+ }
+
+ if (diagnosticOutputMode == null) {
+ diagnosticOutputMode = DiagnosticOutputMode.PRETTY;
+ }
+ }
+
+ // ----- Class methods -----
+
+ /** Create an LKQL options object from the provided JSON object. */
+ public static LKQLOptions fromJson(JSONObject jsonLKQLOptions) {
+ final Map ruleInstances = new HashMap<>();
+ final var ruleInstancesJson = jsonLKQLOptions.getJSONObject("ruleInstances");
+ for (String instanceName : ruleInstancesJson.keySet()) {
+ ruleInstances.put(
+ instanceName,
+ RuleInstance.fromJson(ruleInstancesJson.getJSONObject(instanceName)));
+ }
+ return new LKQLOptions(
+ jsonLKQLOptions.getBoolean("verbose"),
+ Optional.ofNullable(jsonLKQLOptions.optString("charset", null)),
+ Optional.ofNullable(jsonLKQLOptions.optString("projectFile", null)),
+ Optional.ofNullable(jsonLKQLOptions.optString("subprojectFile", null)),
+ Optional.ofNullable(jsonLKQLOptions.optString("runtime", null)),
+ Optional.ofNullable(jsonLKQLOptions.optString("target", null)),
+ Optional.ofNullable(jsonLKQLOptions.optString("configFile", null)),
+ JSONUtils.parseStringMap(jsonLKQLOptions.getJSONObject("scenarioVariables")),
+ jsonLKQLOptions.getJSONArray("files").toList().stream()
+ .map(e -> (String) e)
+ .toList(),
+ jsonLKQLOptions.getJSONArray("ignores").toList().stream()
+ .map(e -> (String) e)
+ .toList(),
+ jsonLKQLOptions.getJSONArray("rulesDirs").toList().stream()
+ .map(e -> (String) e)
+ .toList(),
+ ruleInstances,
+ jsonLKQLOptions.getBoolean("checkerDebug"),
+ jsonLKQLOptions.getBoolean("fallbackToAllRules"),
+ jsonLKQLOptions.getBoolean("keepGoingOnMissingFile"),
+ jsonLKQLOptions.getBoolean("showInstantiationChain"),
+ DiagnosticOutputMode.valueOf(jsonLKQLOptions.getString("diagnosticOutputMode")));
+ }
+
+ // ----- Instance methods -----
+
+ /** Serialize the LKQL options to a JSON object. */
+ public JSONObject toJson() {
+ final var ruleInstancesJson =
+ new JSONObject(
+ this.ruleInstances.entrySet().stream()
+ .map(e -> Map.entry(e.getKey(), e.getValue().toJson()))
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));
+ return new JSONObject()
+ .put("verbose", verbose)
+ .put("charset", charset.orElse(null))
+ .put("projectFile", projectFile.orElse(null))
+ .put("subprojectFile", subprojectFile.orElse(null))
+ .put("runtime", runtime.orElse(null))
+ .put("target", target.orElse(null))
+ .put("configFile", configFile.orElse(null))
+ .put("scenarioVariables", new JSONObject(scenarioVariables))
+ .put("files", new JSONArray(files))
+ .put("ignores", new JSONArray(ignores))
+ .put("rulesDirs", new JSONArray(rulesDirs))
+ .put("ruleInstances", ruleInstancesJson)
+ .put("checkerDebug", checkerDebug)
+ .put("fallbackToAllRules", fallbackToAllRules)
+ .put("keepGoingOnMissingFile", keepGoingOnMissingFile)
+ .put("showInstantiationChain", showInstantiationChain)
+ .put("diagnosticOutputMode", diagnosticOutputMode.toString());
+ }
+
+ // ----- Inner classes -----
+
+ /** The way diagnostics are output by the LKQL engine. */
+ public enum DiagnosticOutputMode {
+ /**
+ * Emit a pretty diagnostic with source listing where the diagnostic location is
+ * highlighted.
+ */
+ PRETTY,
+
+ /** Use a GNATCheck-compliant format: "{file}:{line}:{col} check: {message} [{check}]". */
+ GNATCHECK
+ }
+
+ /** Util class to build a new LKQL options object. */
+ public static final class Builder {
+
+ // ----- Options -----
+
+ private boolean verbose = false;
+ private Optional charset = Optional.empty();
+ private Optional projectFile = Optional.empty();
+ private Optional subprojectFile = Optional.empty();
+ private Optional runtime = Optional.empty();
+ private Optional target = Optional.empty();
+ private Optional configFile = Optional.empty();
+ private Map scenarioVariables = new HashMap<>();
+ private List files = new ArrayList<>();
+ private List ignores = new ArrayList<>();
+ private List rulesDirs = new ArrayList<>();
+ private Map ruleInstances = new HashMap<>();
+ private boolean checkerDebug = false;
+ private boolean fallbackToAllRules = false;
+ private boolean keepGoingOnMissingFile = false;
+ private boolean showInstantiationChain = false;
+ private DiagnosticOutputMode diagnosticOutputMode = DiagnosticOutputMode.PRETTY;
+
+ // ----- Setters -----
+
+ public Builder verbose(boolean v) {
+ verbose = v;
+ return this;
+ }
+
+ public Builder charset(String c) {
+ charset = Optional.ofNullable(c);
+ return this;
+ }
+
+ public Builder projectFile(String pf) {
+ projectFile = Optional.ofNullable(pf);
+ return this;
+ }
+
+ public Builder subprojectFile(String spf) {
+ subprojectFile = Optional.ofNullable((spf));
+ return this;
+ }
+
+ public Builder runtime(String r) {
+ runtime = Optional.ofNullable(r);
+ return this;
+ }
+
+ public Builder target(String t) {
+ target = Optional.ofNullable(t);
+ return this;
+ }
+
+ public Builder configFile(String cf) {
+ configFile = Optional.ofNullable(cf);
+ return this;
+ }
+
+ public Builder scenarioVariables(Map sv) {
+ this.scenarioVariables = sv;
+ return this;
+ }
+
+ public Builder files(List files) {
+ this.files = files;
+ return this;
+ }
+
+ public Builder addFile(String f) {
+ files.add(f);
+ return this;
+ }
+
+ public Builder ignores(List i) {
+ this.ignores = i;
+ return this;
+ }
+
+ public Builder rulesDir(List rd) {
+ this.rulesDirs = rd;
+ return this;
+ }
+
+ public Builder ruleInstances(Map ri) {
+ this.ruleInstances = ri;
+ return this;
+ }
+
+ public Builder checkerDebug(boolean cd) {
+ checkerDebug = cd;
+ return this;
+ }
+
+ public Builder fallbackToAllRules(boolean fbtar) {
+ fallbackToAllRules = fbtar;
+ return this;
+ }
+
+ public Builder keepGoingOnMissingFile(boolean kgomf) {
+ keepGoingOnMissingFile = kgomf;
+ return this;
+ }
+
+ public Builder showInstantiationChain(boolean sic) {
+ showInstantiationChain = sic;
+ return this;
+ }
+
+ public Builder diagnosticOutputMode(DiagnosticOutputMode dom) {
+ diagnosticOutputMode = dom;
+ return this;
+ }
+
+ // ----- Instance methods -----
+
+ public LKQLOptions build() {
+ return new LKQLOptions(
+ verbose,
+ charset,
+ projectFile,
+ subprojectFile,
+ runtime,
+ target,
+ configFile,
+ scenarioVariables,
+ files,
+ ignores,
+ rulesDirs,
+ ruleInstances,
+ checkerDebug,
+ fallbackToAllRules,
+ keepGoingOnMissingFile,
+ showInstantiationChain,
+ diagnosticOutputMode);
+ }
+ }
+}
diff --git a/lkql_jit/cli/src/main/java/com/adacore/lkql_jit/options/RuleInstance.java b/lkql_jit/options/src/main/java/com/adacore/lkql_jit/RuleInstance.java
similarity index 91%
rename from lkql_jit/cli/src/main/java/com/adacore/lkql_jit/options/RuleInstance.java
rename to lkql_jit/options/src/main/java/com/adacore/lkql_jit/RuleInstance.java
index 8816dd5cd..54db60906 100644
--- a/lkql_jit/cli/src/main/java/com/adacore/lkql_jit/options/RuleInstance.java
+++ b/lkql_jit/options/src/main/java/com/adacore/lkql_jit/RuleInstance.java
@@ -3,11 +3,10 @@
// SPDX-License-Identifier: GPL-3.0-or-later
//
-package com.adacore.lkql_jit.options;
+package com.adacore.lkql_jit;
import java.util.Map;
import java.util.Optional;
-import java.util.stream.Collectors;
import org.json.JSONException;
import org.json.JSONObject;
@@ -51,14 +50,14 @@ public record RuleInstance(
}
}
+ // ----- Constructors -----
+
public static RuleInstance fromJson(JSONObject jsonObject) throws JSONException {
return new RuleInstance(
jsonObject.getString("ruleName"),
Optional.ofNullable(jsonObject.optString("instanceName", null)),
SourceMode.valueOf(jsonObject.getString("sourceMode")),
- jsonObject.getJSONObject("arguments").toMap().entrySet().stream()
- .map(e -> Map.entry(e.getKey(), (String) e.getValue()))
- .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));
+ JSONUtils.parseStringMap(jsonObject.getJSONObject("arguments")));
}
// ----- Instance methods -----
diff --git a/lkql_jit/options/src/main/java/com/adacore/lkql_jit/package-info.java b/lkql_jit/options/src/main/java/com/adacore/lkql_jit/package-info.java
new file mode 100644
index 000000000..c7df8e5b5
--- /dev/null
+++ b/lkql_jit/options/src/main/java/com/adacore/lkql_jit/package-info.java
@@ -0,0 +1,2 @@
+/** This package contains all classes and tools to forward options to the LKQL engine. */
+package com.adacore.lkql_jit;
diff --git a/lkql_jit/pom.xml b/lkql_jit/pom.xml
index 795901057..d8c8e9295 100644
--- a/lkql_jit/pom.xml
+++ b/lkql_jit/pom.xml
@@ -10,6 +10,7 @@
0.1.0
language
+ options
cli
native
component
@@ -122,6 +123,7 @@
language/src/main/java/**/*.java
+ options/src/main/java/**/*.java
cli/src/main/java/**/*.java
benchmarks/src/test/java/**/*.java
diff --git a/testsuite/tests/interop/function/Main.java b/testsuite/tests/interop/function/Main.java
index 0fcbf6c3b..463eb542b 100644
--- a/testsuite/tests/interop/function/Main.java
+++ b/testsuite/tests/interop/function/Main.java
@@ -1,3 +1,4 @@
+import com.adacore.lkql_jit.LKQLOptions;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
@@ -12,9 +13,15 @@ private static void print(String messageName, Object value) {
}
public static void main(String[] args) {
- Context context = Context.newBuilder("lkql")
- .option("lkql.projectFile", "default_project/default.gpr")
- .build();
+ Context context = Context
+ .newBuilder("lkql")
+ .option(
+ "lkql.options", new LKQLOptions.Builder()
+ .projectFile("default_project/default.gpr")
+ .build()
+ .toJson()
+ .toString()
+ ).build();
Value executable = context.parse("lkql", LKQL_SOURCE);
Value namespace = executable.execute(false);
diff --git a/testsuite/tests/interop/iterator/Main.java b/testsuite/tests/interop/iterator/Main.java
index 01755bd08..392a87540 100644
--- a/testsuite/tests/interop/iterator/Main.java
+++ b/testsuite/tests/interop/iterator/Main.java
@@ -1,3 +1,4 @@
+import com.adacore.lkql_jit.LKQLOptions;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
@@ -7,7 +8,15 @@ private static void print(String messageName, Object value) {
}
public static void main(String[] args) {
- Context context = Context.newBuilder("lkql").build();
+ Context context = Context
+ .newBuilder("lkql")
+ .option(
+ "lkql.options", new LKQLOptions.Builder()
+ .projectFile("default_project/default.gpr")
+ .build()
+ .toJson()
+ .toString()
+ ).build();
Value executable = context.parse("lkql", "val list = [1, \"Hello\", [1, 2]]");
Value namespace = executable.execute(false);
diff --git a/testsuite/tests/interop/list/Main.java b/testsuite/tests/interop/list/Main.java
index 5098ce0a9..b6f384c44 100644
--- a/testsuite/tests/interop/list/Main.java
+++ b/testsuite/tests/interop/list/Main.java
@@ -1,3 +1,4 @@
+import com.adacore.lkql_jit.LKQLOptions;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
@@ -13,9 +14,15 @@ private static void print(String messageName, Object value) {
}
public static void main(String[] args) {
- Context context = Context.newBuilder("lkql")
- .option("lkql.projectFile", "default_project/default.gpr")
- .build();
+ Context context = Context
+ .newBuilder("lkql")
+ .option(
+ "lkql.options", new LKQLOptions.Builder()
+ .projectFile("default_project/default.gpr")
+ .build()
+ .toJson()
+ .toString()
+ ).build();
Value executable = context.parse("lkql", LKQL_SOURCE);
Value namespace = executable.execute(false);
diff --git a/testsuite/tests/interop/list_comp/Main.java b/testsuite/tests/interop/list_comp/Main.java
index f7178bde9..328c44022 100644
--- a/testsuite/tests/interop/list_comp/Main.java
+++ b/testsuite/tests/interop/list_comp/Main.java
@@ -1,3 +1,4 @@
+import com.adacore.lkql_jit.LKQLOptions;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
@@ -13,9 +14,15 @@ private static void print(String messageName, Object value) {
}
public static void main(String[] args) {
- Context context = Context.newBuilder("lkql")
- .option("lkql.projectFile", "default_project/default.gpr")
- .build();
+ Context context = Context
+ .newBuilder("lkql")
+ .option(
+ "lkql.options", new LKQLOptions.Builder()
+ .projectFile("default_project/default.gpr")
+ .build()
+ .toJson()
+ .toString()
+ ).build();
Value executable = context.parse("lkql", LKQL_SOURCE);
Value namespace = executable.execute(false);
diff --git a/testsuite/tests/interop/namespace/Main.java b/testsuite/tests/interop/namespace/Main.java
index 4c7bffc62..4cbef4271 100644
--- a/testsuite/tests/interop/namespace/Main.java
+++ b/testsuite/tests/interop/namespace/Main.java
@@ -1,3 +1,4 @@
+import com.adacore.lkql_jit.LKQLOptions;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
@@ -12,9 +13,15 @@ private static void print(String messageName, Object value) {
}
public static void main(String[] args) {
- Context context = Context.newBuilder("lkql")
- .option("lkql.projectFile", "default_project/default.gpr")
- .build();
+ Context context = Context
+ .newBuilder("lkql")
+ .option(
+ "lkql.options", new LKQLOptions.Builder()
+ .projectFile("default_project/default.gpr")
+ .build()
+ .toJson()
+ .toString()
+ ).build();
Value executable = context.parse("lkql", LKQL_SOURCE);
Value namespace = executable.execute(false);
diff --git a/testsuite/tests/interop/null/Main.java b/testsuite/tests/interop/null/Main.java
index 417d32951..5ac511cac 100644
--- a/testsuite/tests/interop/null/Main.java
+++ b/testsuite/tests/interop/null/Main.java
@@ -1,3 +1,4 @@
+import com.adacore.lkql_jit.LKQLOptions;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
@@ -12,9 +13,15 @@ private static void print(String messageName, Object value) {
}
public static void main(String[] args) {
- Context context = Context.newBuilder("lkql")
- .option("lkql.projectFile", "default_project/default.gpr")
- .build();
+ Context context = Context
+ .newBuilder("lkql")
+ .option(
+ "lkql.options", new LKQLOptions.Builder()
+ .projectFile("default_project/default.gpr")
+ .build()
+ .toJson()
+ .toString()
+ ).build();
Value executable = context.parse("lkql", LKQL_SOURCE);
Value namespace = executable.execute(false);
diff --git a/testsuite/tests/interop/object/Main.java b/testsuite/tests/interop/object/Main.java
index bc84053fd..9f9d788bd 100644
--- a/testsuite/tests/interop/object/Main.java
+++ b/testsuite/tests/interop/object/Main.java
@@ -1,3 +1,4 @@
+import com.adacore.lkql_jit.LKQLOptions;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
@@ -12,9 +13,15 @@ private static void print(String messageName, Object value) {
}
public static void main(String[] args) {
- Context context = Context.newBuilder("lkql")
- .option("lkql.projectFile", "default_project/default.gpr")
- .build();
+ Context context = Context
+ .newBuilder("lkql")
+ .option(
+ "lkql.options", new LKQLOptions.Builder()
+ .projectFile("default_project/default.gpr")
+ .build()
+ .toJson()
+ .toString()
+ ).build();
Value executable = context.parse("lkql", LKQL_SOURCE);
Value namespace = executable.execute(false);
diff --git a/testsuite/tests/interop/pattern/Main.java b/testsuite/tests/interop/pattern/Main.java
index 58acdbe45..e83f11f51 100644
--- a/testsuite/tests/interop/pattern/Main.java
+++ b/testsuite/tests/interop/pattern/Main.java
@@ -1,3 +1,4 @@
+import com.adacore.lkql_jit.LKQLOptions;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
@@ -12,9 +13,15 @@ private static void print(String messageName, Object value) {
}
public static void main(String[] args) {
- Context context = Context.newBuilder("lkql")
- .option("lkql.projectFile", "default_project/default.gpr")
- .build();
+ Context context = Context
+ .newBuilder("lkql")
+ .option(
+ "lkql.options", new LKQLOptions.Builder()
+ .projectFile("default_project/default.gpr")
+ .build()
+ .toJson()
+ .toString()
+ ).build();
Value executable = context.parse("lkql", LKQL_SOURCE);
Value namespace = executable.execute(false);
diff --git a/testsuite/tests/interop/property/Main.java b/testsuite/tests/interop/property/Main.java
index a7ad0e482..3a5482081 100644
--- a/testsuite/tests/interop/property/Main.java
+++ b/testsuite/tests/interop/property/Main.java
@@ -1,3 +1,4 @@
+import com.adacore.lkql_jit.LKQLOptions;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
@@ -12,9 +13,15 @@ private static void print(String messageName, Object value) {
}
public static void main(String[] args) {
- Context context = Context.newBuilder("lkql")
- .option("lkql.projectFile", "default_project/default.gpr")
- .build();
+ Context context = Context
+ .newBuilder("lkql")
+ .option(
+ "lkql.options", new LKQLOptions.Builder()
+ .projectFile("default_project/default.gpr")
+ .build()
+ .toJson()
+ .toString()
+ ).build();
Value executable = context.parse("lkql", LKQL_SOURCE);
Value namespace = executable.execute(false);
diff --git a/testsuite/tests/interop/selector/Main.java b/testsuite/tests/interop/selector/Main.java
index 68243fe30..1044eabf8 100644
--- a/testsuite/tests/interop/selector/Main.java
+++ b/testsuite/tests/interop/selector/Main.java
@@ -1,3 +1,4 @@
+import com.adacore.lkql_jit.LKQLOptions;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
@@ -16,9 +17,15 @@ private static void print(String messageName, Object value) {
}
public static void main(String[] args) {
- Context context = Context.newBuilder("lkql")
- .option("lkql.projectFile", "default_project/default.gpr")
- .build();
+ Context context = Context
+ .newBuilder("lkql")
+ .option(
+ "lkql.options", new LKQLOptions.Builder()
+ .projectFile("default_project/default.gpr")
+ .build()
+ .toJson()
+ .toString()
+ ).build();
Value executable = context.parse("lkql", LKQL_SOURCE);
Value namespace = executable.execute(false);
diff --git a/testsuite/tests/interop/tuple/Main.java b/testsuite/tests/interop/tuple/Main.java
index e31b645fc..8344a82ef 100644
--- a/testsuite/tests/interop/tuple/Main.java
+++ b/testsuite/tests/interop/tuple/Main.java
@@ -1,3 +1,4 @@
+import com.adacore.lkql_jit.LKQLOptions;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
@@ -12,9 +13,15 @@ private static void print(String messageName, Object value) {
}
public static void main(String[] args) {
- Context context = Context.newBuilder("lkql")
- .option("lkql.projectFile", "default_project/default.gpr")
- .build();
+ Context context = Context
+ .newBuilder("lkql")
+ .option(
+ "lkql.options", new LKQLOptions.Builder()
+ .projectFile("default_project/default.gpr")
+ .build()
+ .toJson()
+ .toString()
+ ).build();
Value executable = context.parse("lkql", LKQL_SOURCE);
Value namespace = executable.execute(false);
diff --git a/testsuite/tests/interop/unit/Main.java b/testsuite/tests/interop/unit/Main.java
index 5e7437f55..d07655316 100644
--- a/testsuite/tests/interop/unit/Main.java
+++ b/testsuite/tests/interop/unit/Main.java
@@ -1,3 +1,4 @@
+import com.adacore.lkql_jit.LKQLOptions;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
@@ -12,9 +13,15 @@ private static void print(String messageName, Object value) {
}
public static void main(String[] args) {
- Context context = Context.newBuilder("lkql")
- .option("lkql.projectFile", "default_project/default.gpr")
- .build();
+ Context context = Context
+ .newBuilder("lkql")
+ .option(
+ "lkql.options", new LKQLOptions.Builder()
+ .projectFile("default_project/default.gpr")
+ .build()
+ .toJson()
+ .toString()
+ ).build();
Value executable = context.parse("lkql", LKQL_SOURCE);
Value namespace = executable.execute(false);