David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 1 | load( |
| 2 | "@bazel_tools//tools/jdk:default_java_toolchain.bzl", |
| 3 | "JDK9_JVM_OPTS", |
| 4 | "default_java_toolchain", |
| 5 | ) |
Matthias Sohn | 22973d1 | 2019-09-08 14:59:29 +0200 | [diff] [blame] | 6 | load("@rules_java//java:defs.bzl", "java_package_configuration") |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 7 | |
| 8 | default_java_toolchain( |
| 9 | name = "error_prone_warnings_toolchain", |
David Ostrovsky | 9625db2 | 2018-11-01 08:37:29 +0100 | [diff] [blame] | 10 | bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath.jar"], |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 11 | jvm_opts = JDK9_JVM_OPTS, |
| 12 | package_configuration = [ |
| 13 | ":error_prone", |
| 14 | ], |
| 15 | visibility = ["//visibility:public"], |
| 16 | ) |
| 17 | |
David Pursehouse | 4c33f70 | 2019-05-26 17:47:08 +0900 | [diff] [blame] | 18 | # Error Prone errors enabled by default; see ../.bazelrc for how this is |
| 19 | # enabled. This warnings list is originally based on: |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 20 | # https://github.com/bazelbuild/BUILD_file_generator/blob/master/tools/bazel_defs/java.bzl |
David Pursehouse | 4c33f70 | 2019-05-26 17:47:08 +0900 | [diff] [blame] | 21 | # However, feel free to add any additional errors. Thus far they have all been pretty useful. |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 22 | java_package_configuration( |
| 23 | name = "error_prone", |
| 24 | javacopts = [ |
| 25 | "-XepDisableWarningsInGeneratedCode", |
| 26 | "-Xep:MissingCasesInEnumSwitch:ERROR", |
| 27 | "-Xep:ReferenceEquality:WARN", |
| 28 | "-Xep:StringEquality:WARN", |
David Pursehouse | 245c2c0 | 2019-05-26 18:03:07 +0900 | [diff] [blame] | 29 | "-Xep:WildcardImport:ERROR", |
David Pursehouse | 40f6c92 | 2019-08-09 16:06:56 +0900 | [diff] [blame] | 30 | "-Xep:AmbiguousMethodReference:ERROR", |
David Pursehouse | 245c2c0 | 2019-05-26 18:03:07 +0900 | [diff] [blame] | 31 | "-Xep:BadAnnotationImplementation:ERROR", |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 32 | "-Xep:BadComparable:WARN", |
| 33 | "-Xep:BoxedPrimitiveConstructor:ERROR", |
David Pursehouse | 245c2c0 | 2019-05-26 18:03:07 +0900 | [diff] [blame] | 34 | "-Xep:CannotMockFinalClass:ERROR", |
David Pursehouse | 1385f4b | 2018-11-08 11:09:54 +0900 | [diff] [blame] | 35 | "-Xep:ClassCanBeStatic:ERROR", |
David Pursehouse | dad9e1f | 2019-06-22 18:40:49 +0900 | [diff] [blame] | 36 | "-Xep:ClassNewInstance:ERROR", |
David Pursehouse | d54fc95 | 2018-09-30 17:02:11 +0900 | [diff] [blame] | 37 | "-Xep:DefaultCharset:ERROR", |
David Pursehouse | 245c2c0 | 2019-05-26 18:03:07 +0900 | [diff] [blame] | 38 | "-Xep:DoubleCheckedLocking:ERROR", |
| 39 | "-Xep:ElementsCountedInLoop:ERROR", |
| 40 | "-Xep:EqualsHashCode:ERROR", |
| 41 | "-Xep:EqualsIncompatibleType:ERROR", |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 42 | "-Xep:Finally:WARN", |
David Pursehouse | 245c2c0 | 2019-05-26 18:03:07 +0900 | [diff] [blame] | 43 | "-Xep:FloatingPointLiteralPrecision:ERROR", |
| 44 | "-Xep:FragmentInjection:ERROR", |
| 45 | "-Xep:FragmentNotInstantiable:ERROR", |
| 46 | "-Xep:FunctionalInterfaceClash:ERROR", |
David Pursehouse | 8bd0ba0 | 2019-06-08 15:47:42 +0900 | [diff] [blame] | 47 | "-Xep:FutureReturnValueIgnored:ERROR", |
David Pursehouse | 245c2c0 | 2019-05-26 18:03:07 +0900 | [diff] [blame] | 48 | "-Xep:GetClassOnEnum:ERROR", |
| 49 | "-Xep:ImmutableAnnotationChecker:ERROR", |
David Pursehouse | 13696b8 | 2019-06-16 13:57:45 +0900 | [diff] [blame] | 50 | "-Xep:ImmutableEnumChecker:ERROR", |
David Pursehouse | 245c2c0 | 2019-05-26 18:03:07 +0900 | [diff] [blame] | 51 | "-Xep:IncompatibleModifiers:ERROR", |
| 52 | "-Xep:InjectOnConstructorOfAbstractClass:ERROR", |
| 53 | "-Xep:InputStreamSlowMultibyteRead:ERROR", |
| 54 | "-Xep:IterableAndIterator:ERROR", |
| 55 | "-Xep:JUnit3FloatingPointComparisonWithoutDelta:ERROR", |
| 56 | "-Xep:JUnitAmbiguousTestClass:ERROR", |
| 57 | "-Xep:LiteralClassName:ERROR", |
David Pursehouse | f5d7f93 | 2018-09-29 13:23:22 +0900 | [diff] [blame] | 58 | "-Xep:MissingFail:ERROR", |
David Pursehouse | 245c2c0 | 2019-05-26 18:03:07 +0900 | [diff] [blame] | 59 | "-Xep:MissingOverride:ERROR", |
| 60 | "-Xep:MutableConstantField:ERROR", |
David Pursehouse | 72ae089 | 2019-06-22 18:47:43 +0900 | [diff] [blame] | 61 | "-Xep:NarrowingCompoundAssignment:ERROR", |
David Pursehouse | 245c2c0 | 2019-05-26 18:03:07 +0900 | [diff] [blame] | 62 | "-Xep:NonAtomicVolatileUpdate:ERROR", |
David Pursehouse | 430be89 | 2019-06-16 16:28:02 +0900 | [diff] [blame] | 63 | "-Xep:NonOverridingEquals:ERROR", |
David Pursehouse | 245c2c0 | 2019-05-26 18:03:07 +0900 | [diff] [blame] | 64 | "-Xep:NullableConstructor:ERROR", |
| 65 | "-Xep:NullablePrimitive:ERROR", |
| 66 | "-Xep:NullableVoid:ERROR", |
David Pursehouse | 0f4554f | 2019-06-12 09:06:46 +0900 | [diff] [blame] | 67 | "-Xep:OperatorPrecedence:ERROR", |
David Pursehouse | 245c2c0 | 2019-05-26 18:03:07 +0900 | [diff] [blame] | 68 | "-Xep:OverridesGuiceInjectableMethod:ERROR", |
| 69 | "-Xep:PreconditionsInvalidPlaceholder:ERROR", |
| 70 | "-Xep:ProtoFieldPreconditionsCheckNotNull:ERROR", |
| 71 | "-Xep:ProtocolBufferOrdinal:ERROR", |
| 72 | "-Xep:RequiredModifiers:ERROR", |
David Pursehouse | 4fe4b0a | 2019-06-12 14:23:42 +0900 | [diff] [blame] | 73 | "-Xep:ShortCircuitBoolean:ERROR", |
David Pursehouse | 245c2c0 | 2019-05-26 18:03:07 +0900 | [diff] [blame] | 74 | "-Xep:SimpleDateFormatConstant:ERROR", |
| 75 | "-Xep:StaticGuardedByInstance:ERROR", |
| 76 | "-Xep:SynchronizeOnNonFinalField:ERROR", |
| 77 | "-Xep:TruthConstantAsserts:ERROR", |
| 78 | "-Xep:TypeParameterShadowing:ERROR", |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 79 | "-Xep:TypeParameterUnusedInFormals:WARN", |
David Pursehouse | 245c2c0 | 2019-05-26 18:03:07 +0900 | [diff] [blame] | 80 | "-Xep:URLEqualsHashCode:ERROR", |
David Pursehouse | 4cc1329 | 2020-01-27 09:47:05 +0900 | [diff] [blame] | 81 | "-Xep:UnusedException:ERROR", |
David Pursehouse | 245c2c0 | 2019-05-26 18:03:07 +0900 | [diff] [blame] | 82 | "-Xep:UnsynchronizedOverridesSynchronized:ERROR", |
| 83 | "-Xep:WaitNotInLoop:ERROR", |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 84 | ], |
| 85 | packages = ["error_prone_packages"], |
| 86 | ) |
| 87 | |
| 88 | package_group( |
| 89 | name = "error_prone_packages", |
| 90 | packages = [ |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 91 | "//org.eclipse.jgit.ant.test/...", |
David Pursehouse | 3ec3ca0 | 2018-11-06 13:50:04 +0900 | [diff] [blame] | 92 | "//org.eclipse.jgit.ant/...", |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 93 | "//org.eclipse.jgit.archive/...", |
| 94 | "//org.eclipse.jgit.http.apache/...", |
| 95 | "//org.eclipse.jgit.http.server/...", |
| 96 | "//org.eclipse.jgit.http.test/...", |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 97 | "//org.eclipse.jgit.junit.http/...", |
David Pursehouse | 3ec3ca0 | 2018-11-06 13:50:04 +0900 | [diff] [blame] | 98 | "//org.eclipse.jgit.junit/...", |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 99 | "//org.eclipse.jgit.lfs.server.test/...", |
David Pursehouse | 3ec3ca0 | 2018-11-06 13:50:04 +0900 | [diff] [blame] | 100 | "//org.eclipse.jgit.lfs.server/...", |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 101 | "//org.eclipse.jgit.lfs.test/...", |
David Pursehouse | 3ec3ca0 | 2018-11-06 13:50:04 +0900 | [diff] [blame] | 102 | "//org.eclipse.jgit.lfs/...", |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 103 | "//org.eclipse.jgit.packaging/...", |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 104 | "//org.eclipse.jgit.pgm.test/...", |
David Pursehouse | 3ec3ca0 | 2018-11-06 13:50:04 +0900 | [diff] [blame] | 105 | "//org.eclipse.jgit.pgm/...", |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 106 | "//org.eclipse.jgit.test/...", |
| 107 | "//org.eclipse.jgit.ui/...", |
David Pursehouse | 3ec3ca0 | 2018-11-06 13:50:04 +0900 | [diff] [blame] | 108 | "//org.eclipse.jgit/...", |
David Ostrovsky | 7d89f0a | 2018-08-26 16:14:32 +0200 | [diff] [blame] | 109 | ], |
| 110 | ) |