Skip to content

Commit 7ce165c

Browse files
committed
Reformat all Java sources
1 parent 9d1f82f commit 7ce165c

73 files changed

Lines changed: 545 additions & 515 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lkql_jit/benchmarks/src/test/java/com/adacore/lkql_jit/benchmarks/ClosureBenchmark.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
public class ClosureBenchmark extends TruffleBenchmark {
1212

13-
private static final String lkqlClosure =
14-
"""
13+
private static final String lkqlClosure = """
1514
fun foo(v) = {
1615
fun bar(w) = {
1716
fun baz(x) = {
@@ -26,8 +25,7 @@ fun baz(x) = {
2625
fun r() = clos(14)
2726
repeat(1000000, r)""";
2827

29-
private static final String jsClosure =
30-
"""
28+
private static final String jsClosure = """
3129
function foo(v) {
3230
function bar(w) {
3331
function baz(x) {

lkql_jit/benchmarks/src/test/java/com/adacore/lkql_jit/benchmarks/ClosureCreationBenchmark.java

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,40 @@ public class ClosureCreationBenchmark extends TruffleBenchmark {
1313
@Benchmark
1414
public void truffle_js() {
1515
this.context.eval(
16-
"js",
17-
"""
18-
function foo(v) {
19-
function bar(w) {
20-
function baz(x) {
21-
return v + w + x;
22-
}
23-
return baz;
16+
"js",
17+
"""
18+
function foo(v) {
19+
function bar(w) {
20+
function baz(x) {
21+
return v + w + x;
2422
}
25-
return bar;
23+
return baz;
2624
}
25+
return bar;
26+
}
2727
28-
for (let i = 0; i < 10000; i++) {
29-
foo(12)(13)(14)
30-
}"""
31-
);
28+
for (let i = 0; i < 10000; i++) {
29+
foo(12)(13)(14)
30+
}"""
31+
);
3232
}
3333

3434
@Benchmark
3535
public void truffle_lkql() {
3636
this.context.eval(
37-
"lkql",
38-
"""
39-
fun foo(v) = {
40-
fun bar(w) = {
41-
fun baz(x) = {
42-
v + w + x
43-
};
44-
baz
37+
"lkql",
38+
"""
39+
fun foo(v) = {
40+
fun bar(w) = {
41+
fun baz(x) = {
42+
v + w + x
4543
};
46-
bar
47-
}
44+
baz
45+
};
46+
bar
47+
}
4848
49-
repeat(10000, () => foo(12)(13)(14))"""
50-
);
49+
repeat(10000, () => foo(12)(13)(14))"""
50+
);
5151
}
5252
}

lkql_jit/benchmarks/src/test/java/com/adacore/lkql_jit/benchmarks/FibonacciBenchmark.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ public class FibonacciBenchmark extends TruffleBenchmark {
2020
private static final int term = 20;
2121

2222
/** The fibonacci function in LKQL */
23-
private static final String lkqlFibo =
24-
"""
23+
private static final String lkqlFibo = """
2524
fun fibo(n) =
2625
if n <= 0
2726
then 0
@@ -32,8 +31,7 @@ else fibo(n-1) + fibo(n-2)
3231
""".formatted(term);
3332

3433
/** The fibonacci function in JS */
35-
private static final String jsFibo =
36-
"""
34+
private static final String jsFibo = """
3735
function fibo(n) {
3836
if (n == 0) return 0;
3937
else if (n == 1) return 1;
@@ -43,8 +41,7 @@ function fibo(n) {
4341
""".formatted(term);
4442

4543
/** The fibonacci function in SimpleLanguage */
46-
private static final String slFibo =
47-
"""
44+
private static final String slFibo = """
4845
function fibo(n) {
4946
if (n < 2) {
5047
return 1;

lkql_jit/benchmarks/src/test/java/com/adacore/lkql_jit/benchmarks/ListComprehensionBenchmark.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@ public class ListComprehensionBenchmark extends TruffleBenchmark {
2929
private static final int size = 10_000;
3030

3131
/** The source for the LKQL list comprehension value. */
32-
private static final String lkqlSource =
33-
"""
32+
private static final String lkqlSource = """
3433
val generator = [%s]
3534
val result = [x * 2 for x in generator].to_list
3635
""";
3736

3837
/** The fibonacci function in JS */
39-
private static final String jsSource =
40-
"""
38+
private static final String jsSource = """
4139
var generator = [%s];
4240
var result = generator.map(x => x * 2);
4341
""";
4442

4543
/** Java recursive fibonacci implementation. */
4644
private void javaListComp() {
47-
Arrays.stream(this.generator).map(x -> x * 2).toArray();
45+
Arrays.stream(this.generator)
46+
.map(x -> x * 2)
47+
.toArray();
4848
}
4949

5050
// ----- Benchmark lifecycle -----

lkql_jit/builtins_annotations/src/main/java/com/adacore/lkql_jit/annotations/BuiltInProcessor.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
112112

113113
stream.println(
114114
" static private Map<String, Pair<Integer, BuiltInFunctionValue>>" +
115-
" allFunctionsCache = null;"
115+
" allFunctionsCache = null;"
116116
);
117117
stream.println(
118118
" static private Map<String, Map<String, BuiltInMethodFactory>>" +
119-
" allMethodsCache = null;"
119+
" allMethodsCache = null;"
120120
);
121121

122122
// allFunctions method
@@ -131,10 +131,10 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
131131
stream.println(" var fns = Stream.of(");
132132
stream.println(
133133
builtInPackages
134-
.stream()
135-
.map(p -> " Arrays.stream(" + p.getValue() + ".getFunctions())")
136-
.collect(Collectors.joining(",\n")) +
137-
")"
134+
.stream()
135+
.map(p -> " Arrays.stream(" + p.getValue() + ".getFunctions())")
136+
.collect(Collectors.joining(",\n")) +
137+
")"
138138
);
139139

140140
stream.println(".reduce(Stream::concat).orElseGet(Stream::empty).toList();");
@@ -150,25 +150,25 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
150150
// allMethods method
151151
stream.println(
152152
" public static Map<String, Map<String, BuiltInMethodFactory>>" +
153-
" allMethods() {"
153+
" allMethods() {"
154154
);
155155
stream.println(" if (allMethodsCache != null) {");
156156
stream.println(" return allMethodsCache;");
157157
stream.println(" }");
158158
stream.println(
159159
" allMethodsCache = new HashMap<String, Map<String," +
160-
" BuiltInMethodFactory>>();"
160+
" BuiltInMethodFactory>>();"
161161
);
162162
for (var p : builtInPackages) {
163163
stream.println(" for (var pair : " + p.getValue() + ".getMethods()) {");
164164
stream.println(
165165
" var keys = pair.getLeft().length == 0 ?" +
166-
" LKQLTypesHelper.ALL_TYPES : pair.getLeft();"
166+
" LKQLTypesHelper.ALL_TYPES : pair.getLeft();"
167167
);
168168
stream.println(" for (var key : keys) {");
169169
stream.println(
170170
" var typeMap = allMethodsCache.computeIfAbsent(key, t ->" +
171-
" new HashMap<>());"
171+
" new HashMap<>());"
172172
);
173173
stream.println(
174174
" typeMap.put(pair.getRight().name, pair.getRight());"

lkql_jit/cli/src/main/java/com/adacore/lkql_jit/cli/BaseLKQLChecker.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ public abstract class BaseLKQLChecker extends AbstractLanguageLauncher {
3030
protected Args args;
3131

3232
/** Common source to perform checker like process. */
33-
public static final String checkerSource =
34-
"""
33+
public static final String checkerSource = """
3534
val analysis_units = specified_units()
3635
analysis_units.map((unit) => node_checker(unit.root)).to_list
3736
analysis_units.map((unit) => unit_checker(unit)).to_list
@@ -227,14 +226,14 @@ public abstract static class Args implements Callable<Integer> {
227226
@CommandLine.Option(
228227
names = { "-r", "--rule" },
229228
description = "Rules to run on the provided code base (run all rules if none is " +
230-
"provided)"
229+
"provided)"
231230
)
232231
public List<String> rules = new ArrayList<>();
233232

234233
@CommandLine.Option(
235234
names = { "-a", "--rule-arg" },
236235
description = "Argument to pass to a rule, with the syntax" +
237-
" <rule_name>.<arg_name>=<arg_value>"
236+
" <rule_name>.<arg_name>=<arg_value>"
238237
)
239238
public List<String> rulesArgs = new ArrayList<>();
240239

lkql_jit/cli/src/main/java/com/adacore/lkql_jit/cli/GNATCheckWorker.java

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public static class Args implements Callable<Integer> {
4949
@CommandLine.Option(
5050
names = { "--parse-lkql-config" },
5151
description = "Parse the given LKQL file as a rule configuration file and return its" +
52-
" result as a JSON encoded string. If this option is provided, all" +
53-
" other features are disabled."
52+
" result as a JSON encoded string. If this option is provided, all" +
53+
" other features are disabled."
5454
)
5555
public String lkqlConfigFile = null;
5656

@@ -78,7 +78,7 @@ public static class Args implements Callable<Integer> {
7878
@CommandLine.Option(
7979
names = "-A",
8080
description = "The name of the subproject to analyse, if any. This implies that" +
81-
" `projectFile` designates an aggregate project."
81+
" `projectFile` designates an aggregate project."
8282
)
8383
public String subProject = null;
8484

@@ -109,7 +109,7 @@ public static class Args implements Callable<Integer> {
109109
@CommandLine.Option(
110110
names = "--ignore-project-switches",
111111
description = "Process all units in the project tree, excluding externally built" +
112-
" projects"
112+
" projects"
113113
)
114114
public boolean ignoreProjectSwitches;
115115

@@ -419,9 +419,9 @@ private static void processInstancesObject(
419419
errorInLKQLRuleFile(
420420
lkqlRuleFile,
421421
"The value associated to the '" +
422-
instancesObjectSymbol +
423-
"' symbol must be an LKQL object, got " +
424-
instancesObject
422+
instancesObjectSymbol +
423+
"' symbol must be an LKQL object, got " +
424+
instancesObject
425425
);
426426
}
427427

@@ -485,11 +485,11 @@ private static void processInstancesObject(
485485
"WORKER_WARNING",
486486
current.locationToGNATDiagnosisFormatString(),
487487
"instance " +
488-
current.instanceId() +
489-
" runs the same check than instance " +
490-
instance.instanceId() +
491-
" declared at " +
492-
instance.locationToGNATDiagnosisFormatString()
488+
current.instanceId() +
489+
" runs the same check than instance " +
490+
instance.instanceId() +
491+
" declared at " +
492+
instance.locationToGNATDiagnosisFormatString()
493493
);
494494
}
495495
}
@@ -542,20 +542,20 @@ private static void processArgsObject(
542542
"WORKER_WARNING",
543543
newInstance.locationToGNATDiagnosisFormatString(),
544544
"ignore duplicate instance " +
545-
instanceId +
546-
", previous declaration at " +
547-
oldInstance.locationToGNATDiagnosisFormatString()
545+
instanceId +
546+
", previous declaration at " +
547+
oldInstance.locationToGNATDiagnosisFormatString()
548548
);
549549
} else {
550550
// On the contrary, emit an error.
551551
emitMessageForTheDriver(
552552
"WORKER_ERROR",
553553
newInstance.locationToGNATDiagnosisFormatString(),
554554
"instance " +
555-
instanceId +
556-
" has a different configuration than the one previously declared at " +
557-
oldInstance.locationToGNATDiagnosisFormatString() +
558-
" (instances should have unique names)"
555+
instanceId +
556+
" has a different configuration than the one previously declared at " +
557+
oldInstance.locationToGNATDiagnosisFormatString() +
558+
" (instances should have unique names)"
559559
);
560560
}
561561
} else {
@@ -608,13 +608,13 @@ private static void processSoleArg(
608608
"WORKER_ERROR",
609609
newInstance.locationToGNATDiagnosisFormatString(),
610610
"cannot add instance " +
611-
ruleName +
612-
" twice using the shortcut argument format. Previous instance has been declared in" +
613-
((newInstance
614-
.instanceLocation()
615-
.equals(toPopulate.get(ruleName).instanceLocation()))
616-
? " the same set"
617-
: ": " + toPopulate.get(ruleName).locationToGNATDiagnosisFormatString())
611+
ruleName +
612+
" twice using the shortcut argument format. Previous instance has been declared in" +
613+
((newInstance
614+
.instanceLocation()
615+
.equals(toPopulate.get(ruleName).instanceLocation()))
616+
? " the same set"
617+
: ": " + toPopulate.get(ruleName).locationToGNATDiagnosisFormatString())
618618
);
619619
}
620620
}
@@ -636,8 +636,7 @@ public LKQLRuleFileError(String message) {
636636

637637
// ----- The LKQL checker -----
638638

639-
public static final String checkerSource =
640-
"""
639+
public static final String checkerSource = """
641640
val analysis_units = specified_units()
642641
val roots = [unit.root for unit in analysis_units]
643642

lkql_jit/cli/src/main/java/com/adacore/lkql_jit/cli/LKQLChecker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class LKQLChecker extends BaseLKQLChecker {
2323
@CommandLine.Command(
2424
name = "check",
2525
description = "Alternative checker driver. Like GNATcheck but with less options " +
26-
"& a more modern command line interface"
26+
"& a more modern command line interface"
2727
)
2828
public static class Args extends BaseLKQLChecker.Args {
2929

0 commit comments

Comments
 (0)