Skip to content

Reformat Java sources with Palantir - #12422

Draft
bric3 wants to merge 1 commit into
bdu/use-palantir-java-formatfrom
bdu/reformat-with-palantir-java-format
Draft

Reformat Java sources with Palantir#12422
bric3 wants to merge 1 commit into
bdu/use-palantir-java-formatfrom
bdu/reformat-with-palantir-java-format

Conversation

@bric3

@bric3 bric3 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Reformats 1,855 Java files with Palantir Java Format's GOOGLE style. No non-Java files are changed.

Representative Formatting Changes

Compact Lambda Pipelines

PluginApplication.java

-        Extension.EXTENSIONS.stream()
-            .filter(ext -> ext.appliesTo(spec))
-            .forEach(
-                ext -> {
+        Extension.EXTENSIONS.stream().filter(ext -> ext.appliesTo(spec)).forEach(ext -> {

Vertically Aligned Fluent Calls

AdviceGeneratorImpl.java

-      final List<Expression> helperTypes =
-          Arrays.stream(helpers)
-              .map(type -> new StringLiteralExpr(type.getClassName()))
-              .collect(Collectors.toList());
+      final List<Expression> helperTypes = Arrays.stream(helpers)
+          .map(type -> new StringLiteralExpr(type.getClassName()))
+          .collect(Collectors.toList());

Nested Callbacks Without an Indentation Pyramid

CoreTracer.java

-    sharedCommunicationObjects.whenReady(
-        () ->
-            AgentTaskScheduler.get()
-                .execute(
-                    () -> {
-                      startMetricsAggregation(config, sco);
-                      maybeStartLogsExport(config);
-                    }));
+    sharedCommunicationObjects.whenReady(() -> AgentTaskScheduler.get().execute(() -> {
+      startMetricsAggregation(config, sco);
+      maybeStartLogsExport(config);
+    }));

Nested Lambda Pipelines Without Stair-Step Indentation

AssertBuilder.java

     return type.getAnnotationByName("AutoService")
-        .<Set<Class<?>>>map(
-            annotation ->
-                annotation.asNormalAnnotationExpr().getPairs().stream()
-                    .filter(pair -> pair.getNameAsString().equals("value"))
-                    .flatMap(
-                        pair ->
-                            pair.getValue().asArrayInitializerExpr().getValues().stream()
-                                .map(
-                                    value ->
-                                        value
-                                            .asClassExpr()
-                                            .getType()
-                                            .resolve()
-                                            .asReferenceType()
-                                            .getTypeDeclaration()
-                                            .get()
-                                            .getQualifiedName()))
-                    .map(AssertBuilder::loadClass)
-                    .collect(Collectors.toSet()))
+        .<Set<Class<?>>>map(annotation -> annotation.asNormalAnnotationExpr().getPairs().stream()
+            .filter(pair -> pair.getNameAsString().equals("value"))
+            .flatMap(pair -> pair.getValue().asArrayInitializerExpr().getValues().stream()
+                .map(value -> value
+                    .asClassExpr()
+                    .getType()
+                    .resolve()
+                    .asReferenceType()
+                    .getTypeDeclaration()
+                    .get()
+                    .getQualifiedName()))
+            .map(AssertBuilder::loadClass)
+            .collect(Collectors.toSet()))
         .orElse(Collections.emptySet());

Switch Blocks Attached to Their Labels

JsonToExpressionConverter.java

-      case "not":
-        {
-          JsonReader.Token token = reader.peek();
-          if (token == BEGIN_ARRAY || token == STRING || token == NUMBER) {
-            throw new UnsupportedOperationException(
-                "Operation 'not' expects a predicate as its argument");
-          }
-          return DSL.not(createPredicate(reader));
-        }
+      case "not": {
+        JsonReader.Token token = reader.peek();
+        if (token == BEGIN_ARRAY || token == STRING || token == NUMBER) {
+          throw new UnsupportedOperationException(
+              "Operation 'not' expects a predicate as its argument");
+        }
+        return DSL.not(createPredicate(reader));
+      }

Motivation

Keep the mechanical formatting changes separate from the formatter configuration in #12421. The explicit GOOGLE style preserves the repository's two-space indentation and 100-character line width while evaluating Palantir's lambda and fluent-chain layout.

Additional Notes

This PR is stacked on #12421. A stale local Spotless build-cache entry initially pointed one smoke-test project at a sibling relative path; cache-free formatting and the root, buildSrc, and published-dependencies Spotless checks all succeeded.

Palantir 2.97.0 with GOOGLE style keeps the closing parenthesis beside the final parameter:

private static Function<CallSiteSpecification, CallSiteResult> generateAdviceClosure(
    final Configuration configuration) {

Contributor Checklist

@bric3 bric3 added tag: no release notes Changes to exclude from release notes type: refactoring tag: experimental Experimental changes comp: tooling Build & Tooling tag: ai generated Largely based on code generated by an AI or LLM labels Sep 7, 2026
@bric3 bric3 mentioned this pull request Sep 7, 2026
@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
Patch Coverage: 55.64%
Overall Coverage: 57.31%

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 15f2324 | Docs | View more details | Give us feedback!

@pr-commenter

pr-commenter Bot commented Sep 7, 2026

Copy link
Copy Markdown

Debugger benchmarks

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
ci_job_date 1788787861 1788788188
end_time 2026-09-07T13:32:32 2026-09-07T13:37:59
git_branch master bdu/reformat-with-palantir-java-format
git_commit_sha 36ca5fb 15f2324
start_time 2026-09-07T13:31:02 2026-09-07T13:36:29
See matching parameters
Baseline Candidate
ci_job_id 2020457359 2020457359
ci_pipeline_id 135851287 135851287
cpu_model Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz
git_commit_date 1788786997 1788786997

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 9 metrics, 6 unstable metrics.

See unchanged results
scenario Δ mean agg_http_req_duration_min Δ mean agg_http_req_duration_p50 Δ mean agg_http_req_duration_p75 Δ mean agg_http_req_duration_p99 Δ mean throughput
scenario:noprobe unstable
[-42.860µs; +44.932µs] or [-12.521%; +13.126%]
unstable
[-58.961µs; +48.479µs] or [-15.465%; +12.716%]
unstable
[-69.054µs; +58.803µs] or [-17.381%; +14.800%]
unstable
[-182.444µs; +440.416µs] or [-15.104%; +36.462%]
same
scenario:basic same same same unstable
[-174.661µs; +157.448µs] or [-17.688%; +15.945%]
unstable
[-169.456op/s; +169.456op/s] or [-7.626%; +7.626%]
scenario:loop same same same same same
Request duration reports for reports
gantt
    title reports - request duration [CI 0.99] : candidate=None, baseline=None
    dateFormat X
    axisFormat %s
section baseline
noprobe (381.245 µs) : 336, 427
.   : milestone, 381,
basic (340.776 µs) : 331, 350
.   : milestone, 341,
loop (8.116 ms) : 8052, 8180
.   : milestone, 8116,
section candidate
noprobe (376.004 µs) : 320, 432
.   : milestone, 376,
basic (340.42 µs) : 334, 347
.   : milestone, 340,
loop (8.132 ms) : 8058, 8206
.   : milestone, 8132,
Loading
  • baseline results
Scenario Request median duration [CI 0.99]
noprobe 381.245 µs [335.567 µs, 426.923 µs]
basic 340.776 µs [331.232 µs, 350.32 µs]
loop 8.116 ms [8.052 ms, 8.18 ms]
  • candidate results
Scenario Request median duration [CI 0.99]
noprobe 376.004 µs [320.184 µs, 431.824 µs]
basic 340.42 µs [333.737 µs, 347.104 µs]
loop 8.132 ms [8.058 ms, 8.206 ms]

@dd-octo-sts

dd-octo-sts Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.79 s 14.63 s [+0.2%; +2.0%] (maybe worse)
startup:insecure-bank:tracing:Agent 13.58 s 13.67 s [-1.6%; +0.3%] (no difference)
startup:petclinic:appsec:Agent 17.52 s 17.37 s [+0.1%; +1.6%] (maybe worse)
startup:petclinic:iast:Agent 17.27 s 17.49 s [-2.0%; -0.6%] (maybe better)
startup:petclinic:profiling:Agent 17.35 s 16.54 s [+0.7%; +9.1%] (maybe worse)
startup:petclinic:sca:Agent 17.50 s 17.32 s [+0.1%; +2.0%] (maybe worse)
startup:petclinic:tracing:Agent 16.52 s 16.15 s [-2.0%; +6.6%] (no difference)

Commit: 15f23244 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@bric3
bric3 force-pushed the bdu/reformat-with-palantir-java-format branch from 7d7768e to 04b57a8 Compare September 7, 2026 13:02
@bric3
bric3 force-pushed the bdu/reformat-with-palantir-java-format branch from 04b57a8 to 15f2324 Compare September 7, 2026 13:20
@pr-commenter

pr-commenter Bot commented Sep 7, 2026

Copy link
Copy Markdown

Kafka / consumer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch bdu/use-palantir-java-format bdu/reformat-with-palantir-java-format
git_commit_date 1788786891 1788786997
git_commit_sha b2e1ea3 15f2324
See matching parameters
Baseline Candidate
ci_job_date 1788788418 1788788418
ci_job_id 2020457356 2020457356
ci_pipeline_id 135851287 135851287
cpu_model Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz
jdkVersion 11.0.31 11.0.31
jmhVersion 1.36 1.36
jvm /usr/lib/jvm/java-11-openjdk-amd64/bin/java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
jvmArgs -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=15002 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=15002 -Dhttp.nonProxyHosts=localhost *.localhost
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-c26vlu8a 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-c26vlu8a 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
vmName OpenJDK 64-Bit Server VM OpenJDK 64-Bit Server VM
vmVersion 11.0.31+11-post-1ubuntu1-22.04.2-Ubuntu 11.0.31+11-post-1ubuntu1-22.04.2-Ubuntu

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics.

See unchanged results
scenario Δ mean throughput
scenario:not-instrumented/KafkaConsumerBenchmark.benchConsume same
scenario:only-tracing-dsm-disabled-benchmarks/KafkaConsumerBenchmark.benchConsume same
scenario:only-tracing-dsm-enabled-benchmarks/KafkaConsumerBenchmark.benchConsume same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: tooling Build & Tooling tag: ai generated Largely based on code generated by an AI or LLM tag: experimental Experimental changes tag: no release notes Changes to exclude from release notes type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant