| David Pursehouse | b98f9c8 | 2018-09-23 12:58:27 +0900 | [diff] [blame] | 1 | load( |
| 2 | "@bazel_tools//tools/jdk:default_java_toolchain.bzl", |
| David Pursehouse | b98f9c8 | 2018-09-23 12:58:27 +0900 | [diff] [blame] | 3 | "default_java_toolchain", |
| 4 | ) |
| David Pursehouse | 9d46aab | 2019-09-09 10:52:21 +0900 | [diff] [blame] | 5 | load("@rules_java//java:defs.bzl", "java_package_configuration") |
| David Pursehouse | b98f9c8 | 2018-09-23 12:58:27 +0900 | [diff] [blame] | 6 | |
| 7 | default_java_toolchain( |
| David Ostrovsky | 2afae06 | 2022-01-08 09:39:06 +0100 | [diff] [blame^] | 8 | name = "error_prone_warnings_toolchain_java11", |
| 9 | source_version = "11", |
| 10 | target_version = "11", |
| David Pursehouse | b98f9c8 | 2018-09-23 12:58:27 +0900 | [diff] [blame] | 11 | package_configuration = [ |
| 12 | ":error_prone", |
| 13 | ], |
| 14 | visibility = ["//visibility:public"], |
| 15 | ) |
| 16 | |
| David Pursehouse | 956bd7d | 2019-05-25 17:07:28 +0900 | [diff] [blame] | 17 | # Error Prone errors enabled by default; see ../.bazelrc for how this is |
| 18 | # enabled. This warnings list is originally based on: |
| David Pursehouse | b98f9c8 | 2018-09-23 12:58:27 +0900 | [diff] [blame] | 19 | # https://github.com/bazelbuild/BUILD_file_generator/blob/master/tools/bazel_defs/java.bzl |
| David Pursehouse | 956bd7d | 2019-05-25 17:07:28 +0900 | [diff] [blame] | 20 | # However, feel free to add any additional errors. Thus far they have all been pretty useful. |
| David Pursehouse | b98f9c8 | 2018-09-23 12:58:27 +0900 | [diff] [blame] | 21 | java_package_configuration( |
| 22 | name = "error_prone", |
| 23 | javacopts = [ |
| 24 | "-XepDisableWarningsInGeneratedCode", |
| David Pursehouse | c0dafc9 | 2019-05-25 17:19:44 +0900 | [diff] [blame] | 25 | "-Xep:AmbiguousMethodReference:ERROR", |
| 26 | "-Xep:BadAnnotationImplementation:ERROR", |
| 27 | "-Xep:BadComparable:ERROR", |
| David Pursehouse | b98f9c8 | 2018-09-23 12:58:27 +0900 | [diff] [blame] | 28 | "-Xep:BoxedPrimitiveConstructor:ERROR", |
| David Pursehouse | c0dafc9 | 2019-05-25 17:19:44 +0900 | [diff] [blame] | 29 | "-Xep:CannotMockFinalClass:ERROR", |
| 30 | "-Xep:ClassCanBeStatic:ERROR", |
| 31 | "-Xep:ClassNewInstance:ERROR", |
| David Pursehouse | d30ae4c | 2019-06-05 15:30:37 +0900 | [diff] [blame] | 32 | "-Xep:DateFormatConstant:ERROR", |
| David Pursehouse | 00e3a29 | 2018-11-08 11:25:00 +0900 | [diff] [blame] | 33 | "-Xep:DefaultCharset:ERROR", |
| David Pursehouse | c0dafc9 | 2019-05-25 17:19:44 +0900 | [diff] [blame] | 34 | "-Xep:DoubleCheckedLocking:ERROR", |
| David Pursehouse | c0dafc9 | 2019-05-25 17:19:44 +0900 | [diff] [blame] | 35 | "-Xep:DoubleCheckedLocking:ERROR", |
| 36 | "-Xep:ElementsCountedInLoop:ERROR", |
| David Pursehouse | 2e9f823 | 2019-06-05 15:18:01 +0900 | [diff] [blame] | 37 | "-Xep:ElementsCountedInLoop:ERROR", |
| David Pursehouse | c0dafc9 | 2019-05-25 17:19:44 +0900 | [diff] [blame] | 38 | "-Xep:EqualsHashCode:ERROR", |
| 39 | "-Xep:EqualsIncompatibleType:ERROR", |
| 40 | "-Xep:ExpectedExceptionChecker:ERROR", |
| 41 | "-Xep:Finally:ERROR", |
| 42 | "-Xep:FloatingPointLiteralPrecision:ERROR", |
| 43 | "-Xep:FragmentInjection:ERROR", |
| 44 | "-Xep:FragmentNotInstantiable:ERROR", |
| 45 | "-Xep:FunctionalInterfaceClash:ERROR", |
| 46 | "-Xep:FutureReturnValueIgnored:ERROR", |
| 47 | "-Xep:GetClassOnEnum:ERROR", |
| David Pursehouse | 5738d52 | 2019-06-05 13:40:18 +0900 | [diff] [blame] | 48 | "-Xep:ImmutableAnnotationChecker:ERROR", |
| David Pursehouse | b98f9c8 | 2018-09-23 12:58:27 +0900 | [diff] [blame] | 49 | "-Xep:ImmutableEnumChecker:WARN", |
| David Pursehouse | c0dafc9 | 2019-05-25 17:19:44 +0900 | [diff] [blame] | 50 | "-Xep:IncompatibleModifiers:ERROR", |
| 51 | "-Xep:InjectOnConstructorOfAbstractClass:ERROR", |
| 52 | "-Xep:InputStreamSlowMultibyteRead:ERROR", |
| 53 | "-Xep:IterableAndIterator:ERROR", |
| 54 | "-Xep:JUnit3FloatingPointComparisonWithoutDelta:ERROR", |
| 55 | "-Xep:JUnitAmbiguousTestClass:ERROR", |
| 56 | "-Xep:LiteralClassName:ERROR", |
| 57 | "-Xep:MissingCasesInEnumSwitch:ERROR", |
| 58 | "-Xep:MissingFail:ERROR", |
| 59 | "-Xep:MissingOverride:ERROR", |
| 60 | "-Xep:MutableConstantField:ERROR", |
| 61 | "-Xep:NarrowingCompoundAssignment:ERROR", |
| 62 | "-Xep:NonAtomicVolatileUpdate:ERROR", |
| 63 | "-Xep:NonOverridingEquals:ERROR", |
| 64 | "-Xep:NullableConstructor:ERROR", |
| 65 | "-Xep:NullablePrimitive:ERROR", |
| 66 | "-Xep:NullableVoid:ERROR", |
| 67 | "-Xep:OperatorPrecedence:ERROR", |
| 68 | "-Xep:OverridesGuiceInjectableMethod:ERROR", |
| 69 | "-Xep:PreconditionsInvalidPlaceholder:ERROR", |
| 70 | "-Xep:ProtoFieldPreconditionsCheckNotNull:ERROR", |
| 71 | "-Xep:ProtocolBufferOrdinal:ERROR", |
| David Pursehouse | 9b844ae | 2019-06-05 13:46:59 +0900 | [diff] [blame] | 72 | "-Xep:ReferenceEquality:ERROR", |
| David Pursehouse | c0dafc9 | 2019-05-25 17:19:44 +0900 | [diff] [blame] | 73 | "-Xep:RequiredModifiers:ERROR", |
| 74 | "-Xep:ShortCircuitBoolean:ERROR", |
| 75 | "-Xep:SimpleDateFormatConstant:ERROR", |
| 76 | "-Xep:StaticGuardedByInstance:ERROR", |
| 77 | "-Xep:StringEquality:ERROR", |
| 78 | "-Xep:SynchronizeOnNonFinalField:ERROR", |
| 79 | "-Xep:TruthConstantAsserts:ERROR", |
| 80 | "-Xep:TypeParameterShadowing:ERROR", |
| 81 | "-Xep:TypeParameterUnusedInFormals:ERROR", |
| 82 | "-Xep:URLEqualsHashCode:ERROR", |
| 83 | "-Xep:UnsynchronizedOverridesSynchronized:ERROR", |
| David Ostrovsky | 1ae7c38 | 2020-01-24 08:17:24 +0100 | [diff] [blame] | 84 | "-Xep:UnusedException:ERROR", |
| David Pursehouse | c0dafc9 | 2019-05-25 17:19:44 +0900 | [diff] [blame] | 85 | "-Xep:WaitNotInLoop:ERROR", |
| 86 | "-Xep:WildcardImport:ERROR", |
| David Pursehouse | b98f9c8 | 2018-09-23 12:58:27 +0900 | [diff] [blame] | 87 | ], |
| 88 | packages = ["error_prone_packages"], |
| 89 | ) |
| 90 | |
| 91 | package_group( |
| 92 | name = "error_prone_packages", |
| 93 | packages = [ |
| 94 | "//java/...", |
| 95 | "//javatests/...", |
| 96 | ], |
| 97 | ) |