diff --git a/build.gradle b/build.gradle index 6903c2f7..48254253 100644 --- a/build.gradle +++ b/build.gradle @@ -14,12 +14,12 @@ buildscript { classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' classpath 'com.netflix.nebula:gradle-info-plugin:5.2.0' classpath 'com.netflix.nebula:nebula-publishing-plugin:14.1.1' - classpath 'com.palantir.baseline:gradle-baseline-java:2.37.0' + classpath 'com.palantir.baseline:gradle-baseline-java:2.41.0' classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:1.13.1' classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.12.2' classpath 'com.palantir.metricschema:gradle-metric-schema:0.4.8' classpath 'gradle.plugin.org.inferred:gradle-processors:3.1.0' - classpath 'com.google.errorprone:error_prone_core:2.3.3' + classpath 'com.google.errorprone:error_prone_core:2.3.4' } } diff --git a/changelog/@unreleased/pr-538.v2.yml b/changelog/@unreleased/pr-538.v2.yml new file mode 100644 index 00000000..56137752 --- /dev/null +++ b/changelog/@unreleased/pr-538.v2.yml @@ -0,0 +1,5 @@ +type: improvement +improvement: + description: Upgrade gradle-baseline to 2.41.0 and error-prone compiler to 2.3.4 + links: + - https://github.com/palantir/tritium/pull/538 diff --git a/tritium-core/src/main/java/com/palantir/tritium/event/InstrumentationFilters.java b/tritium-core/src/main/java/com/palantir/tritium/event/InstrumentationFilters.java index b38e208a..e8ec3c0b 100644 --- a/tritium-core/src/main/java/com/palantir/tritium/event/InstrumentationFilters.java +++ b/tritium-core/src/main/java/com/palantir/tritium/event/InstrumentationFilters.java @@ -22,6 +22,9 @@ public enum InstrumentationFilters implements InstrumentationFilter { + /** + * Instrument all invocations. + */ INSTRUMENT_ALL { @Override public boolean shouldInstrument( @@ -32,6 +35,9 @@ public boolean shouldInstrument( } }, + /** + * Instrument no invocations. + */ INSTRUMENT_NONE { @Override public boolean shouldInstrument( diff --git a/tritium-lib/src/main/java/com/palantir/tritium/proxy/ByteBuddyInstrumentationAdvice.java b/tritium-lib/src/main/java/com/palantir/tritium/proxy/ByteBuddyInstrumentationAdvice.java index 475325c8..991c5e09 100644 --- a/tritium-lib/src/main/java/com/palantir/tritium/proxy/ByteBuddyInstrumentationAdvice.java +++ b/tritium-lib/src/main/java/com/palantir/tritium/proxy/ByteBuddyInstrumentationAdvice.java @@ -61,7 +61,7 @@ static InvocationContext enter( return eventHandler.preInvocation(proxy, method, arguments); } return disabledHandlerSentinel; - } catch (Throwable t) { + } catch (RuntimeException | Error t) { if (logger.isWarnEnabled()) { logger.warn( "Failure occurred handling 'preInvocation' invocation on: {}", @@ -87,7 +87,7 @@ static void exit( } else { eventHandler.onFailure(context, thrown); } - } catch (Throwable t) { + } catch (RuntimeException | Error t) { if (logger.isWarnEnabled()) { Object value = thrown == null ? result : thrown; logger.warn( diff --git a/tritium-lib/src/main/java/com/palantir/tritium/proxy/InvocationEventProxy.java b/tritium-lib/src/main/java/com/palantir/tritium/proxy/InvocationEventProxy.java index d0fd5227..a968caf9 100644 --- a/tritium-lib/src/main/java/com/palantir/tritium/proxy/InvocationEventProxy.java +++ b/tritium-lib/src/main/java/com/palantir/tritium/proxy/InvocationEventProxy.java @@ -82,7 +82,7 @@ private boolean isEnabled(Object instance, Method method, Object[] args) { try { return eventHandler.isEnabled() && filter.shouldInstrument(instance, method, args); - } catch (Throwable t) { + } catch (RuntimeException | Error t) { logInvocationWarning("isEnabled", instance, method, t); return false; } @@ -103,7 +103,7 @@ public final Object invoke(Object proxy, Method method, @Nullable Object[] nulla return handleOnSuccess(context, result); } catch (InvocationTargetException ite) { throw handleOnFailure(context, ite.getCause()); - } catch (Throwable t) { + } catch (IllegalAccessException | RuntimeException | Error t) { throw handleOnFailure(context, t); } } else { diff --git a/tritium-metrics-jvm/src/main/java/com/palantir/tritium/metrics/jvm/SafepointMetrics.java b/tritium-metrics-jvm/src/main/java/com/palantir/tritium/metrics/jvm/SafepointMetrics.java index ce566b24..c125e178 100644 --- a/tritium-metrics-jvm/src/main/java/com/palantir/tritium/metrics/jvm/SafepointMetrics.java +++ b/tritium-metrics-jvm/src/main/java/com/palantir/tritium/metrics/jvm/SafepointMetrics.java @@ -52,7 +52,7 @@ private static Object invoke(Method method, Object object) { try { return method.invoke(object); } catch (IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); + throw new IllegalStateException(e); } } diff --git a/tritium-tracing/src/main/java/com/palantir/tritium/tracing/ReflectiveTracer.java b/tritium-tracing/src/main/java/com/palantir/tritium/tracing/ReflectiveTracer.java index 6315ccd6..6e46be75 100644 --- a/tritium-tracing/src/main/java/com/palantir/tritium/tracing/ReflectiveTracer.java +++ b/tritium-tracing/src/main/java/com/palantir/tritium/tracing/ReflectiveTracer.java @@ -90,7 +90,7 @@ private static List paramsToClassNames(Method method) { private static RuntimeException throwUnchecked(ReflectiveOperationException reflectionException) { Throwable cause = reflectionException.getCause() != null ? reflectionException.getCause() : reflectionException; Throwables.throwIfUnchecked(cause); - throw new RuntimeException(cause); + throw new IllegalStateException(cause); } } diff --git a/tritium-tracing/src/main/java/com/palantir/tritium/tracing/RemotingCompatibleTracingInvocationEventHandler.java b/tritium-tracing/src/main/java/com/palantir/tritium/tracing/RemotingCompatibleTracingInvocationEventHandler.java index a043ea17..894ca967 100644 --- a/tritium-tracing/src/main/java/com/palantir/tritium/tracing/RemotingCompatibleTracingInvocationEventHandler.java +++ b/tritium-tracing/src/main/java/com/palantir/tritium/tracing/RemotingCompatibleTracingInvocationEventHandler.java @@ -37,6 +37,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@SuppressWarnings("TryFailRefactoring") // work-around https://github.com/google/error-prone/issues/1447 public final class RemotingCompatibleTracingInvocationEventHandler extends AbstractInvocationEventHandler { diff --git a/versions.lock b/versions.lock index 205db380..fe2a2c30 100644 --- a/versions.lock +++ b/versions.lock @@ -9,7 +9,7 @@ com.github.ben-manes.caffeine:caffeine:2.8.0 (1 constraints: 0c050d36) com.google.auto:auto-common:0.10 (2 constraints: 1714ff67) com.google.auto.service:auto-service:1.0-rc4 (1 constraints: db05b241) com.google.code.findbugs:jsr305:3.0.2 (4 constraints: 5b3585ed) -com.google.errorprone:error_prone_annotations:2.3.3 (5 constraints: c03c8d97) +com.google.errorprone:error_prone_annotations:2.3.4 (5 constraints: c13c3198) com.google.guava:failureaccess:1.0.1 (1 constraints: 140ae1b4) com.google.guava:guava:28.0-jre (5 constraints: 06499b62) com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava (1 constraints: bd17c918) diff --git a/versions.props b/versions.props index f86bc0e4..a2ffbf3a 100644 --- a/versions.props +++ b/versions.props @@ -5,8 +5,8 @@ com.google.auto.service:auto-service = 1.0-rc4 com.google.auto:auto-common = 0.10 com.google.code.findbugs:jFormatString = 3.0.0 com.google.code.findbugs:jsr305 = 3.0.2 -com.google.errorprone:error_prone_annotations = 2.3.3 -com.google.errorprone:error_prone_core = 2.3.3 +com.google.errorprone:error_prone_annotations = 2.3.4 +com.google.errorprone:error_prone_core = 2.3.4 com.google.guava:guava = 23.6.1-jre com.google.guava:guava-testlib = 23.6.1-jre com.palantir.remoting3:* = 3.46.0