From 9252868b4675f3f958aec7192b111a05aa1e2ae9 Mon Sep 17 00:00:00 2001 From: Jeff Bahr Date: Fri, 22 Mar 2024 09:57:24 -0700 Subject: [PATCH] Migrate google java format from 1.7 -> 1.21.0 (#153) Summary: X-link: https://github.com/facebook/screenshot-tests-for-android/pull/324 X-link: https://github.com/pytorch/executorch/pull/1771 X-link: https://github.com/facebook/igl/pull/68 Pull Request resolved: https://github.com/facebook/mariana-trench/pull/153 X-link: https://github.com/facebook/fresco/pull/2757 X-link: https://github.com/facebook/litho/pull/974 X-link: https://github.com/facebook/react-native/pull/42754 X-link: https://github.com/facebook/hhvm/pull/9431 X-link: https://github.com/WhatsApp/eqwalizer/pull/52 X-link: https://github.com/facebookincubator/spectrum/pull/1858 X-link: https://github.com/fbsamples/metapay/pull/1 X-link: https://github.com/facebookincubator/fbjni/pull/95 X-link: https://github.com/facebookincubator/Battery-Metrics/pull/30 X-link: https://github.com/facebook/ktfmt/pull/440 X-link: https://github.com/facebook/flipper/pull/5456 X-link: https://github.com/facebook/hermes/pull/1290 X-link: https://github.com/facebook/TextLayoutBuilder/pull/35 X-link: https://github.com/facebook/SoLoader/pull/122 This diff migrates google java format form 1.7 to 1.21.0. This update will allow for new language features from java 17 and 21. This diff also formats all necessary files. Changelog: [Internal][Changed] - Updated format from google-java-format 1.7 -> 1.21.0 Reviewed By: IanChilds Differential Revision: D52786052 --- .../facebook/marianatrench/tests/MethodHandlerVisitorTest.java | 3 ++- source/tests/integration/end-to-end/code/broadening/Flow.java | 2 +- source/tests/integration/end-to-end/code/return_sink/Flow.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/desugar/com/facebook/marianatrench/tests/MethodHandlerVisitorTest.java b/desugar/com/facebook/marianatrench/tests/MethodHandlerVisitorTest.java index 62da6ef42..88f5f9535 100644 --- a/desugar/com/facebook/marianatrench/tests/MethodHandlerVisitorTest.java +++ b/desugar/com/facebook/marianatrench/tests/MethodHandlerVisitorTest.java @@ -25,7 +25,8 @@ public void test() { String inputClassString = BytecodeProcessing.bytecodeMethodsToString(inputClass); String inputClassStringDesugared = inputClassString.replace( - "INVOKEVIRTUAL java/lang/invoke/MethodHandle.invokeExact (Ljava/lang/String;CC)Ljava/lang/String;", + "INVOKEVIRTUAL java/lang/invoke/MethodHandle.invokeExact" + + " (Ljava/lang/String;CC)Ljava/lang/String;", "POP\n POP\n POP"); String outputClassString = BytecodeProcessing.bytecodeMethodsToString(writer.toByteArray()); assertThat(inputClassStringDesugared).isEqualTo(outputClassString); diff --git a/source/tests/integration/end-to-end/code/broadening/Flow.java b/source/tests/integration/end-to-end/code/broadening/Flow.java index 132fa8c41..12d5ebcdd 100644 --- a/source/tests/integration/end-to-end/code/broadening/Flow.java +++ b/source/tests/integration/end-to-end/code/broadening/Flow.java @@ -46,7 +46,7 @@ private class Tree { public Tree c; public Tree d; public Tree e; - }; + } public Tree widened_source_sink_depth(Tree argument) { Origin.sink(argument.a.b.c.d.e); diff --git a/source/tests/integration/end-to-end/code/return_sink/Flow.java b/source/tests/integration/end-to-end/code/return_sink/Flow.java index 797d6ff1b..581e7f3d9 100644 --- a/source/tests/integration/end-to-end/code/return_sink/Flow.java +++ b/source/tests/integration/end-to-end/code/return_sink/Flow.java @@ -34,7 +34,7 @@ static Object propagate(Object x) { private static class Tree { public Tree foo; public Tree bar; - }; + } static Tree return_sink_foo(Tree tree) { return tree;