From 8ce9263ab2933869646a62d55d544e8ca14337f9 Mon Sep 17 00:00:00 2001 From: Jeff Bahr Date: Wed, 20 Mar 2024 16:00:15 -0700 Subject: [PATCH] Migrate google java format from 1.7 -> 1.21.0 Summary: X-link: https://github.com/pytorch/executorch/pull/1771 X-link: https://github.com/facebook/igl/pull/68 X-link: 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 --- .../testing/screenshot/Screenshot.java | 4 ++- .../internal/RecordBuilderImpl.java | 28 ++++++++++++++----- .../internal/ScreenshotDirectories.java | 2 +- .../screenshot/internal/ScreenshotImpl.java | 5 +++- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/com/facebook/testing/screenshot/Screenshot.java b/core/src/main/java/com/facebook/testing/screenshot/Screenshot.java index 517a77f7..631cef96 100644 --- a/core/src/main/java/com/facebook/testing/screenshot/Screenshot.java +++ b/core/src/main/java/com/facebook/testing/screenshot/Screenshot.java @@ -49,7 +49,9 @@ public static RecordBuilder snapActivity(Activity activity) { return ScreenshotImpl.getInstance().snapActivity(activity); } - /** @return The largest amount of pixels we'll capture, otherwise an exception will be thrown. */ + /** + * @return The largest amount of pixels we'll capture, otherwise an exception will be thrown. + */ public static long getMaxPixels() { return ScreenshotImpl.getMaxPixels(); } diff --git a/core/src/main/java/com/facebook/testing/screenshot/internal/RecordBuilderImpl.java b/core/src/main/java/com/facebook/testing/screenshot/internal/RecordBuilderImpl.java index 28e330d7..6c400337 100644 --- a/core/src/main/java/com/facebook/testing/screenshot/internal/RecordBuilderImpl.java +++ b/core/src/main/java/com/facebook/testing/screenshot/internal/RecordBuilderImpl.java @@ -54,7 +54,9 @@ public String getDescription() { return mDescription; } - /** @inherit */ + /** + * @inherit + */ @Override public RecordBuilderImpl setDescription(String description) { mDescription = description; @@ -68,7 +70,9 @@ public String getName() { return mName; } - /** @inherit */ + /** + * @inherit + */ @Override public RecordBuilderImpl setName(String name) { CharsetEncoder charsetEncoder = Charset.forName("latin-1").newEncoder(); @@ -112,20 +116,26 @@ public RecordBuilderImpl setTestClass(String testClass) { return this; } - /** @inherit */ + /** + * @inherit + */ @Override public Bitmap getBitmap() { return mScreenshotImpl.getBitmap(this); } - /** @inherit */ + /** + * @inherit + */ @Override public RecordBuilderImpl setMaxPixels(long maxPixels) { mMaxPixels = maxPixels; return this; } - /** @return The maximum number of pixels that is expected to be produced by this screenshot */ + /** + * @return The maximum number of pixels that is expected to be produced by this screenshot + */ public long getMaxPixels() { return mMaxPixels; } @@ -148,7 +158,9 @@ RecordBuilderImpl setError(String error) { return this; } - /** @inherit */ + /** + * @inherit + */ @Override public void record() { mScreenshotImpl.record(this); @@ -207,7 +219,9 @@ public RecordBuilderImpl setGroup(String groupName) { return this; } - /** @inherit */ + /** + * @inherit + */ @Override public RecordBuilderImpl setIncludeAccessibilityInfo(boolean includeAccessibilityInfo) { mIncludeAccessibilityInfo = includeAccessibilityInfo; diff --git a/core/src/main/java/com/facebook/testing/screenshot/internal/ScreenshotDirectories.java b/core/src/main/java/com/facebook/testing/screenshot/internal/ScreenshotDirectories.java index 46e14d8d..99c2e65d 100644 --- a/core/src/main/java/com/facebook/testing/screenshot/internal/ScreenshotDirectories.java +++ b/core/src/main/java/com/facebook/testing/screenshot/internal/ScreenshotDirectories.java @@ -135,6 +135,6 @@ private File getSdcardDir(String type) { private void setWorldWriteable(File dir) { // Context.MODE_WORLD_WRITEABLE has been deprecated, so let's // manually set this - dir.setWritable(/* writeable = */ true, /* ownerOnly = */ false); + dir.setWritable(/* writeable= */ true, /* ownerOnly= */ false); } } diff --git a/core/src/main/java/com/facebook/testing/screenshot/internal/ScreenshotImpl.java b/core/src/main/java/com/facebook/testing/screenshot/internal/ScreenshotImpl.java index 96538fd2..021f4a57 100644 --- a/core/src/main/java/com/facebook/testing/screenshot/internal/ScreenshotImpl.java +++ b/core/src/main/java/com/facebook/testing/screenshot/internal/ScreenshotImpl.java @@ -56,6 +56,7 @@ public class ScreenshotImpl { private static final int METADATA_VERSION = 1; private static ScreenshotImpl sInstance; + /** The album of all the screenshots taken in this run. */ private final Album mAlbum; @@ -351,7 +352,9 @@ public void run() { return ret[0]; } - /** @return The largest amount of pixels we'll capture, otherwise an exception will be thrown. */ + /** + * @return The largest amount of pixels we'll capture, otherwise an exception will be thrown. + */ public static long getMaxPixels() { return RecordBuilderImpl.DEFAULT_MAX_PIXELS; }