Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade gradle-baseline and error-prone #538

Merged
merged 9 commits into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}

Expand Down
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-538.v2.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

public enum InstrumentationFilters implements InstrumentationFilter {

/**
* Instrument all invocations.
*/
INSTRUMENT_ALL {
@Override
public boolean shouldInstrument(
Expand All @@ -32,6 +35,9 @@ public boolean shouldInstrument(
}
},

/**
* Instrument no invocations.
*/
INSTRUMENT_NONE {
@Override
public boolean shouldInstrument(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}",
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private static List<String> paramsToClassNames(Method method) {
private static RuntimeException throwUnchecked(ReflectiveOperationException reflectionException) {
Throwable cause = reflectionException.getCause() != null ? reflectionException.getCause() : reflectionException;
Throwables.throwIfUnchecked(cause);
throw new RuntimeException(cause);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this a lot

throw new IllegalStateException(cause);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<InvocationContext> {

Expand Down
4 changes: 2 additions & 2 deletions versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down