From 9842aa66c5ad24df83a62c65a3066579a37d8859 Mon Sep 17 00:00:00 2001 From: Michael Nazario Date: Tue, 3 Jul 2018 06:49:48 -0400 Subject: [PATCH] Upgrade error-prone's EqualsHashCode and EqualsIncompatibleType from Warn -> Error (#298) Fixes #297 Enables [`EqualsHashCode`](http://errorprone.info/bugpattern/EqualsHashCode) and [`EqualsIncompatibleType`](http://errorprone.info/bugpattern/EqualsIncompatibleType) as `ERROR` for Errorprone. --- .../palantir/baseline/plugins/BaselineErrorProne.groovy | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineErrorProne.groovy b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineErrorProne.groovy index f779edb87..f49974b71 100644 --- a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineErrorProne.groovy +++ b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineErrorProne.groovy @@ -19,6 +19,7 @@ package com.palantir.baseline.plugins import net.ltgt.gradle.errorprone.ErrorPronePlugin import org.gradle.api.GradleException import org.gradle.api.Project +import org.gradle.api.tasks.compile.JavaCompile class BaselineErrorProne extends AbstractBaselinePlugin { @@ -30,6 +31,14 @@ class BaselineErrorProne extends AbstractBaselinePlugin { // TODO(rfink): This is somewhat ugly. Is there a better to add the processor dependency on the library? errorprone "com.palantir.baseline:baseline-error-prone:${extractVersionString()}" } + + project.tasks.withType(JavaCompile) { + options.compilerArgs += [ + "-XepDisableWarningsInGeneratedCode", + "-Xep:EqualsHashCode:ERROR", + "-Xep:EqualsIncompatibleType:ERROR", + ] + } } private String extractVersionString() {