xref: /JGit/tools/BUILD (revision 4cc13297ccf1fa3e982bbb5638162b3bad63f93c)
17d89f0a0SDavid Ostrovskyload(
27d89f0a0SDavid Ostrovsky    "@bazel_tools//tools/jdk:default_java_toolchain.bzl",
37d89f0a0SDavid Ostrovsky    "JDK9_JVM_OPTS",
47d89f0a0SDavid Ostrovsky    "default_java_toolchain",
57d89f0a0SDavid Ostrovsky)
622973d13SMatthias 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",
3040f6c92cSDavid Pursehouse        "-Xep:AmbiguousMethodReference:ERROR",
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",
36dad9e1ffSDavid Pursehouse        "-Xep:ClassNewInstance:ERROR",
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",
427d89f0a0SDavid Ostrovsky        "-Xep:Finally:WARN",
43245c2c09SDavid Pursehouse        "-Xep:FloatingPointLiteralPrecision:ERROR",
44245c2c09SDavid Pursehouse        "-Xep:FragmentInjection:ERROR",
45245c2c09SDavid Pursehouse        "-Xep:FragmentNotInstantiable:ERROR",
46245c2c09SDavid Pursehouse        "-Xep:FunctionalInterfaceClash:ERROR",
478bd0ba0fSDavid Pursehouse        "-Xep:FutureReturnValueIgnored:ERROR",
48245c2c09SDavid Pursehouse        "-Xep:GetClassOnEnum:ERROR",
49245c2c09SDavid Pursehouse        "-Xep:ImmutableAnnotationChecker:ERROR",
5013696b8dSDavid Pursehouse        "-Xep:ImmutableEnumChecker:ERROR",
51245c2c09SDavid Pursehouse        "-Xep:IncompatibleModifiers:ERROR",
52245c2c09SDavid Pursehouse        "-Xep:InjectOnConstructorOfAbstractClass:ERROR",
53245c2c09SDavid Pursehouse        "-Xep:InputStreamSlowMultibyteRead:ERROR",
54245c2c09SDavid Pursehouse        "-Xep:IterableAndIterator:ERROR",
55245c2c09SDavid Pursehouse        "-Xep:JUnit3FloatingPointComparisonWithoutDelta:ERROR",
56245c2c09SDavid Pursehouse        "-Xep:JUnitAmbiguousTestClass:ERROR",
57245c2c09SDavid Pursehouse        "-Xep:LiteralClassName:ERROR",
58f5d7f93bSDavid Pursehouse        "-Xep:MissingFail:ERROR",
59245c2c09SDavid Pursehouse        "-Xep:MissingOverride:ERROR",
60245c2c09SDavid Pursehouse        "-Xep:MutableConstantField:ERROR",
6172ae0892SDavid Pursehouse        "-Xep:NarrowingCompoundAssignment:ERROR",
62245c2c09SDavid Pursehouse        "-Xep:NonAtomicVolatileUpdate:ERROR",
63430be893SDavid Pursehouse        "-Xep:NonOverridingEquals:ERROR",
64245c2c09SDavid Pursehouse        "-Xep:NullableConstructor:ERROR",
65245c2c09SDavid Pursehouse        "-Xep:NullablePrimitive:ERROR",
66245c2c09SDavid Pursehouse        "-Xep:NullableVoid:ERROR",
670f4554f1SDavid Pursehouse        "-Xep:OperatorPrecedence:ERROR",
68245c2c09SDavid Pursehouse        "-Xep:OverridesGuiceInjectableMethod:ERROR",
69245c2c09SDavid Pursehouse        "-Xep:PreconditionsInvalidPlaceholder:ERROR",
70245c2c09SDavid Pursehouse        "-Xep:ProtoFieldPreconditionsCheckNotNull:ERROR",
71245c2c09SDavid Pursehouse        "-Xep:ProtocolBufferOrdinal:ERROR",
72245c2c09SDavid Pursehouse        "-Xep:RequiredModifiers:ERROR",
734fe4b0a6SDavid Pursehouse        "-Xep:ShortCircuitBoolean:ERROR",
74245c2c09SDavid Pursehouse        "-Xep:SimpleDateFormatConstant:ERROR",
75245c2c09SDavid Pursehouse        "-Xep:StaticGuardedByInstance:ERROR",
76245c2c09SDavid Pursehouse        "-Xep:SynchronizeOnNonFinalField:ERROR",
77245c2c09SDavid Pursehouse        "-Xep:TruthConstantAsserts:ERROR",
78245c2c09SDavid Pursehouse        "-Xep:TypeParameterShadowing:ERROR",
797d89f0a0SDavid Ostrovsky        "-Xep:TypeParameterUnusedInFormals:WARN",
80245c2c09SDavid Pursehouse        "-Xep:URLEqualsHashCode:ERROR",
81*4cc13297SDavid Pursehouse        "-Xep:UnusedException: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