Files
gerrit/tools/BUILD
Edwin Kempin e7fc5ee635 Disable ImmutableAnnotationChecker ErrorProne error to fix build
On my Mac notebook building gerrit fails due to
ImmutableAnnotationChecker errors reported by ErrorProne. Downgrade this
check to warning level while the code doesn’t conform with this check
yet.

INFO: Analyzed target //:gerrit (127 packages loaded, 2033 targets configured).
INFO: Found 1 target...
ERROR: /Users/ekempin/git/gerrit/java/com/google/gerrit/util/cli/BUILD:1:1: Building java/com/google/gerrit/util/cli/libcli.jar (9 source files) and running annotation processors (AutoAnnotationProcessor, AutoValueProcessor) failed (Exit 1)
bazel-out/darwin-fastbuild/bin/java/com/google/gerrit/util/cli/_javac/cli/libcli_sourcegenfiles/com/google/gerrit/util/cli/AutoAnnotation_OptionUtil_newOption.java:12: error: [ImmutableAnnotationChecker] annotations should be immutable: 'AutoAnnotation_OptionUtil_newOption' has field 'aliases' of type 'java.lang.String[]', arrays are mutable
  private final String[] aliases;
                         ^
    (see https://errorprone.info/bugpattern/ImmutableAnnotationChecker)
bazel-out/darwin-fastbuild/bin/java/com/google/gerrit/util/cli/_javac/cli/libcli_sourcegenfiles/com/google/gerrit/util/cli/AutoAnnotation_OptionUtil_newOption.java:26: error: [ImmutableAnnotationChecker] annotations should be immutable: 'AutoAnnotation_OptionUtil_newOption' has field 'depends' of type 'java.lang.String[]', arrays are mutable
  private final String[] depends;
                         ^
    (see https://errorprone.info/bugpattern/ImmutableAnnotationChecker)
bazel-out/darwin-fastbuild/bin/java/com/google/gerrit/util/cli/_javac/cli/libcli_sourcegenfiles/com/google/gerrit/util/cli/AutoAnnotation_OptionUtil_newOption.java:28: error: [ImmutableAnnotationChecker] annotations should be immutable: 'AutoAnnotation_OptionUtil_newOption' has field 'forbids' of type 'java.lang.String[]', arrays are mutable
  private final String[] forbids;
                         ^
    (see https://errorprone.info/bugpattern/ImmutableAnnotationChecker)
Target //:gerrit failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 28.821s, Critical Path: 13.18s
INFO: 15 processes: 14 darwin-sandbox, 1 worker.
FAILED: Build did NOT complete successfully

Change-Id: Id7911fb6dd88dd2abdb03010096ee64d4a4d37ec
Signed-off-by: Edwin Kempin <ekempin@google.com>
2019-08-26 11:44:03 +02:00

118 lines
4.2 KiB
Python

load(
"@bazel_tools//tools/jdk:default_java_toolchain.bzl",
"JDK9_JVM_OPTS",
"default_java_toolchain",
)
exports_files(["nongoogle.bzl"])
py_binary(
name = "merge_jars",
srcs = ["merge_jars.py"],
main = "merge_jars.py",
visibility = ["//visibility:public"],
)
default_java_toolchain(
name = "error_prone_warnings_toolchain",
bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath.jar"],
jvm_opts = JDK9_JVM_OPTS,
package_configuration = [
":error_prone",
],
visibility = ["//visibility:public"],
)
# Error Prone errors enabled by default; see ../.bazelrc for how this is
# enabled. This warnings list is originally based on:
# https://github.com/bazelbuild/BUILD_file_generator/blob/master/tools/bazel_defs/java.bzl
# However, feel free to add any additional errors. Thus far they have all been pretty useful.
java_package_configuration(
name = "error_prone",
javacopts = [
"-XepDisableWarningsInGeneratedCode",
"-Xep:AmbiguousMethodReference:ERROR",
"-Xep:AutoValueFinalMethods:ERROR",
"-Xep:BadAnnotationImplementation:ERROR",
"-Xep:BadComparable:ERROR",
"-Xep:BoxedPrimitiveConstructor:ERROR",
"-Xep:CannotMockFinalClass:ERROR",
"-Xep:ClassCanBeStatic:ERROR",
"-Xep:ClassNewInstance:ERROR",
"-Xep:DateFormatConstant:ERROR",
"-Xep:DefaultCharset:ERROR",
"-Xep:DoubleCheckedLocking:ERROR",
"-Xep:ElementsCountedInLoop:ERROR",
"-Xep:DoubleCheckedLocking:ERROR",
"-Xep:ElementsCountedInLoop:ERROR",
"-Xep:EqualsHashCode:ERROR",
"-Xep:EqualsIncompatibleType:ERROR",
"-Xep:ExpectedExceptionChecker:ERROR",
"-Xep:Finally:ERROR",
"-Xep:FloatingPointLiteralPrecision:ERROR",
"-Xep:FragmentInjection:ERROR",
"-Xep:FragmentNotInstantiable:ERROR",
"-Xep:FunctionalInterfaceClash:ERROR",
"-Xep:FutureReturnValueIgnored:ERROR",
"-Xep:GetClassOnEnum:ERROR",
"-Xep:ImmutableAnnotationChecker:WARN",
"-Xep:ImmutableEnumChecker:ERROR",
"-Xep:IncompatibleModifiers:ERROR",
"-Xep:InjectOnConstructorOfAbstractClass:ERROR",
"-Xep:InputStreamSlowMultibyteRead:ERROR",
"-Xep:IterableAndIterator:ERROR",
"-Xep:JUnit3FloatingPointComparisonWithoutDelta:ERROR",
"-Xep:JUnitAmbiguousTestClass:ERROR",
"-Xep:LiteralClassName:ERROR",
"-Xep:MissingCasesInEnumSwitch:ERROR",
"-Xep:MissingFail:ERROR",
"-Xep:MissingOverride:ERROR",
"-Xep:MutableConstantField:ERROR",
"-Xep:NarrowingCompoundAssignment:ERROR",
"-Xep:NonAtomicVolatileUpdate:ERROR",
"-Xep:NonOverridingEquals:ERROR",
"-Xep:NullableConstructor:ERROR",
"-Xep:NullablePrimitive:ERROR",
"-Xep:NullableVoid:ERROR",
"-Xep:OperatorPrecedence:ERROR",
"-Xep:OverridesGuiceInjectableMethod:ERROR",
"-Xep:PreconditionsInvalidPlaceholder:ERROR",
"-Xep:ProtoFieldPreconditionsCheckNotNull:ERROR",
"-Xep:ProtocolBufferOrdinal:ERROR",
"-Xep:ReferenceEquality:ERROR",
"-Xep:RequiredModifiers:ERROR",
"-Xep:ShortCircuitBoolean:ERROR",
"-Xep:SimpleDateFormatConstant:ERROR",
"-Xep:StaticGuardedByInstance:ERROR",
"-Xep:StringEquality:ERROR",
"-Xep:SynchronizeOnNonFinalField:ERROR",
"-Xep:TruthConstantAsserts:ERROR",
"-Xep:TypeParameterShadowing:ERROR",
"-Xep:TypeParameterUnusedInFormals:ERROR",
"-Xep:URLEqualsHashCode:ERROR",
"-Xep:UnsynchronizedOverridesSynchronized:ERROR",
"-Xep:WaitNotInLoop:ERROR",
"-Xep:WildcardImport:ERROR",
],
packages = ["error_prone_packages"],
)
package_group(
name = "error_prone_packages",
packages = [
"//java/...",
"//javatests/...",
"//plugins/codemirror-editor/...",
"//plugins/commit-message-length-validator/...",
"//plugins/delete-project/...",
"//plugins/download-commands/...",
"//plugins/gitiles/...",
"//plugins/hooks/...",
"//plugins/plugin-manager/...",
"//plugins/replication/...",
"//plugins/reviewnotes/...",
"//plugins/singleusergroup/...",
"//plugins/webhooks/...",
],
)