Skip to content

Commit

Permalink
Migrate google java format from 1.7 -> 1.21.0
Browse files Browse the repository at this point in the history
Summary:
X-link: facebookexternal/OculusManufacturing#524

X-link: facebookexternal/fbpay#3

X-link: facebook/screenshot-tests-for-android#324

X-link: pytorch/executorch#1771

X-link: facebook/igl#68

X-link: facebook/mariana-trench#153

X-link: facebook/fresco#2757

X-link: facebook/litho#974

X-link: facebook/react-native#42754

X-link: facebook/hhvm#9431

X-link: WhatsApp/eqwalizer#52

X-link: facebookincubator/spectrum#1858

X-link: fbsamples/metapay#1

X-link: facebookincubator/fbjni#95

X-link: facebookincubator/Battery-Metrics#30

X-link: facebook/ktfmt#440

X-link: facebook/flipper#5456

X-link: facebook/hermes#1290

X-link: facebook/TextLayoutBuilder#35

X-link: facebook/SoLoader#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
  • Loading branch information
j-bahr authored and facebook-github-bot committed Mar 23, 2024
1 parent 5d77eb3 commit a9f4550
Show file tree
Hide file tree
Showing 19 changed files with 85 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public static void main(String... args) {
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED);
if (args.length < 3) {
throw new IllegalArgumentException(
"Incorrect number of arguments. <hostname> <port/Uds Path> <warmupSeconds> <benchmarkSeconds>");
"Incorrect number of arguments. <hostname> <port/Uds Path> <warmupSeconds>"
+ " <benchmarkSeconds>");
}

