Skip to content

Commit acfd582

Browse files
Excavator: Upgrades Baseline to the latest version (#1349)
1 parent af47b29 commit acfd582

20 files changed

Lines changed: 74 additions & 9 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ buildscript {
1414
classpath 'com.palantir.javaformat:gradle-palantir-java-format:2.68.0'
1515
classpath 'com.palantir.suppressible-error-prone:gradle-suppressible-error-prone:2.9.0'
1616
classpath 'com.palantir.gradle.revapi:gradle-revapi:1.8.0'
17-
classpath 'com.palantir.baseline:gradle-baseline-java:6.32.0'
17+
classpath 'com.palantir.baseline:gradle-baseline-java:6.33.0'
1818
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:2.34.0'
1919
}
2020
}

errors/src/main/java/com/palantir/conjure/java/api/errors/QosException.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ private QosException(String message, QosReason reason) {
4343
this.reason = Preconditions.checkNotNull(reason, "QosReason is required");
4444
}
4545

46+
@SuppressWarnings("for-rollout:InconsistentOverloads")
4647
private QosException(String message, Throwable cause, QosReason reason) {
4748
super(message, cause);
4849
this.reason = Preconditions.checkNotNull(reason, "QosReason is required");
@@ -131,6 +132,7 @@ public static RetryOther retryOther(URL redirectTo) {
131132
/**
132133
* Like {@link #retryOther(URL)}, but includes a reason.
133134
*/
135+
@SuppressWarnings("for-rollout:InconsistentOverloads")
134136
public static RetryOther retryOther(QosReason reason, URL redirectTo) {
135137
return new RetryOther(redirectTo, reason);
136138
}
@@ -145,6 +147,7 @@ public static RetryOther retryOther(URL redirectTo, Throwable cause) {
145147
/**
146148
* Like {@link #retryOther(URL)}, but includes a reason, and a cause.
147149
*/
150+
@SuppressWarnings("for-rollout:InconsistentOverloads")
148151
public static RetryOther retryOther(QosReason reason, URL redirectTo, Throwable cause) {
149152
return new RetryOther(redirectTo, cause, reason);
150153
}
@@ -221,6 +224,7 @@ public String getLogMessage() {
221224
return "Suggested request throttling";
222225
}
223226

227+
@SuppressWarnings("for-rollout:Java8ApiChecker")
224228
@Override
225229
public List<Arg<?>> getArgs() {
226230
return List.of(
@@ -272,6 +276,7 @@ public String getLogMessage() {
272276
return this.getClass().getSimpleName() + ": Requesting retry";
273277
}
274278

279+
@SuppressWarnings("for-rollout:Java8ApiChecker")
275280
@Unsafe
276281
@Override
277282
public List<Arg<?>> getArgs() {
@@ -315,6 +320,7 @@ public String getLogMessage() {
315320
return SERVER_UNAVAILABLE;
316321
}
317322

323+
@SuppressWarnings("for-rollout:Java8ApiChecker")
318324
@Override
319325
public List<Arg<?>> getArgs() {
320326
return List.of(

errors/src/main/java/com/palantir/conjure/java/api/errors/QosReason.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ private QosReason(@Safe String reason, Optional<RetryHint> retryHint, Optional<D
5353
}
5454

5555
public static QosReason of(
56-
@Safe @CompileTimeConstant @org.intellij.lang.annotations.Pattern(PATTERN_STRING) String reason) {
56+
@SuppressWarnings("for-rollout:UnnecessarilyFullyQualified")
57+
@Safe
58+
@CompileTimeConstant
59+
@org.intellij.lang.annotations.Pattern(PATTERN_STRING)
60+
String reason) {
5761
return new QosReason(reason, Optional.empty(), Optional.empty());
5862
}
5963

@@ -117,7 +121,11 @@ public Builder from(QosReason other) {
117121
}
118122

119123
public Builder reason(
120-
@Safe @CompileTimeConstant @org.intellij.lang.annotations.Pattern(PATTERN_STRING) String value) {
124+
@SuppressWarnings("for-rollout:UnnecessarilyFullyQualified")
125+
@Safe
126+
@CompileTimeConstant
127+
@org.intellij.lang.annotations.Pattern(PATTERN_STRING)
128+
String value) {
121129
this.reason = Preconditions.checkNotNull(value, "reason");
122130
return this;
123131
}

errors/src/main/java/com/palantir/conjure/java/api/errors/QosReasons.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public static <T> void encodeToResponse(
4242
}
4343
}
4444

45+
@SuppressWarnings("for-rollout:Java8ApiChecker")
4546
public static <T> QosReason parseFromResponse(T response, QosResponseDecodingAdapter<? super T> adapter) {
4647
Optional<String> maybeDueTo = adapter.getFirstHeader(response, DUE_TO_HEADER);
4748
Optional<String> maybeRetryHint = adapter.getFirstHeader(response, RETRY_HINT_HEADER);

errors/src/main/java/com/palantir/conjure/java/api/errors/RemoteException.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public RemoteException(SerializableError error, int status) {
6363
@Override
6464
public String getMessage() {
6565
// This field is not used in most environments so the cost of computation may be avoided.
66+
@SuppressWarnings("for-rollout:Var")
6667
String messageValue = unsafeMessage;
6768
if (messageValue == null) {
6869
messageValue = renderUnsafeMessage();

errors/src/main/java/com/palantir/conjure/java/api/errors/ServiceExceptionUtils.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ static String renderUnsafeMessage(String exceptionName, ErrorType errorType, Arg
7070

7171
StringBuilder builder = new StringBuilder();
7272
builder.append(message).append(": {");
73+
@SuppressWarnings("for-rollout:Var")
7374
boolean first = true;
7475
for (Arg<?> arg : args) {
7576
if (arg == null) {
@@ -116,14 +117,14 @@ private static String generateErrorInstanceId(
116117
// we don't need cryptographically secure random UUIDs
117118
return UniqueIds.pseudoRandomUuidV4().toString();
118119
}
119-
if (cause instanceof ServiceException) {
120-
return ((ServiceException) cause).getErrorInstanceId();
120+
if (cause instanceof ServiceException serviceException) {
121+
return serviceException.getErrorInstanceId();
121122
}
122-
if (cause instanceof CheckedServiceException) {
123-
return ((CheckedServiceException) cause).getErrorInstanceId();
123+
if (cause instanceof CheckedServiceException checkedServiceException) {
124+
return checkedServiceException.getErrorInstanceId();
124125
}
125-
if (cause instanceof RemoteException) {
126-
return ((RemoteException) cause).getError().errorInstanceId();
126+
if (cause instanceof RemoteException remoteException) {
127+
return remoteException.getError().errorInstanceId();
127128
}
128129
return generateErrorInstanceId(cause.getCause(), dejaVu);
129130
}

errors/src/main/java/com/palantir/conjure/java/api/errors/UnknownRemoteException.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public String getLogMessage() {
5252
return getMessage();
5353
}
5454

55+
@SuppressWarnings("for-rollout:Java8ApiChecker")
5556
@Unsafe
5657
@Override
5758
public List<Arg<?>> getArgs() {

errors/src/test/java/com/palantir/conjure/java/api/errors/ErrorTypeTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
public final class ErrorTypeTest {
2828

29+
@SuppressWarnings("for-rollout:DifferentNameButSame")
2930
@Test
3031
public void testNameMustBeCamelCaseWithOptionalNameSpace() throws Exception {
3132
String[] badNames = new String[] {":", "foo:Bar", ":Bar", "Bar:", "foo:bar", "Foo:bar", "Foo:2Bar"};
@@ -64,21 +65,26 @@ public void testDefaultErrorTypeHttpErrorCodes() throws Exception {
6465
assertThat(ErrorType.INTERNAL.httpErrorCode()).isEqualTo(500);
6566
}
6667

68+
@SuppressWarnings("for-rollout:DifferentNameButSame")
6769
@Test
6870
public void testCanCreateCustomClientAndServerErrors() throws Exception {
71+
@SuppressWarnings("for-rollout:DifferentNameButSame")
6972
ErrorType customClient = ErrorType.create(ErrorType.Code.CUSTOM_CLIENT, "Namespace:MyDesc");
7073
assertThat(customClient.code()).isEqualTo(ErrorType.Code.CUSTOM_CLIENT);
7174
assertThat(customClient.httpErrorCode()).isEqualTo(400);
7275
assertThat(customClient.name()).isEqualTo("Namespace:MyDesc");
7376

77+
@SuppressWarnings("for-rollout:DifferentNameButSame")
7478
ErrorType customServer = ErrorType.create(ErrorType.Code.CUSTOM_SERVER, "Namespace:MyDesc");
7579
assertThat(customServer.code()).isEqualTo(ErrorType.Code.CUSTOM_SERVER);
7680
assertThat(customServer.httpErrorCode()).isEqualTo(500);
7781
assertThat(customServer.name()).isEqualTo("Namespace:MyDesc");
7882
}
7983

84+
@SuppressWarnings("for-rollout:DifferentNameButSame")
8085
@Test
8186
public void testCanCreateNewErrorTypes() throws Exception {
87+
@SuppressWarnings("for-rollout:DifferentNameButSame")
8288
ErrorType error = ErrorType.create(ErrorType.Code.FAILED_PRECONDITION, "Namespace:MyDesc");
8389
assertThat(error.code()).isEqualTo(ErrorType.Code.FAILED_PRECONDITION);
8490
assertThat(error.httpErrorCode()).isEqualTo(500);

errors/src/test/java/com/palantir/conjure/java/api/errors/RemoteExceptionTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@ public final class RemoteExceptionTest {
2727
@Test
2828
public void testJavaSerialization() {
2929
// With explicit error instance
30+
@SuppressWarnings("for-rollout:Var")
3031
SerializableError error = new SerializableError.Builder()
3132
.errorCode("errorCode")
3233
.errorName("errorName")
3334
.errorInstanceId("errorId")
3435
.build();
36+
@SuppressWarnings("for-rollout:Var")
3537
RemoteException expected = new RemoteException(error, 500);
38+
@SuppressWarnings("for-rollout:Var")
3639
RemoteException actual = SerializationUtils.deserialize(SerializationUtils.serialize(expected));
3740
assertThat(actual).isEqualToComparingFieldByField(expected);
3841

errors/src/test/java/com/palantir/conjure/java/api/errors/SerializableErrorTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public void forException_arg_key_collisions_just_use_the_last_one() {
7575
@Test
7676
public void forException_listArgValue_serializesWithToString() {
7777
ErrorType error = ErrorType.INTERNAL;
78+
@SuppressWarnings("for-rollout:Java8ApiChecker")
7879
ServiceException exception = new ServiceException(
7980
error, SafeArg.of("safe-list", List.of("1", "2")), UnsafeArg.of("unsafe-list", List.of("3", "4")));
8081

@@ -91,6 +92,7 @@ public void forException_listArgValue_serializesWithToString() {
9192
@Test
9293
public void forException_mapArgValue_serializesWithToString() {
9394
ErrorType error = ErrorType.INTERNAL;
95+
@SuppressWarnings("for-rollout:Java8ApiChecker")
9496
ServiceException exception = new ServiceException(
9597
error, SafeArg.of("safe-map", Map.of("1", "2")), UnsafeArg.of("unsafe-map", Map.of("ABC", "DEF")));
9698

0 commit comments

Comments
 (0)