From ecdb795239450ed16e166c48f502b0e68977a265 Mon Sep 17 00:00:00 2001 From: Remi SEGARD Date: Tue, 16 Apr 2024 11:11:52 +0200 Subject: [PATCH] Change Array types in tests to native java arrays --- .../tests/java_api/config_pragmas/ConfigPragmas.java | 10 +++++----- testsuite/tests/java_api/gpr_context/GPRContext.java | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/testsuite/tests/java_api/config_pragmas/ConfigPragmas.java b/testsuite/tests/java_api/config_pragmas/ConfigPragmas.java index f51a34442..0474ab9ab 100644 --- a/testsuite/tests/java_api/config_pragmas/ConfigPragmas.java +++ b/testsuite/tests/java_api/config_pragmas/ConfigPragmas.java @@ -19,8 +19,8 @@ public class ConfigPragmas { private static AnalysisUnit load(String filename) { AnalysisUnit u = ctx.getUnitFromFile(filename); - List diagnostics = u.getDiagnostics(); - if (!diagnostics.isEmpty()) + Diagnostic[] diagnostics = u.getDiagnostics(); + if (diagnostics.length != 0) { for (Diagnostic d : diagnostics) System.out.println(d.toString()); @@ -34,7 +34,7 @@ private static void check_pragmas() { System.out.println("Pragmas for " + filename + ":"); AnalysisUnit u = load(filename); CompilationUnit cu = (CompilationUnit) u.getRoot(); - AdaNodeArray pragmas; + AdaNode[] pragmas; try { pragmas = cu.pAllConfigPragmas(); } catch (LangkitException exc) { @@ -43,8 +43,8 @@ private static void check_pragmas() { ); continue; } - for (int i = 0; i < pragmas.size(); ++i) - System.out.println("Config pragma: " + pragmas.get(i)); + for (AdaNode pragma : pragmas) + System.out.println("Config pragma: " + pragma); } } diff --git a/testsuite/tests/java_api/gpr_context/GPRContext.java b/testsuite/tests/java_api/gpr_context/GPRContext.java index 117f4e4da..c968103c0 100644 --- a/testsuite/tests/java_api/gpr_context/GPRContext.java +++ b/testsuite/tests/java_api/gpr_context/GPRContext.java @@ -47,8 +47,8 @@ private static void check( Libadalang.Text.create("pkg"), Libadalang.AnalysisUnitKind.UNIT_BODY ); - List diagnostics = u.getDiagnostics(); - if (!diagnostics.isEmpty()) + Libadalang.Diagnostic[] diagnostics = u.getDiagnostics(); + if (diagnostics.length != 0) { for (Libadalang.Diagnostic d : diagnostics) System.out.println(d.toString()); @@ -83,9 +83,9 @@ private static void check( // To show that configuration pragmas are properly detected from the // project, print their list. - Libadalang.AdaNodeArray pragmas = cu.pAllConfigPragmas(); - for (int i = 0; i < pragmas.size(); ++i) - System.out.println("Config pragma: " + pragmas.get(i)); + Libadalang.AdaNode[] pragmas = cu.pAllConfigPragmas(); + for (Libadalang.AdaNode pragma : pragmas) + System.out.println("Config pragma: " + pragma); System.out.println(""); }