From d5a6428482394efde085f94eb864fa0408a0d097 Mon Sep 17 00:00:00 2001 From: Jeff Bahr Date: Sat, 23 Mar 2024 16:07:04 -0700 Subject: [PATCH] Migrate google java format from 1.7 -> 1.21.0 (#1858) Summary: X-link: https://github.com/facebookexternal/OculusManufacturing/pull/524 X-link: https://github.com/facebookexternal/fbpay/pull/3 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 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 Pull Request resolved: 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 allow-large-files 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 fbshipit-source-id: b675ae215084f340b93dfe628e329e696ca0616e --- .../com/facebook/spectrum/DefaultPlugins.java | 3 ++- .../com/facebook/spectrum/Configuration.java | 12 +++++++++--- .../java/com/facebook/spectrum/ISpectrum.java | 4 +++- .../com/facebook/spectrum/SpectrumTask.java | 3 ++- .../spectrum/image/ImagePixelSpecification.java | 17 +++++++++++++---- .../com/facebook/spectrum/options/Options.java | 1 + .../requirements/EncodeRequirement.java | 4 +++- .../requirements/ResizeRequirement.java | 4 +++- .../java/com/facebook/jni/DestructorThread.java | 1 + 9 files changed, 37 insertions(+), 12 deletions(-) diff --git a/android/spectrumdefault/src/main/java/com/facebook/spectrum/DefaultPlugins.java b/android/spectrumdefault/src/main/java/com/facebook/spectrum/DefaultPlugins.java index 91add15b..824ac6be 100644 --- a/android/spectrumdefault/src/main/java/com/facebook/spectrum/DefaultPlugins.java +++ b/android/spectrumdefault/src/main/java/com/facebook/spectrum/DefaultPlugins.java @@ -14,7 +14,8 @@ public class DefaultPlugins { - private DefaultPlugins() {}; + private DefaultPlugins() {} + ; public static SpectrumPlugin[] get() { return new SpectrumPlugin[] { diff --git a/android/src/main/java/com/facebook/spectrum/Configuration.java b/android/src/main/java/com/facebook/spectrum/Configuration.java index e949d05d..1450e898 100644 --- a/android/src/main/java/com/facebook/spectrum/Configuration.java +++ b/android/src/main/java/com/facebook/spectrum/Configuration.java @@ -166,7 +166,9 @@ public static Configuration makeForImageContainingGraphics() { .build(); } - /** @return A new builder to be used for creating {@link Configuration} objects. */ + /** + * @return A new builder to be used for creating {@link Configuration} objects. + */ public static Builder Builder() { return new Builder(); } @@ -346,7 +348,9 @@ public enum ImageHint { this.value = value; } - /** @return matching {@link ImageHint} for the given values. Throws otherwise */ + /** + * @return matching {@link ImageHint} for the given values. Throws otherwise + */ @DoNotStrip static ImageHint from(final int value) { for (ImageHint imageHint : ImageHint.values()) { @@ -376,7 +380,9 @@ public enum SamplingMethod { this.value = value; } - /** @return matching {@link SamplingMethod} for the given values. Throws otherwise */ + /** + * @return matching {@link SamplingMethod} for the given values. Throws otherwise + */ @DoNotStrip static SamplingMethod from(final int value) { for (SamplingMethod samplingMethod : SamplingMethod.values()) { diff --git a/android/src/main/java/com/facebook/spectrum/ISpectrum.java b/android/src/main/java/com/facebook/spectrum/ISpectrum.java index eb863577..5b74c1da 100644 --- a/android/src/main/java/com/facebook/spectrum/ISpectrum.java +++ b/android/src/main/java/com/facebook/spectrum/ISpectrum.java @@ -20,7 +20,9 @@ */ public interface ISpectrum { - /** @return true iff the native code loaded and initialized properly. */ + /** + * @return true iff the native code loaded and initialized properly. + */ boolean isAvailable(); /** diff --git a/android/src/main/java/com/facebook/spectrum/SpectrumTask.java b/android/src/main/java/com/facebook/spectrum/SpectrumTask.java index db7c930c..169e045b 100644 --- a/android/src/main/java/com/facebook/spectrum/SpectrumTask.java +++ b/android/src/main/java/com/facebook/spectrum/SpectrumTask.java @@ -119,7 +119,8 @@ public SpectrumResult execute(final SpectrumHybrid spectrumHybrid) throws Spectr } class Helper { - private Helper() {}; + private Helper() {} + ; static void closeQuietly(@Nullable final Closeable closeable) { if (closeable == null) { diff --git a/android/src/main/java/com/facebook/spectrum/image/ImagePixelSpecification.java b/android/src/main/java/com/facebook/spectrum/image/ImagePixelSpecification.java index 69ec15c8..dfb5f8ae 100644 --- a/android/src/main/java/com/facebook/spectrum/image/ImagePixelSpecification.java +++ b/android/src/main/java/com/facebook/spectrum/image/ImagePixelSpecification.java @@ -82,7 +82,9 @@ public static ImagePixelSpecification from(final Bitmap.Config bitmapConfig) { } } - /** @return matching {@link ImagePixelSpecification} for the given values. Throws otherwise */ + /** + * @return matching {@link ImagePixelSpecification} for the given values. Throws otherwise + */ @DoNotStrip static ImagePixelSpecification from( final ColorModel colorModel, @@ -116,7 +118,9 @@ enum ComponentsOrder { this.value = value; } - /** @return matching {@link ComponentsOrder} for the given values. Throws otherwise */ + /** + * @return matching {@link ComponentsOrder} for the given values. Throws otherwise + */ @DoNotStrip static ComponentsOrder from(final int value) { for (ComponentsOrder componentsOrder : ComponentsOrder.values()) { @@ -171,7 +175,9 @@ enum ColorModel { this.supportsExtraAlphaChannel = supportsExtraAlphaChannel; } - /** @return matching {@link ColorModel} for the given values. Throws otherwise */ + /** + * @return matching {@link ColorModel} for the given values. Throws otherwise + */ @DoNotStrip static ColorModel from( final String identifier, @@ -187,6 +193,7 @@ static ColorModel from( throw new IllegalArgumentException("Unsupported PixelColorModel"); } } + /** The alpha info specifies the behaviour of the optional alpha channel */ @DoNotStrip @Immutable @@ -231,7 +238,9 @@ enum AlphaInfo { this.value = value; } - /** @return matching {@link AlphaInfo} for the given values. Throws otherwise */ + /** + * @return matching {@link AlphaInfo} for the given values. Throws otherwise + */ @DoNotStrip static AlphaInfo from(final int value) { for (AlphaInfo alphaInfo : AlphaInfo.values()) { diff --git a/android/src/main/java/com/facebook/spectrum/options/Options.java b/android/src/main/java/com/facebook/spectrum/options/Options.java index 42f3b303..b7e879c9 100644 --- a/android/src/main/java/com/facebook/spectrum/options/Options.java +++ b/android/src/main/java/com/facebook/spectrum/options/Options.java @@ -43,6 +43,7 @@ public class Options { /** Options in the configuration object will override default and app-wide settings. */ @DoNotStrip @Nullable public final Configuration configuration; + /** * If set, will dictate the pixel specification images should be converted to before being passed * to the compressor. An exception will be thrown if the pixel specification doesn't fit the image diff --git a/android/src/main/java/com/facebook/spectrum/requirements/EncodeRequirement.java b/android/src/main/java/com/facebook/spectrum/requirements/EncodeRequirement.java index 46690e15..65e52980 100644 --- a/android/src/main/java/com/facebook/spectrum/requirements/EncodeRequirement.java +++ b/android/src/main/java/com/facebook/spectrum/requirements/EncodeRequirement.java @@ -40,7 +40,9 @@ public enum Mode { this.value = value; } - /** @return matching {@link Mode} for the given values. Throws otherwise */ + /** + * @return matching {@link Mode} for the given values. Throws otherwise + */ @DoNotStrip static Mode from(final int value) { for (Mode mode : Mode.values()) { diff --git a/android/src/main/java/com/facebook/spectrum/requirements/ResizeRequirement.java b/android/src/main/java/com/facebook/spectrum/requirements/ResizeRequirement.java index 6ccc6124..40f10b9b 100644 --- a/android/src/main/java/com/facebook/spectrum/requirements/ResizeRequirement.java +++ b/android/src/main/java/com/facebook/spectrum/requirements/ResizeRequirement.java @@ -103,7 +103,9 @@ public enum Mode { this.value = value; } - /** @return matching {@link Mode} for the given values. Throws otherwise */ + /** + * @return matching {@link Mode} for the given values. Throws otherwise + */ @DoNotStrip static Mode from(final int value) { for (Mode mode : Mode.values()) { diff --git a/androidLibs/fbjni/java/com/facebook/jni/DestructorThread.java b/androidLibs/fbjni/java/com/facebook/jni/DestructorThread.java index 23ea6441..53520213 100644 --- a/androidLibs/fbjni/java/com/facebook/jni/DestructorThread.java +++ b/androidLibs/fbjni/java/com/facebook/jni/DestructorThread.java @@ -48,6 +48,7 @@ private Destructor() { /** A list to keep all active Destructors in memory confined to the Destructor thread. */ private static DestructorList sDestructorList; + /** A thread safe stack where new Destructors are placed before being add to sDestructorList. */ private static DestructorStack sDestructorStack;