xref: /JGit/tools/BUILD (revision 245c2c09a079e2f6fffb05125b23ee4d9dd9a331)
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",
28*245c2c09SDavid Pursehouse        "-Xep:WildcardImport:ERROR",
297d89f0a0SDavid Ostrovsky        "-Xep:AmbiguousMethodReference:WARN",
30*245c2c09SDavid Pursehouse        "-Xep:BadAnnotationImplementation:ERROR",
317d89f0a0SDavid Ostrovsky        "-Xep:BadComparable:WARN",
327d89f0a0SDavid Ostrovsky        "-Xep:BoxedPrimitiveConstructor:ERROR",
33*245c2c09SDavid Pursehouse        "-Xep:CannotMockFinalClass:ERROR",
341385f4b3SDavid Pursehouse        "-Xep:ClassCanBeStatic:ERROR",
357d89f0a0SDavid Ostrovsky        "-Xep:ClassNewInstance:WARN",
36d54fc955SDavid Pursehouse        "-Xep:DefaultCharset:ERROR",
37*245c2c09SDavid Pursehouse        "-Xep:DoubleCheckedLocking:ERROR",
38*245c2c09SDavid Pursehouse        "-Xep:ElementsCountedInLoop:ERROR",
39*245c2c09SDavid Pursehouse        "-Xep:EqualsHashCode:ERROR",
40*245c2c09SDavid Pursehouse        "-Xep:EqualsIncompatibleType:ERROR",
411f14c16aSDavid Pursehouse        "-Xep:ExpectedExceptionChecker:ERROR",
427d89f0a0SDavid Ostrovsky        "-Xep:Finally:WARN",
43*245c2c09SDavid Pursehouse        "-Xep:FloatingPointLiteralPrecision:ERROR",
44*245c2c09SDavid Pursehouse        "-Xep:FragmentInjection:ERROR",
45*245c2c09SDavid Pursehouse        "-Xep:FragmentNotInstantiable:ERROR",
46*245c2c09SDavid Pursehouse        "-Xep:FunctionalInterfaceClash:ERROR",
477d89f0a0SDavid Ostrovsky        "-Xep:FutureReturnValueIgnored:WARN",
48*245c2c09SDavid Pursehouse        "-Xep:GetClassOnEnum:ERROR",
49*245c2c09SDavid Pursehouse        "-Xep:ImmutableAnnotationChecker:ERROR",
507d89f0a0SDavid Ostrovsky        "-Xep:ImmutableEnumChecker:WARN",
51*245c2c09SDavid Pursehouse        "-Xep:IncompatibleModifiers:ERROR",
52*245c2c09SDavid Pursehouse        "-Xep:InjectOnConstructorOfAbstractClass:ERROR",
53*245c2c09SDavid Pursehouse        "-Xep:InputStreamSlowMultibyteRead:ERROR",
54*245c2c09SDavid Pursehouse        "-Xep:IterableAndIterator:ERROR",
55*245c2c09SDavid Pursehouse        "-Xep:JUnit3FloatingPointComparisonWithoutDelta:ERROR",
56*245c2c09SDavid Pursehouse        "-Xep:JUnitAmbiguousTestClass:ERROR",
57*245c2c09SDavid Pursehouse        "-Xep:LiteralClassName:ERROR",
58f5d7f93bSDavid Pursehouse        "-Xep:MissingFail:ERROR",
59*245c2c09SDavid Pursehouse        "-Xep:MissingOverride:ERROR",
60*245c2c09SDavid Pursehouse        "-Xep:MutableConstantField:ERROR",
617d89f0a0SDavid Ostrovsky        "-Xep:NarrowingCompoundAssignment:WARN",
62*245c2c09SDavid Pursehouse        "-Xep:NonAtomicVolatileUpdate:ERROR",
637d89f0a0SDavid Ostrovsky        "-Xep:NonOverridingEquals:WARN",
64*245c2c09SDavid Pursehouse        "-Xep:NullableConstructor:ERROR",
65*245c2c09SDavid Pursehouse        "-Xep:NullablePrimitive:ERROR",
66*245c2c09SDavid Pursehouse        "-Xep:NullableVoid:ERROR",
677d89f0a0SDavid Ostrovsky        "-Xep:OperatorPrecedence:WARN",
68*245c2c09SDavid Pursehouse        "-Xep:OverridesGuiceInjectableMethod:ERROR",
69*245c2c09SDavid Pursehouse        "-Xep:PreconditionsInvalidPlaceholder:ERROR",
70*245c2c09SDavid Pursehouse        "-Xep:ProtoFieldPreconditionsCheckNotNull:ERROR",
71*245c2c09SDavid Pursehouse        "-Xep:ProtocolBufferOrdinal:ERROR",
72*245c2c09SDavid Pursehouse        "-Xep:RequiredModifiers:ERROR",
737d89f0a0SDavid Ostrovsky        "-Xep:ShortCircuitBoolean:WARN",
74*245c2c09SDavid Pursehouse        "-Xep:SimpleDateFormatConstant:ERROR",
75*245c2c09SDavid Pursehouse        "-Xep:StaticGuardedByInstance:ERROR",
76*245c2c09SDavid Pursehouse        "-Xep:SynchronizeOnNonFinalField:ERROR",
77*245c2c09SDavid Pursehouse        "-Xep:TruthConstantAsserts:ERROR",
78*245c2c09SDavid Pursehouse        "-Xep:TypeParameterShadowing:ERROR",
797d89f0a0SDavid Ostrovsky        "-Xep:TypeParameterUnusedInFormals:WARN",
80*245c2c09SDavid Pursehouse        "-Xep:URLEqualsHashCode:ERROR",
81*245c2c09SDavid Pursehouse        "-Xep:UnsynchronizedOverridesSynchronized:ERROR",
82*245c2c09SDavid 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