You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BUILD 4.2KB

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