xref: /JGit/tools/BUILD (revision 22973d13ea4eaef390a9ce00d448317808e07ced)
17d89f0a0SDavid Ostrovskyload(
27d89f0a0SDavid Ostrovsky    "@bazel_tools//tools/jdk:default_java_toolchain.bzl",
37d89f0a0SDavid Ostrovsky    "JDK9_JVM_OPTS",
47d89f0a0SDavid Ostrovsky    "default_java_toolchain",
57d89f0a0SDavid Ostrovsky)
6*22973d13SMatthias Sohnload("@rules_java//java:defs.bzl", "java_package_configuration")
77d89f0a0SDavid Ostrovsky
87d89f0a0SDavid Ostrovskydefault_java_toolchain(
97d89f0a0SDavid Ostrovsky    name = "error_prone_warnings_toolchain",
109625db20SDavid Ostrovsky    bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath.jar"],
117d89f0a0SDavid Ostrovsky    jvm_opts = JDK9_JVM_OPTS,
127d89f0a0SDavid Ostrovsky    package_configuration = [
137d89f0a0SDavid Ostrovsky        ":error_prone",
147d89f0a0SDavid Ostrovsky    ],
157d89f0a0SDavid Ostrovsky    visibility = ["//visibility:public"],
167d89f0a0SDavid Ostrovsky)
177d89f0a0SDavid Ostrovsky
184c33f70dSDavid Pursehouse# Error Prone errors enabled by default; see ../.bazelrc for how this is
194c33f70dSDavid Pursehouse# enabled. This warnings list is originally based on:
207d89f0a0SDavid Ostrovsky# https://github.com/bazelbuild/BUILD_file_generator/blob/master/tools/bazel_defs/java.bzl
214c33f70dSDavid Pursehouse# However, feel free to add any additional errors. Thus far they have all been pretty useful.
227d89f0a0SDavid Ostrovskyjava_package_configuration(
237d89f0a0SDavid Ostrovsky    name = "error_prone",
247d89f0a0SDavid Ostrovsky    javacopts = [
257d89f0a0SDavid Ostrovsky        "-XepDisableWarningsInGeneratedCode",
267d89f0a0SDavid Ostrovsky        "-Xep:MissingCasesInEnumSwitch:ERROR",
277d89f0a0SDavid Ostrovsky        "-Xep:ReferenceEquality:WARN",
287d89f0a0SDavid Ostrovsky        "-Xep:StringEquality:WARN",
29245c2c09SDavid Pursehouse        "-Xep:WildcardImport:ERROR",
307d89f0a0SDavid Ostrovsky        "-Xep:AmbiguousMethodReference:WARN",
31245c2c09SDavid Pursehouse        "-Xep:BadAnnotationImplementation:ERROR",
327d89f0a0SDavid Ostrovsky        "-Xep:BadComparable:WARN",
337d89f0a0SDavid Ostrovsky        "-Xep:BoxedPrimitiveConstructor:ERROR",
34245c2c09SDavid Pursehouse        "-Xep:CannotMockFinalClass:ERROR",
351385f4b3SDavid Pursehouse        "-Xep:ClassCanBeStatic:ERROR",
367d89f0a0SDavid Ostrovsky        "-Xep:ClassNewInstance:WARN",
37d54fc955SDavid Pursehouse        "-Xep:DefaultCharset:ERROR",
38245c2c09SDavid Pursehouse        "-Xep:DoubleCheckedLocking:ERROR",
39245c2c09SDavid Pursehouse        "-Xep:ElementsCountedInLoop:ERROR",
40245c2c09SDavid Pursehouse        "-Xep:EqualsHashCode:ERROR",
41245c2c09SDavid Pursehouse        "-Xep:EqualsIncompatibleType:ERROR",
421f14c16aSDavid Pursehouse        "-Xep:ExpectedExceptionChecker:ERROR",
437d89f0a0SDavid Ostrovsky        "-Xep:Finally:WARN",
44245c2c09SDavid Pursehouse        "-Xep:FloatingPointLiteralPrecision:ERROR",
45245c2c09SDavid Pursehouse        "-Xep:FragmentInjection:ERROR",
46245c2c09SDavid Pursehouse        "-Xep:FragmentNotInstantiable:ERROR",
47245c2c09SDavid Pursehouse        "-Xep:FunctionalInterfaceClash:ERROR",
487d89f0a0SDavid Ostrovsky        "-Xep:FutureReturnValueIgnored:WARN",
49245c2c09SDavid Pursehouse        "-Xep:GetClassOnEnum:ERROR",
50245c2c09SDavid Pursehouse        "-Xep:ImmutableAnnotationChecker:ERROR",
517d89f0a0SDavid Ostrovsky        "-Xep:ImmutableEnumChecker:WARN",
52245c2c09SDavid Pursehouse        "-Xep:IncompatibleModifiers:ERROR",
53245c2c09SDavid Pursehouse        "-Xep:InjectOnConstructorOfAbstractClass:ERROR",
54245c2c09SDavid Pursehouse        "-Xep:InputStreamSlowMultibyteRead:ERROR",
55245c2c09SDavid Pursehouse        "-Xep:IterableAndIterator:ERROR",
56245c2c09SDavid Pursehouse        "-Xep:JUnit3FloatingPointComparisonWithoutDelta:ERROR",
57245c2c09SDavid Pursehouse        "-Xep:JUnitAmbiguousTestClass:ERROR",
58245c2c09SDavid Pursehouse        "-Xep:LiteralClassName:ERROR",
59f5d7f93bSDavid Pursehouse        "-Xep:MissingFail:ERROR",
60245c2c09SDavid Pursehouse        "-Xep:MissingOverride:ERROR",
61245c2c09SDavid Pursehouse        "-Xep:MutableConstantField:ERROR",
627d89f0a0SDavid Ostrovsky        "-Xep:NarrowingCompoundAssignment:WARN",
63245c2c09SDavid Pursehouse        "-Xep:NonAtomicVolatileUpdate:ERROR",
647d89f0a0SDavid Ostrovsky        "-Xep:NonOverridingEquals:WARN",
65245c2c09SDavid Pursehouse        "-Xep:NullableConstructor:ERROR",
66245c2c09SDavid Pursehouse        "-Xep:NullablePrimitive:ERROR",
67245c2c09SDavid Pursehouse        "-Xep:NullableVoid:ERROR",
687d89f0a0SDavid Ostrovsky        "-Xep:OperatorPrecedence:WARN",
69245c2c09SDavid Pursehouse        "-Xep:OverridesGuiceInjectableMethod:ERROR",
70245c2c09SDavid Pursehouse        "-Xep:PreconditionsInvalidPlaceholder:ERROR",
71245c2c09SDavid Pursehouse        "-Xep:ProtoFieldPreconditionsCheckNotNull:ERROR",
72245c2c09SDavid Pursehouse        "-Xep:ProtocolBufferOrdinal:ERROR",
73245c2c09SDavid Pursehouse        "-Xep:RequiredModifiers:ERROR",
747d89f0a0SDavid Ostrovsky        "-Xep:ShortCircuitBoolean:WARN",
75245c2c09SDavid Pursehouse        "-Xep:SimpleDateFormatConstant:ERROR",
76245c2c09SDavid Pursehouse        "-Xep:StaticGuardedByInstance:ERROR",
77245c2c09SDavid Pursehouse        "-Xep:SynchronizeOnNonFinalField:ERROR",
78245c2c09SDavid Pursehouse        "-Xep:TruthConstantAsserts:ERROR",
79245c2c09SDavid Pursehouse        "-Xep:TypeParameterShadowing:ERROR",
807d89f0a0SDavid Ostrovsky        "-Xep:TypeParameterUnusedInFormals:WARN",
81245c2c09SDavid Pursehouse        "-Xep:URLEqualsHashCode:ERROR",
82245c2c09SDavid Pursehouse        "-Xep:UnsynchronizedOverridesSynchronized:ERROR",
83245c2c09SDavid Pursehouse        "-Xep:WaitNotInLoop:ERROR",
847d89f0a0SDavid Ostrovsky    ],
857d89f0a0SDavid Ostrovsky    packages = ["error_prone_packages"],
867d89f0a0SDavid Ostrovsky)
877d89f0a0SDavid Ostrovsky
887d89f0a0SDavid Ostrovskypackage_group(
897d89f0a0SDavid Ostrovsky    name = "error_prone_packages",
907d89f0a0SDavid Ostrovsky    packages = [
917d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.ant.test/...",
923ec3ca0fSDavid Pursehouse        "//org.eclipse.jgit.ant/...",
937d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.archive/...",
947d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.http.apache/...",
957d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.http.server/...",
967d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.http.test/...",
977d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.junit.http/...",
983ec3ca0fSDavid Pursehouse        "//org.eclipse.jgit.junit/...",
997d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.lfs.server.test/...",
1003ec3ca0fSDavid Pursehouse        "//org.eclipse.jgit.lfs.server/...",
1017d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.lfs.test/...",
1023ec3ca0fSDavid Pursehouse        "//org.eclipse.jgit.lfs/...",
1037d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.packaging/...",
1047d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.pgm.test/...",
1053ec3ca0fSDavid Pursehouse        "//org.eclipse.jgit.pgm/...",
1067d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.test/...",
1077d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.ui/...",
1083ec3ca0fSDavid Pursehouse        "//org.eclipse.jgit/...",
1097d89f0a0SDavid Ostrovsky    ],
1107d89f0a0SDavid Ostrovsky)
111