| 1 |
load( |
| 2 |
"@bazel_tools//tools/jdk:default_java_toolchain.bzl", |
| 3 |
"default_java_toolchain", |
| 4 |
) |
| 5 |
load("@rules_java//java:defs.bzl", "java_package_configuration") |
| 6 |
|
| 7 |
default_java_toolchain( |
| 8 |
name = "error_prone_warnings_toolchain_java11", |
| 9 |
package_configuration = [ |
| 10 |
":error_prone", |
| 11 |
], |
| 12 |
source_version = "11", |
| 13 |
target_version = "11", |
| 14 |
visibility = ["//visibility:public"], |
| 15 |
) |
| 16 |
|
| 17 |
default_java_toolchain( |
| 18 |
name = "error_prone_warnings_toolchain_java17", |
| 19 |
configuration = dict(), |
| 20 |
java_runtime = "@bazel_tools//tools/jdk:remotejdk_17", |
| 21 |
package_configuration = [ |
| 22 |
":error_prone", |
| 23 |
], |
| 24 |
source_version = "17", |
| 25 |
target_version = "17", |
| 26 |
visibility = ["//visibility:public"], |
| 27 |
) |
| 28 |
|
| 29 |
# Error Prone errors enabled by default; see ../.bazelrc for how this is |
| 30 |
# enabled. This warnings list is originally based on: |
| 31 |
# https://github.com/bazelbuild/BUILD_file_generator/blob/master/tools/bazel_defs/java.bzl |
| 32 |
# However, feel free to add any additional errors. Thus far they have all been pretty useful. |
| 33 |
java_package_configuration( |
| 34 |
name = "error_prone", |
| 35 |
javacopts = [ |
| 36 |
"-XepDisableWarningsInGeneratedCode", |
| 37 |
"-Xep:MissingCasesInEnumSwitch:ERROR", |
| 38 |
"-Xep:ReferenceEquality:WARN", |
| 39 |
"-Xep:StringEquality:WARN", |
| 40 |
"-Xep:WildcardImport:ERROR", |
| 41 |
"-Xep:AmbiguousMethodReference:ERROR", |
| 42 |
"-Xep:BadAnnotationImplementation:ERROR", |
| 43 |
"-Xep:BadComparable:WARN", |
| 44 |
"-Xep:BoxedPrimitiveConstructor:ERROR", |
| 45 |
"-Xep:CannotMockFinalClass:ERROR", |
| 46 |
"-Xep:ClassCanBeStatic:ERROR", |
| 47 |
"-Xep:ClassNewInstance:ERROR", |
| 48 |
"-Xep:DefaultCharset:WARN", |
| 49 |
"-Xep:DoubleCheckedLocking:ERROR", |
| 50 |
"-Xep:ElementsCountedInLoop:ERROR", |
| 51 |
"-Xep:EqualsHashCode:ERROR", |
| 52 |
"-Xep:EqualsIncompatibleType:ERROR", |
| 53 |
"-Xep:Finally:WARN", |
| 54 |
"-Xep:FloatingPointLiteralPrecision:ERROR", |
| 55 |
"-Xep:FragmentInjection:ERROR", |
| 56 |
"-Xep:FragmentNotInstantiable:ERROR", |
| 57 |
"-Xep:FunctionalInterfaceClash:ERROR", |
| 58 |
"-Xep:FutureReturnValueIgnored:WARN", |
| 59 |
"-Xep:GetClassOnEnum:ERROR", |
| 60 |
"-Xep:ImmutableAnnotationChecker:ERROR", |
| 61 |
"-Xep:ImmutableEnumChecker:ERROR", |
| 62 |
"-Xep:IncompatibleModifiers:ERROR", |
| 63 |
"-Xep:InjectOnConstructorOfAbstractClass:ERROR", |
| 64 |
"-Xep:InputStreamSlowMultibyteRead:ERROR", |
| 65 |
"-Xep:IterableAndIterator:ERROR", |
| 66 |
"-Xep:JUnit3FloatingPointComparisonWithoutDelta:ERROR", |
| 67 |
"-Xep:JUnitAmbiguousTestClass:ERROR", |
| 68 |
"-Xep:LiteralClassName:ERROR", |
| 69 |
"-Xep:MissingFail:ERROR", |
| 70 |
"-Xep:MissingOverride:ERROR", |
| 71 |
"-Xep:MutableConstantField:WARN", |
| 72 |
"-Xep:NarrowingCompoundAssignment:ERROR", |
| 73 |
"-Xep:NonAtomicVolatileUpdate:ERROR", |
| 74 |
"-Xep:NonOverridingEquals:ERROR", |
| 75 |
"-Xep:NullableConstructor:ERROR", |
| 76 |
"-Xep:NullablePrimitive:ERROR", |
| 77 |
"-Xep:NullableVoid:ERROR", |
| 78 |
"-Xep:OperatorPrecedence:ERROR", |
| 79 |
"-Xep:OverridesGuiceInjectableMethod:ERROR", |
| 80 |
"-Xep:PreconditionsInvalidPlaceholder:ERROR", |
| 81 |
"-Xep:ProtoFieldPreconditionsCheckNotNull:ERROR", |
| 82 |
"-Xep:ProtocolBufferOrdinal:ERROR", |
| 83 |
"-Xep:RequiredModifiers:ERROR", |
| 84 |
"-Xep:ShortCircuitBoolean:ERROR", |
| 85 |
"-Xep:SimpleDateFormatConstant:ERROR", |
| 86 |
"-Xep:StaticGuardedByInstance:ERROR", |
| 87 |
"-Xep:SynchronizeOnNonFinalField:ERROR", |
| 88 |
"-Xep:TruthConstantAsserts:ERROR", |
| 89 |
"-Xep:TypeParameterShadowing:ERROR", |
| 90 |
"-Xep:TypeParameterUnusedInFormals:WARN", |
| 91 |
"-Xep:URLEqualsHashCode:ERROR", |
| 92 |
"-Xep:UnusedException:WARN", |
| 93 |
"-Xep:UnsynchronizedOverridesSynchronized:ERROR", |
| 94 |
"-Xep:WaitNotInLoop:ERROR", |
| 95 |
], |
| 96 |
packages = ["error_prone_packages"], |
| 97 |
) |
| 98 |
|
| 99 |
package_group( |
| 100 |
name = "error_prone_packages", |
| 101 |
packages = [ |
| 102 |
"//org.eclipse.jgit.ant.test/...", |
| 103 |
"//org.eclipse.jgit.ant/...", |
| 104 |
"//org.eclipse.jgit.archive/...", |
| 105 |
"//org.eclipse.jgit.gpg.bc.test/...", |
| 106 |
"//org.eclipse.jgit.gpg.bc/...", |
| 107 |
"//org.eclipse.jgit.http.apache/...", |
| 108 |
"//org.eclipse.jgit.http.server/...", |
| 109 |
"//org.eclipse.jgit.http.test/...", |
| 110 |
"//org.eclipse.jgit.junit.ssh/...", |
| 111 |
"//org.eclipse.jgit.junit/...", |
| 112 |
"//org.eclipse.jgit.junit/http/...", |
| 113 |
"//org.eclipse.jgit.lfs.server.test/...", |
| 114 |
"//org.eclipse.jgit.lfs.server/...", |
| 115 |
"//org.eclipse.jgit.lfs.test/...", |
| 116 |
"//org.eclipse.jgit.lfs/...", |
| 117 |
"//org.eclipse.jgit.pgm.test/...", |
| 118 |
"//org.eclipse.jgit.pgm/...", |
| 119 |
"//org.eclipse.jgit.ssh.apache.agent/...", |
| 120 |
"//org.eclipse.jgit.ssh.apache.test/...", |
| 121 |
"//org.eclipse.jgit.ssh.apache/...", |
| 122 |
"//org.eclipse.jgit.ssh.jsch.test/...", |
| 123 |
"//org.eclipse.jgit.ssh.jsch/...", |
| 124 |
"//org.eclipse.jgit.test/...", |
| 125 |
"//org.eclipse.jgit.ui/...", |
| 126 |
"//org.eclipse.jgit/...", |
| 127 |
], |
| 128 |
) |