SocketAddress address;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@
*/
public interface BaseEnum {

/** @return Returns the i32 value of the enum */
/**
* @return Returns the i32 value of the enum
*/
public int getValue();

/** @return true for java enums, false for open enums. */
/**
* @return true for java enums, false for open enums.
*/
public default boolean isClosedEnum() {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,35 @@ public abstract class ThriftEnum<T extends ThriftEnum>
protected int value;
protected int unrecognizedValue;

/** @return Returns the integer value of the defined enum. */
/**
* @return Returns the integer value of the defined enum.
*/
@Override
@ThriftEnumValue
public int getValue() {
return this.value;
}

/** @return Returns the unrecognized value of the enum if the value is not defined. */
/**
* @return Returns the unrecognized value of the enum if the value is not defined.
*/
public int getUnrecognizedValue() {
return unrecognizedValue;
}

/** @return true if the enum value is unrecognized, false otherwise. */
/**
* @return true if the enum value is unrecognized, false otherwise.
*/
public abstract boolean isValueUnrecognized();

/** @return Ordinal value of the enum. Unrecognized value has the last ordinal value. */
/**
* @return Ordinal value of the enum. Unrecognized value has the last ordinal value.
*/
public abstract int ordinal();

/** @return Name of the enum defined in the IDL. */
/**
* @return Name of the enum defined in the IDL.
*/
public abstract String name();

public boolean isClosedEnum() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,8 @@ public TStruct readStructBegin(
@Override
public TStruct readStructBegin() {
throw new UnsupportedOperationException(
"You need to specify a \"field name\" -> \"field Id\" mapping to deserialize with TSimpleJSON");
"You need to specify a \"field name\" -> \"field Id\" mapping to deserialize with"
+ " TSimpleJSON");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ public ByteBuf getByteBuf() {
*/
public abstract ByteBuf readBinaryAsSlice() throws TException;

/** @return Returns the current writer index of the ByteBuf */
/**
* @return Returns the current writer index of the ByteBuf
*/
public int mark() {
return this.byteBuf.writerIndex();
}
Expand All @@ -102,5 +104,6 @@ public void rollback(int pos) {
*/
public int getEmptyStructSize() {
return 1;
};
}
;
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public class Utf8Util {
createStr = lookup.unreflect(m);
} catch (Throwable t) {
logger.warn(
"Add JVM option for faster UTF-8 validation. --add-opens java.base/java.lang=ALL-UNNAMED");
"Add JVM option for faster UTF-8 validation. --add-opens"
+ " java.base/java.lang=ALL-UNNAMED");
// Ignore, validation will be done before creating the String
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public int readAll(byte[] buf, int off, int len) throws TTransportException {
+ len
+ " bytes, but only got "
+ got
+ " bytes. (This is often indicative of an internal error on the server side. Please check your server logs.)");
+ " bytes. (This is often indicative of an internal error on the server side."
+ " Please check your server logs.)");
}
got += ret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class ServerStats {

// Counter properties
private final AtomicLong receivedRequests;

/**
* DecayCounters decays exponentially using a formula to calculate counts in a rolling time window
* https://github.com/airlift/airlift/blob/master/stats/src/main/java/io/airlift/stats/DecayCounter.java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,14 @@ public static void registerDeserializer(
deserializerId.put(id, deserializer);
}

/** @return Returns payload of Any and SemiAny */
/**
* @return Returns payload of Any and SemiAny
*/
public abstract T get();

/** @return Returns AnyStruct or SemiAnyStruct */
/**
* @return Returns AnyStruct or SemiAnyStruct
*/
public abstract A getAny();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class SerializedAny<T> extends Any<T> {
this.any = Objects.requireNonNull(any);
}

/** @return Any payload */
/**
* @return Any payload
*/
public T get() {
if (lazyValue != null) {
return (T) lazyValue;
Expand All @@ -56,7 +58,9 @@ private <T> T getValue() {
}
}

/** @return AnyStruct */
/**
* @return AnyStruct
*/
@Override
public AnyStruct getAny() {
return any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ class SerializedSemiAny<T> extends SemiAny<T> {
this.any = Objects.requireNonNull(any);
}

/** @return SemiAny payload. Data, protocol and type must be provided to get the value. */
/**
* @return SemiAny payload. Data, protocol and type must be provided to get the value.
*/
public T get() {
if (lazyValue != null) {
return (T) lazyValue;
Expand All @@ -64,7 +66,9 @@ private <T> T getValue() {
}
}

/** @return SemiAnyStruct */
/**
* @return SemiAnyStruct
*/
@Override
public SemiAnyStruct getAny() {
return any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ private Object read(TypeStruct typeStruct) {
} else {
return deserializeObject(typeStruct);
}
};
}
;

private Type findByType(String uri) {
Type type = uriCache.get(uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public static Class<? extends Channel> getChannelClass(
: unavailabilityCause.getMessage();
throw new UnsupportedOperationException(
String.format(
"Unsupported combination of EventLoopGroup-{%s} & SocketAddress-{%s}. Likely due to system support for Epoll unavailable due to {%s}",
"Unsupported combination of EventLoopGroup-{%s} & SocketAddress-{%s}. Likely due to"
+ " system support for Epoll unavailable due to {%s}",
group.getClass(), socketAddress.getClass(), errorMsg),
unavailabilityCause);
}
Expand All @@ -123,7 +124,8 @@ public static Class<? extends Channel> getChannelClass(
: unavailabilityCause.getMessage();
throw new UnsupportedOperationException(
String.format(
"Unsupported combination of EventLoopGroup-{%s} & SocketAddress-{%s}. Likely due to system support for Kqueue unavailable due to {%s}.",
"Unsupported combination of EventLoopGroup-{%s} & SocketAddress-{%s}. Likely due to"
+ " system support for Kqueue unavailable due to {%s}.",
group.getClass(), socketAddress.getClass(), errorMsg),
unavailabilityCause);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ public static Class<? extends ServerChannel> getChannelClass(
: unavailabilityCause.getMessage();
throw new UnsupportedOperationException(
String.format(
"Unsupported combination of EventLoopGroup-{%s} & SocketAddress-{%s}. Likely due to system support for Epoll unavailable due to {%s}.",
"Unsupported combination of EventLoopGroup-{%s} & SocketAddress-{%s}. Likely due to"
+ " system support for Epoll unavailable due to {%s}.",
group.getClass(), socketAddress.getClass(), errorMsg),
unavailabilityCause);
}
Expand All @@ -107,7 +108,8 @@ public static Class<? extends ServerChannel> getChannelClass(
: unavailabilityCause.getMessage();
throw new UnsupportedOperationException(
String.format(
"Unsupported combination of EventLoopGroup-{%s} & SocketAddress-{%s}. Likely due to system support for Kqueue unavailable due to {%s}.",
"Unsupported combination of EventLoopGroup-{%s} & SocketAddress-{%s}. Likely due to"
+ " system support for Kqueue unavailable due to {%s}.",
group.getClass(), socketAddress.getClass(), errorMsg),
unavailabilityCause);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
import reactor.core.scheduler.Scheduler;
import reactor.core.scheduler.Schedulers;

/** @author Stephane Maldini */
/**
* @author Stephane Maldini
*/
public abstract class AbstractSchedulerTest {

protected abstract Scheduler scheduler();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,8 @@ public TStruct readStructBegin(Map<Integer, FieldMetaData> fieldMetadata) throws
@Override
public TStruct readStructBegin() {
throw new UnsupportedOperationException(
"You need to specify a \"field name\" -> \"field Id\" mapping to deserialize with TSimpleJSON");
"You need to specify a \"field name\" -> \"field Id\" mapping to deserialize with"
+ " TSimpleJSON");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ public THsHaServer(
options_ = options;
}

/** @inheritDoc */
/**
* @inheritDoc
*/
@Override
public void serve() {
if (!startInvokerPool()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ public class TServlet extends HttpServlet {

private final Collection<Map.Entry<String, String>> customHeaders;

/** @see HttpServlet#HttpServlet() */
/**
* @see HttpServlet#HttpServlet()
*/
public TServlet(
TProcessor processor,
TProtocolFactory inProtocolFactory,
Expand All @@ -57,12 +59,16 @@ public TServlet(
this.customHeaders = new ArrayList<Map.Entry<String, String>>();
}

/** @see HttpServlet#HttpServlet() */
/**
* @see HttpServlet#HttpServlet()
*/
public TServlet(TProcessor processor, TProtocolFactory protocolFactory) {
this(processor, protocolFactory, protocolFactory);
}

/** @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Expand Down Expand Up @@ -96,7 +102,9 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
}
}

/** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public void close() {
if (null != inputStream_) {
try {
inputStream_.close();
} catch (IOException ioe) {;
} catch (IOException ioe) {
;
}
inputStream_ = null;
}
Expand Down

0 comments on commit a9f4550

Please sign in to comment.