xref: /JGit/tools/BUILD (revision 0f4554f12644b110f7b744a9f5f0ee34873e9497)
17d89f0a0SDavid Ostrovskyload(
27d89f0a0SDavid Ostrovsky    "@bazel_tools//tools/jdk:default_java_toolchain.bzl",
37d89f0a0SDavid Ostrovsky    "JDK9_JVM_OPTS",
47d89f0a0SDavid Ostrovsky    "default_java_toolchain",
57d89f0a0SDavid Ostrovsky)
67d89f0a0SDavid Ostrovsky
77d89f0a0SDavid Ostrovskydefault_java_toolchain(
87d89f0a0SDavid Ostrovsky    name = "error_prone_warnings_toolchain",
99625db20SDavid Ostrovsky    bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath.jar"],
107d89f0a0SDavid Ostrovsky    jvm_opts = JDK9_JVM_OPTS,
117d89f0a0SDavid Ostrovsky    package_configuration = [
127d89f0a0SDavid Ostrovsky        ":error_prone",
137d89f0a0SDavid Ostrovsky    ],
147d89f0a0SDavid Ostrovsky    visibility = ["//visibility:public"],
157d89f0a0SDavid Ostrovsky)
167d89f0a0SDavid Ostrovsky
174c33f70dSDavid Pursehouse# Error Prone errors enabled by default; see ../.bazelrc for how this is
184c33f70dSDavid Pursehouse# enabled. This warnings list is originally based on:
197d89f0a0SDavid Ostrovsky# https://github.com/bazelbuild/BUILD_file_generator/blob/master/tools/bazel_defs/java.bzl
204c33f70dSDavid Pursehouse# However, feel free to add any additional errors. Thus far they have all been pretty useful.
217d89f0a0SDavid Ostrovskyjava_package_configuration(
227d89f0a0SDavid Ostrovsky    name = "error_prone",
237d89f0a0SDavid Ostrovsky    javacopts = [
247d89f0a0SDavid Ostrovsky        "-XepDisableWarningsInGeneratedCode",
257d89f0a0SDavid Ostrovsky        "-Xep:MissingCasesInEnumSwitch:ERROR",
267d89f0a0SDavid Ostrovsky        "-Xep:ReferenceEquality:WARN",
277d89f0a0SDavid Ostrovsky        "-Xep:StringEquality:WARN",
28245c2c09SDavid Pursehouse        "-Xep:WildcardImport:ERROR",
297d89f0a0SDavid Ostrovsky        "-Xep:AmbiguousMethodReference:WARN",
30245c2c09SDavid Pursehouse        "-Xep:BadAnnotationImplementation:ERROR",
317d89f0a0SDavid Ostrovsky        "-Xep:BadComparable:WARN",
327d89f0a0SDavid Ostrovsky        "-Xep:BoxedPrimitiveConstructor:ERROR",
33245c2c09SDavid Pursehouse        "-Xep:CannotMockFinalClass:ERROR",
341385f4b3SDavid Pursehouse        "-Xep:ClassCanBeStatic:ERROR",
357d89f0a0SDavid Ostrovsky        "-Xep:ClassNewInstance:WARN",
36d54fc955SDavid Pursehouse        "-Xep:DefaultCharset:ERROR",
37245c2c09SDavid Pursehouse        "-Xep:DoubleCheckedLocking:ERROR",
38245c2c09SDavid Pursehouse        "-Xep:ElementsCountedInLoop:ERROR",
39245c2c09SDavid Pursehouse        "-Xep:EqualsHashCode:ERROR",
40245c2c09SDavid Pursehouse        "-Xep:EqualsIncompatibleType:ERROR",
411f14c16aSDavid Pursehouse        "-Xep:ExpectedExceptionChecker: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",
507d89f0a0SDavid Ostrovsky        "-Xep:ImmutableEnumChecker:WARN",
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",
617d89f0a0SDavid Ostrovsky        "-Xep:NarrowingCompoundAssignment:WARN",
62245c2c09SDavid Pursehouse        "-Xep:NonAtomicVolatileUpdate:ERROR",
637d89f0a0SDavid Ostrovsky        "-Xep:NonOverridingEquals:WARN",
64245c2c09SDavid Pursehouse        "-Xep:NullableConstructor:ERROR",
65245c2c09SDavid Pursehouse        "-Xep:NullablePrimitive:ERROR",
66245c2c09SDavid Pursehouse        "-Xep:NullableVoid:ERROR",
67*0f4554f1SDavid 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",
737d89f0a0SDavid Ostrovsky        "-Xep:ShortCircuitBoolean:WARN",
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",
81245c2c09SDavid Pursehouse        "-Xep:UnsynchronizedOverridesSynchronized:ERROR",
82245c2c09SDavid Pursehouse        "-Xep:WaitNotInLoop:ERROR",
837d89f0a0SDavid Ostrovsky    ],
847d89f0a0SDavid Ostrovsky    packages = ["error_prone_packages"],
857d89f0a0SDavid Ostrovsky)
867d89f0a0SDavid Ostrovsky
877d89f0a0SDavid Ostrovskypackage_group(
887d89f0a0SDavid Ostrovsky    name = "error_prone_packages",
897d89f0a0SDavid Ostrovsky    packages = [
907d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.ant.test/...",
913ec3ca0fSDavid Pursehouse        "//org.eclipse.jgit.ant/...",
927d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.archive/...",
937d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.http.apache/...",
947d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.http.server/...",
957d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.http.test/...",
967d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.junit.http/...",
973ec3ca0fSDavid Pursehouse        "//org.eclipse.jgit.junit/...",
987d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.lfs.server.test/...",
993ec3ca0fSDavid Pursehouse        "//org.eclipse.jgit.lfs.server/...",
1007d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.lfs.test/...",
1013ec3ca0fSDavid Pursehouse        "//org.eclipse.jgit.lfs/...",
1027d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.packaging/...",
1037d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.pgm.test/...",
1043ec3ca0fSDavid Pursehouse        "//org.eclipse.jgit.pgm/...",
1057d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.test/...",
1067d89f0a0SDavid Ostrovsky        "//org.eclipse.jgit.ui/...",
1073ec3ca0fSDavid Pursehouse        "//org.eclipse.jgit/...",
1087d89f0a0SDavid Ostrovsky    ],
1097d89f0a0SDavid Ostrovsky)
110