Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to v2.27.0 #86

Merged
merged 151 commits into from
Apr 29, 2024
Merged

Upgrade to v2.27.0 #86

merged 151 commits into from
Apr 29, 2024

Commits on Oct 19, 2023

  1. Add parens to avoid generating !this == obj.

    Obviously we could do even better by generating `this != obj`. But in practice, all the code that contains this check is buggy and needs to be more substantially rewritten. So our goal here is just to avoid generating invalid Java.
    
    (credit to emcmanus@ for catching this bug)
    
    PiperOrigin-RevId: 574798017
    cpovirk authored and Error Prone Team committed Oct 19, 2023
    Configuration menu
    Copy the full SHA
    31cc82f View commit details
    Browse the repository at this point in the history
  2. Improve OperatorPrecedence docs

    google#4153
    
    PiperOrigin-RevId: 574883084
    cushon authored and Error Prone Team committed Oct 19, 2023
    Configuration menu
    Copy the full SHA
    1b41065 View commit details
    Browse the repository at this point in the history
  3. Extend SuperEqualsIsObjectEquals to cover hashCode, renaming it t…

    …o "`SuperCallToObjectMethod`."
    
    ...as suggested by @Marcono1234 in google#4147 (comment).
    
    Also, add docs.
    
    PiperOrigin-RevId: 574898389
    cpovirk authored and Error Prone Team committed Oct 19, 2023
    Configuration menu
    Copy the full SHA
    fb06f25 View commit details
    Browse the repository at this point in the history
  4. Fix typos.

    (pointed out [by @Stephan202](google#4155 (comment)))
    
    PiperOrigin-RevId: 575004527
    cpovirk authored and Error Prone Team committed Oct 19, 2023
    Configuration menu
    Copy the full SHA
    747227a View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2023

  1. JUnit4TestNotRun: add a heuristic that if the name contains underscor…

    …es, it's surely a test.
    
    Or a style violation, of course.
    
    PiperOrigin-RevId: 576120741
    graememorgan authored and Error Prone Team committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    661a915 View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2023

  1. Update Checker Framework dataflow and dependencies

    I'm taking over from copybara and merging this into one CL, since there were
    some breaking changes.
    
    PiperOrigin-RevId: 576589485
    cushon authored and Error Prone Team committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    c57fd56 View commit details
    Browse the repository at this point in the history

Commits on Oct 26, 2023

  1. Add more Guava types to ModifiedButNotUsed.

    PiperOrigin-RevId: 576849175
    graememorgan authored and Error Prone Team committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    bc4b01b View commit details
    Browse the repository at this point in the history
  2. Drop the period from the MemberName diagnostic, given we're concatena…

    …ting something onto it in some paths.
    
    PiperOrigin-RevId: 576864540
    graememorgan authored and Error Prone Team committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    5152f11 View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2023

  1. Typo fixed in ClosingStandardOutputStreams.md

    **A typo has been fixed.**
    
    Fixes google#4166
    
    COPYBARA_INTEGRATE_REVIEW=google#4166 from khalid586:master 010e48a
    PiperOrigin-RevId: 577858113
    khalid586 authored and Error Prone Team committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    1991070 View commit details
    Browse the repository at this point in the history

Commits on Nov 1, 2023

  1. PUBLIC: Add a test demonstrating b/308614050 (bug with parameter cast…

    …ing).
    
    PiperOrigin-RevId: 578507433
    kluever authored and Error Prone Team committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    a63bf9f View commit details
    Browse the repository at this point in the history

Commits on Nov 2, 2023

  1. UnnecessaryBoxedAssignment: avoid CCE on method reference

    Fixes google#4157
    
    COPYBARA_INTEGRATE_REVIEW=google#4157 from PicnicSupermarket:sschroevers/avoid-CCE-in-UnnecessaryBoxedAssignment 73dc358
    PiperOrigin-RevId: 578808258
    Stephan202 authored and Error Prone Team committed Nov 2, 2023
    Configuration menu
    Copy the full SHA
    bd43f40 View commit details
    Browse the repository at this point in the history
  2. ASTHelpersSuggestions: don't suggest ASTHelpers inside ASTHelpers

    PiperOrigin-RevId: 578989135
    cushon authored and Error Prone Team committed Nov 2, 2023
    Configuration menu
    Copy the full SHA
    c83ba54 View commit details
    Browse the repository at this point in the history

Commits on Nov 3, 2023

  1. Include some more attractive-nuisance runners in TestParametersNotIni…

    …tialized.
    
    We can't only include TestParameterInjector, because other frameworks are adopting its annotation for injecting parameters. But these are other parameterising frameworks you _might_ guess would work with @TestParameter, but don't.
    
    PiperOrigin-RevId: 579143309
    graememorgan authored and Error Prone Team committed Nov 3, 2023
    Configuration menu
    Copy the full SHA
    09a9aa6 View commit details
    Browse the repository at this point in the history
  2. Update NullnessAnnotations API to use annotation mirrors and trees …

    …instead of strings
    
    PiperOrigin-RevId: 579319948
    cushon authored and Error Prone Team committed Nov 3, 2023
    Configuration menu
    Copy the full SHA
    99bfc0b View commit details
    Browse the repository at this point in the history

Commits on Nov 4, 2023

  1. Handle annotations on inner types in `MoreAnnotations.getDeclarationA…

    …ndTypeAttributes`
    
    PiperOrigin-RevId: 579345191
    cushon authored and Error Prone Team committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    5123cd5 View commit details
    Browse the repository at this point in the history

Commits on Nov 6, 2023

  1. No-op tidying of TruthSelfEquals before I start altering it.

    PiperOrigin-RevId: 579780936
    graememorgan authored and Error Prone Team committed Nov 6, 2023
    Configuration menu
    Copy the full SHA
    93770e3 View commit details
    Browse the repository at this point in the history

Commits on Nov 7, 2023

  1. Remove an unnecessary suppression

    Follow-up to google@c83ba54
    
    PiperOrigin-RevId: 580124237
    cushon authored and Error Prone Team committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    af227ac View commit details
    Browse the repository at this point in the history
  2. Improve AnnotationPosition diagnostics to only mention the annotation…

    …s that are being moved
    
    PiperOrigin-RevId: 580185539
    cushon authored and Error Prone Team committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    0149a77 View commit details
    Browse the repository at this point in the history
  3. Discourage all nullness annotations in NullablePrimitive and `Nulla…

    …blePrimitiveArray`, not just `@Nullable`
    
    PiperOrigin-RevId: 580206745
    cushon authored and Error Prone Team committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    18d5cdf View commit details
    Browse the repository at this point in the history
  4. Use SuppressibleTreePathScanner instead of rolling our own.

    This is already covered by tests, such as `negativeCases_suppressionForMethodTreeBased()`.
    
    (`SuppressibleTreePathScanner` might actually correct some edge cases somewhere, even.)
    
    PiperOrigin-RevId: 580260707
    cpovirk authored and Error Prone Team committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    46122d1 View commit details
    Browse the repository at this point in the history
  5. Discourage nullness annotations on wildcards and type parameters them…

    …selves
    
    PiperOrigin-RevId: 580288274
    cushon authored and Error Prone Team committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    29f4602 View commit details
    Browse the repository at this point in the history
  6. Discourage multiple nullness annotations

    PiperOrigin-RevId: 580315454
    cushon authored and Error Prone Team committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    dfba048 View commit details
    Browse the repository at this point in the history

Commits on Nov 8, 2023

  1. Loosen the restrictions in TruthSelfEquals to allow anything called `…

    …assertThat`, not just the Truth ones.
    
    That way, we catch `ProtoTruth` too.
    
    PiperOrigin-RevId: 580504931
    graememorgan authored and Error Prone Team committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    962f5d1 View commit details
    Browse the repository at this point in the history
  2. Handle containsExactlyElementsIn, etc in TruthSelfEquals.

    Flume: unknown commit
    PiperOrigin-RevId: 580526558
    graememorgan authored and Error Prone Team committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    6eaf51d View commit details
    Browse the repository at this point in the history
  3. Fix BugChecker.isSuppressed to actually look only at the current tree.

    And warn about a similar pitfall in the already deprecated `ASTHelpers.getAnnotation`.
    
    And add some tests, which show that we already had this right for `SuppressibleTreePathScanner` and for the automatic `BugChecker` behavior (from unknown commit), just not for manual `isSuppressed` calls.
    
    Add a couple TODOs about:
    - the kinds of trees on which suppressions are valid
    - whether the non-deprecated `BugChecker.isSuppressed(Symbol, VisitorState)` might be a footgun.
    
    Compare:
    - https://github.com/google/error-prone/blob/18d5cdf10ec1cc798a588d5c48a9e02a8888c6a1/check_api/src/main/java/com/google/errorprone/scanner/Scanner.java#L91
    - https://github.com/google/error-prone/blob/18d5cdf10ec1cc798a588d5c48a9e02a8888c6a1/core/src/main/java/com/google/errorprone/refaster/RefasterSuppressionHelper.java#L43
    PiperOrigin-RevId: 580619965
    cpovirk authored and Error Prone Team committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    5ce8792 View commit details
    Browse the repository at this point in the history

Commits on Nov 9, 2023

  1. Move the AlmostJavadoc finding to point at the Javadoc.

    PiperOrigin-RevId: 580878430
    graememorgan authored and Error Prone Team committed Nov 9, 2023
    Configuration menu
    Copy the full SHA
    492b882 View commit details
    Browse the repository at this point in the history

Commits on Nov 10, 2023

  1. Prefer the Immutable graph types over the interfaces.

    PiperOrigin-RevId: 581190037
    graememorgan authored and Error Prone Team committed Nov 10, 2023
    Configuration menu
    Copy the full SHA
    5854742 View commit details
    Browse the repository at this point in the history
  2. Complain about @param foo: blah.

    The colon winds up appearing in the generated docs in the summary.
    
    PiperOrigin-RevId: 581238725
    graememorgan authored and Error Prone Team committed Nov 10, 2023
    Configuration menu
    Copy the full SHA
    58aa646 View commit details
    Browse the repository at this point in the history

Commits on Nov 13, 2023

  1. Introduce ConstantExpressions to TruthSelfEquals, which lets us catch…

    … stuff like
    
    `assertThat(fooProto.getField()).isEqualTo(fooProto.getField());`
    
    But avoids massively over-matching on expressions which _aren't_ known to be pure.
    
    Flume: unknown commit
    PiperOrigin-RevId: 581934324
    graememorgan authored and Error Prone Team committed Nov 13, 2023
    Configuration menu
    Copy the full SHA
    67b339b View commit details
    Browse the repository at this point in the history

Commits on Nov 14, 2023

  1. Correct my claims about Kotlin's handling of annotations on wildcards.

    I did some testing and some digging in the Kotlin issue tracker ([1](https://youtrack.jetbrains.com/issue/KT-40498/Nullability-annotations-on-Java-wildcard-itself), [2](https://youtrack.jetbrains.com/issue/KT-53836/In-type-parameter-declarations-recognize-JSpecify-annotations-only-on-bounds#focus=Comments-27-6427080.0-0)), and everything I found suggests that Kotlin ignores annotations on wildcards entirely.
    
    This actually provides an even better case for the NullableWildcard check.
    
    PiperOrigin-RevId: 582331851
    cpovirk authored and Error Prone Team committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    5c5d9ab View commit details
    Browse the repository at this point in the history

Commits on Nov 16, 2023

  1. Remove the EqualsTester fix from TruthSelfEquals.

    I think the suggestion to use EqualsTester is great (so belongs in a description), but the fix is almost always bad, for two reasons:
    
      1)  It's often just _wrong_; lots of these are bugs, not equals testing
      2)  Even when it's right, it's very incomplete. You'd want to factor some of the unequal cases into equality groups and go from there.
    
    PiperOrigin-RevId: 583047109
    graememorgan authored and Error Prone Team committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    0b70afc View commit details
    Browse the repository at this point in the history
  2. Update ASTHelpers.hasDirectAnnotationWithSimpleName to handle `TYPE…

    …_USE` annotations on field types and method return types
    
    This allows `ProvidesNull` to handle `TYPE_USE` `@Nullable` annotations.
    
    Startblock:
      unknown commit is submitted
    PiperOrigin-RevId: 583055698
    cushon authored and Error Prone Team committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    aa6e3e7 View commit details
    Browse the repository at this point in the history

Commits on Nov 17, 2023

  1. Remove stray parens.

    - https://errorprone.info/bugpattern/NullableWildcard
    - https://errorprone.info/bugpattern/NullableTypeParameter
    - https://errorprone.info/bugpattern/ExtendsObject (The actual parenthetical in the title is fine; the problem is under "The problem.')
    
    PiperOrigin-RevId: 583397840
    cpovirk authored and Error Prone Team committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    7684e85 View commit details
    Browse the repository at this point in the history

Commits on Nov 20, 2023

  1. Remove the underscore heuristic flag.

    PiperOrigin-RevId: 583995107
    graememorgan authored and Error Prone Team committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    b0b0b67 View commit details
    Browse the repository at this point in the history
  2. TruthSelfEquals: handle junit assertions

    PiperOrigin-RevId: 584063431
    graememorgan authored and Error Prone Team committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    6a23848 View commit details
    Browse the repository at this point in the history

Commits on Nov 21, 2023

  1. UnusedVariable: flag parameters in _effectively_ private methods, not…

    … just private methods.
    
    PiperOrigin-RevId: 584277317
    graememorgan authored and Error Prone Team committed Nov 21, 2023
    Configuration menu
    Copy the full SHA
    88a224c View commit details
    Browse the repository at this point in the history

Commits on Nov 23, 2023

  1. Rip out the ThreadSafeChecker:CheckElementUsage flag.

    Which is now enabled.
    
    PiperOrigin-RevId: 584850701
    graememorgan authored and Error Prone Team committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    83d2ed5 View commit details
    Browse the repository at this point in the history

Commits on Nov 24, 2023

  1. Don't peer at the identifiers on the LHS of assignments in AlreadyChe…

    …cked.
    
    You need really weird circumstances to trigger this. Note the `if (false)` in the test, which renders `a` effectively final despite it having an assignment.
    
    PiperOrigin-RevId: 585087842
    graememorgan authored and Error Prone Team committed Nov 24, 2023
    Configuration menu
    Copy the full SHA
    5395af4 View commit details
    Browse the repository at this point in the history

Commits on Nov 27, 2023

  1. Update dataflow version

    PiperOrigin-RevId: 585729692
    cushon authored and Error Prone Team committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    7acf133 View commit details
    Browse the repository at this point in the history

Commits on Dec 4, 2023

  1. Check specific functional interface types (which would otherwise be u…

    …nchecked) for parameter usage.
    
    PiperOrigin-RevId: 587714550
    graememorgan authored and Error Prone Team committed Dec 4, 2023
    Configuration menu
    Copy the full SHA
    4be12bc View commit details
    Browse the repository at this point in the history

Commits on Dec 5, 2023

  1. Fix a typo in the "Finally" bugpattern docs.

    PiperOrigin-RevId: 587898768
    java-team-github-bot authored and Error Prone Team committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    e5df30c View commit details
    Browse the repository at this point in the history

Commits on Dec 7, 2023

  1. Import eisop/checker-framework from GitHub.

    #MIGRATION_3P_JAVA_SRC_CHECKER_FRAMEWORK_DATAFLOW__DEFAULT_SERVICE
    
      - c9b1e103fbe5ea1a3fc5d8e52a16c9982ed0bc76 Prep for next release by Werner Dietl <wdietl@gmail.com>
      - 4f53c5bf42e357682104fd3cbf4878457d1d0e0d Extract version variable and update version (google#630) by Werner Dietl <wdietl@gmail.com>
      - 3c4dad383006e706dc102d4d835298e1e1e12114 Do not use `thisValue` when it is the NullType (google#636) by Werner Dietl <wdietl@gmail.com>
      - d7f9dabf1240e40484ce2b3c1c6e9feecaabe29c Generalize improvement of initialization type frames (google#642) by Florian Lanzinger <lanzinger@kit.edu>
      - a7b753565fe9843d5e5f1ade6564bab68fa266e9 Update dependency commons-io:commons-io to v2.15.1 (google#643) by renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
      - 3ed0c114c3d686eadc803207640487e86d1d086e Update dependency gradle to v8.5 (google#644) by renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
      - 5c59bff87210b78a7fc7f8cd7b7372d2d7e60981 Update dependency com.amazonaws:aws-java-sdk-bom to v1.12... by renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
      - 2170fdab53832a3b9016f200a78189c76298f87e Update dependency com.diffplug.spotless:spotless-plugin-g... by renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
      - 8eb212555daec5323fd1f1af786092cbbbeef8a0 Update dependency io.github.classgraph:classgraph to v4.8... by renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
      - 4c08ea3751b40620d20eb05ca85ead9a42f500f9 Update dependency org.checkerframework:stubparser to v3.2... by renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
      - 2dee1c3763640e4bec88bc0b8a11a9f6bad1a5ea Warn about redundant null cases in switch statements and ... by Aosen Xiong <82676488+Ao-senXiong@users.noreply.github.com>
      - 780fef9e0225761ba44000091a2f024a6ffbdecb typetools/checker-framework 3.41.0 release (google#650) by Werner Dietl <wdietl@gmail.com>
      - 9c804e41ed0f506713ac50224d2a63f2d2568dc2 Consistently spell it `JUnit` by Werner Dietl <wdietl@gmail.com>
      - 9ad831a2432ad5cbf6bb1a99dff4121f4a6dc4e3 Add missing import to stub file by Werner Dietl <wdietl@gmail.com>
      - 28f6b0fc670596c5943ca93e01b480429ef0a907 Remove warnings about junit-assertions.astub that do not ... by Werner Dietl <wdietl@gmail.com>
      - a4c50adad5e36bc746cfabddba41b5f661da54d5 Formatting tweak by Werner Dietl <wdietl@gmail.com>
      - 66bb90d7431427ed39f67d7a9899f93d430220c1 Make error keys consistent by Werner Dietl <wdietl@gmail.com>
      - 6be13eba81909bedc263c6b1a9d4c3583af556b7 Simplify code, suppress Optional Checker FP, code consist... by Werner Dietl <wdietl@gmail.com>
      - 011fbb759104d1277700a9e7893f435af00a5f90 Code comment formatting by Werner Dietl <wdietl@gmail.com>
      - 5b60183f3d3934dcb205adfb77c729399687c9bc Fix formatting by Werner Dietl <wdietl@gmail.com>
      - 13f7887e1941d0b6b18a9a9c85088e42fbb56c13 Fix error keys and warning texts by Werner Dietl <wdietl@gmail.com>
      - 084ca4b52ab4d067a93ae32ea04c892ec36bf72a Fix terminology and use EISOP website by Werner Dietl <wdietl@gmail.com>
      - f62005ea47ffe9bae7561d51ed9a0a2bed4f89c0 Skip try-with-resources test on Java 8 by Werner Dietl <wdietl@gmail.com>
      - 97af13821ff7ed86c6b5f3740799a28d2a054608 Add a note by Werner Dietl <wdietl@gmail.com>
      - c2df6d6cc48878b92970c568e5388ddafa60b60f Prep for release by Werner Dietl <wdietl@gmail.com>
      - c08538fbc8e167a931cbe405614b52663a8e67be new release 3.41.0-eisop1 by Werner Dietl <wdietl@gmail.com>
    
    PiperOrigin-RevId: 588812139
    cushon authored and Error Prone Team committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    336323a View commit details
    Browse the repository at this point in the history

Commits on Dec 8, 2023

  1. AutoValueFinalMethods: support method-level suppression.

    And streamify the implementation a bit.
    
    PiperOrigin-RevId: 589088083
    graememorgan authored and Error Prone Team committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    ac52ca9 View commit details
    Browse the repository at this point in the history
  2. WellKnownThreadSafety: Add common PKIX types to known thread-safe list.

    PiperOrigin-RevId: 589128835
    java-team-github-bot authored and Error Prone Team committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    aadfdc3 View commit details
    Browse the repository at this point in the history

Commits on Dec 14, 2023

  1. Don't report NonFinalStaticField findings for fields modified in `@Be…

    …foreClass` methods
    
    PiperOrigin-RevId: 590890283
    cushon authored and Error Prone Team committed Dec 14, 2023
    Configuration menu
    Copy the full SHA
    d78dd6d View commit details
    Browse the repository at this point in the history
  2. Do not flag unused parameters on _abstract_ methods.

    I think this was introduced in google@88a224c, where we suddenly start considering some _effectively_ private abstract methods.
    
    PiperOrigin-RevId: 590895990
    graememorgan authored and Error Prone Team committed Dec 14, 2023
    Configuration menu
    Copy the full SHA
    affa37a View commit details
    Browse the repository at this point in the history
  3. Descend into VariableTrees when looking for variables to check.

    I think this `return null`'d on the assumption that a `VariableTree` can't contain more variables to check... but of course it can, with anonymous classes etc.
    
    PiperOrigin-RevId: 590929955
    graememorgan authored and Error Prone Team committed Dec 14, 2023
    Configuration menu
    Copy the full SHA
    da7be27 View commit details
    Browse the repository at this point in the history

Commits on Dec 15, 2023

  1. Handle Joiner.on(...) in AbstractToString.

    Not yet handling the Iterable overload; that's a bit more involved given the lack of prior art.
    
    PiperOrigin-RevId: 591205788
    graememorgan authored and Error Prone Team committed Dec 15, 2023
    Configuration menu
    Copy the full SHA
    654d1db View commit details
    Browse the repository at this point in the history
  2. Automated rollback of commit 654d1db.

    *** Reason for rollback ***
    
    That did not handle varargs well: specifically array arguments in a varargs position.
    
    I'll fix and roll forward.
    
    *** Original change description ***
    
    Handle Joiner.on(...) in AbstractToString.
    
    Not yet handling the Iterable overload; that's a bit more involved given the lack of prior art.
    
    ***
    
    PiperOrigin-RevId: 591308763
    graememorgan authored and Error Prone Team committed Dec 15, 2023
    Configuration menu
    Copy the full SHA
    d272dfa View commit details
    Browse the repository at this point in the history

Commits on Dec 18, 2023

  1. Document that javadoc shouldn't appear between annotations and the do…

    …cumented element
    
    PiperOrigin-RevId: 591893421
    cushon authored and Error Prone Team committed Dec 18, 2023
    Configuration menu
    Copy the full SHA
    21c190a View commit details
    Browse the repository at this point in the history

Commits on Dec 28, 2023

  1. Actually test that hasExtraParameterForEnclosingInstance works.

    It does, but I got confused in google#4225.
    
    PiperOrigin-RevId: 594123682
    cpovirk authored and Error Prone Team committed Dec 28, 2023
    Configuration menu
    Copy the full SHA
    5fa727a View commit details
    Browse the repository at this point in the history

Commits on Dec 29, 2023

  1. Update CanIgnoreReturnValueSuggester summary.

    PiperOrigin-RevId: 594339474
    kluever authored and Error Prone Team committed Dec 29, 2023
    Configuration menu
    Copy the full SHA
    63cf192 View commit details
    Browse the repository at this point in the history

Commits on Jan 2, 2024

  1. Reflow a comment that didn't appreciate being formatted in unknown co…

    …mmit
    
    PiperOrigin-RevId: 595108607
    graememorgan authored and Error Prone Team committed Jan 2, 2024
    Configuration menu
    Copy the full SHA
    fd21bc9 View commit details
    Browse the repository at this point in the history

Commits on Jan 3, 2024

  1. Update a few checks (and a class of tests, with AbstractToString) to …

    …handle #formatted.
    
    There are some ERROR-level checks under AbstractToString, but I think #formatted can't be used in the depot yet?
    
    PiperOrigin-RevId: 595389167
    graememorgan authored and Error Prone Team committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    58a9e80 View commit details
    Browse the repository at this point in the history
  2. Add an assertion to try to help debug google#4225

    PiperOrigin-RevId: 595414757
    cushon authored and Error Prone Team committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    2bd7859 View commit details
    Browse the repository at this point in the history
  3. Add a tests for Dagger Component.Builders and `Subcomponent.Builder…

    …`s to `CanIgnoreReturnValueSuggesterTest`.
    
    #checkreturnvalue
    
    PiperOrigin-RevId: 595426409
    kluever authored and Error Prone Team committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    4ef5e53 View commit details
    Browse the repository at this point in the history
  4. Don't fire CanIgnoreReturnValueSuggester on Dagger `@Component.Buil…

    …der` or `@Subcomponent.Builder` methods (they will soon be treated as implicitly ignorable via a custom rule).
    
    #checkreturnvalue
    
    PiperOrigin-RevId: 595454660
    kluever authored and Error Prone Team committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    25b8dc2 View commit details
    Browse the repository at this point in the history
  5. Treat Dagger @Component.Builder and @Subcomponent.Builder setter …

    …methods as ignorable.
    
    #checkreturnvalue
    
    PiperOrigin-RevId: 595505398
    kluever authored and Error Prone Team committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    cb1dc06 View commit details
    Browse the repository at this point in the history

Commits on Jan 4, 2024

  1. Improve fixes for StatementSwitchToExpressionSwitch

    If a case contains a single block statement, skip past the braces of the block statement.
    
    Enables fixes like:
    
    ```
          case 0 -> System.out.println("0");
    ```
    
    Instead of:
    
    ```
          case 0 -> {
            {
              System.out.println("0");
              break;
            }
          }
    ```
    
    Fixes google#4222
    
    PiperOrigin-RevId: 595703319
    cushon authored and Error Prone Team committed Jan 4, 2024
    Configuration menu
    Copy the full SHA
    d7de122 View commit details
    Browse the repository at this point in the history
  2. Deprecate withSignature

    PiperOrigin-RevId: 595809096
    cushon authored and Error Prone Team committed Jan 4, 2024
    Configuration menu
    Copy the full SHA
    34141a8 View commit details
    Browse the repository at this point in the history

Commits on Jan 5, 2024

  1. Update dagger version

    Fixes google#4242
    
    PiperOrigin-RevId: 595991339
    cushon authored and Error Prone Team committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    db3e9ad View commit details
    Browse the repository at this point in the history
  2. Bump deps.

    Prompted by google#4242
    
    (`mvn org.codehaus.mojo:versions-maven-plugin:2.16.2:{update-properties,use-latest-releases} -DgenerateBackupPoms=false -f third_party/java_src/error_prone/project/pom.xml -Dexcludes=org.hamcrest:hamcrest-core,org.hamcrest:hamcrest-library,com.google.inject.extensions:guice-assistedinject,com.google.inject.extensions:guice-servlet,com.google.inject.extensions:guice-testlib`. Without the exclusions, I got test errors. The Hamcrest ones might be related to API changes? The Guice ones might be related to getting out of sync with `guice.version`, which the `mvn` command does not update?)
    
    PiperOrigin-RevId: 596010863
    cpovirk authored and Error Prone Team committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    654b1d9 View commit details
    Browse the repository at this point in the history

Commits on Jan 8, 2024

  1. Introduce JUnitIncompatibleType, a JUnit analogue of TruthIncompatibl…

    …eType
    
    PiperOrigin-RevId: 596602361
    graememorgan authored and Error Prone Team committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    43e3bd1 View commit details
    Browse the repository at this point in the history

Commits on Jan 11, 2024

  1. Don't fire CanIgnoreReturnValueSuggester on overrides in anonymous me…

    …thods.
    
    PiperOrigin-RevId: 597548436
    graememorgan authored and Error Prone Team committed Jan 11, 2024
    Configuration menu
    Copy the full SHA
    817b442 View commit details
    Browse the repository at this point in the history
  2. Remove incorrect statement from BugPattern index doc

    google#4248
    
    Fixes google#4249
    
    COPYBARA_INTEGRATE_REVIEW=google#4249 from elkkhan:doc-remove-bugpattern-examples-statement 8c7cf54
    PiperOrigin-RevId: 597571000
    elkkhan authored and Error Prone Team committed Jan 11, 2024
    Configuration menu
    Copy the full SHA
    5a68588 View commit details
    Browse the repository at this point in the history

Commits on Jan 12, 2024

  1. Add support for specifying badEnclosingTypes for BadImport via flags

    Following the discussions in google#2236, this PR introduces the `BadImport:BadEnclosingTypes` flag to disallow nested types of specified enclosing type.
    
    This PR also takes the flag into account in `UnnecessarilyFullyQualified` to suggest importing `EnclosingType.NestedType` when possible.
    
    For instance, when `-XepOpt:BadImport:BadEnclosingTypes=org.immutables.value.Value` is set, it would suggest the following:
    
    ```java
    final class Test {
      @org.immutables.value.Value.Immutable
      abstract class AbstractType {}
    }
    ```
    ->
    ```java
    final class Test {
      @Value.Immutable
      abstract class AbstractType {}
    }
    ```
    
    Also, it won't require suppressing `UnnecessarilyFullyQualified` in the example in google#2236.
    
    ```java
    import org.springframework.beans.factory.annotation.Value;
    
    final class Test {
      Demo(@value("some.property") String property) {}
    
      @org.immutables.value.Value.Immutable
      abstract class AbstractType {}
    }
    ```
    
    Closes google#2236.
    
    Fixes google#4228
    
    COPYBARA_INTEGRATE_REVIEW=google#4228 from hisener:halil.sener/bad-import-bad-enclosing-types 67aa36d
    PiperOrigin-RevId: 597798125
    hisener authored and Error Prone Team committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    bd0ba3f View commit details
    Browse the repository at this point in the history

Commits on Jan 17, 2024

  1. Generalise ProtoRedundantSet to handle autovalues too.

    PiperOrigin-RevId: 599119407
    graememorgan authored and Error Prone Team committed Jan 17, 2024
    Configuration menu
    Copy the full SHA
    2cbed19 View commit details
    Browse the repository at this point in the history

Commits on Jan 22, 2024

  1. Do not report NonFinalStaticField findings for fields modified in `…

    …@BeforeAll` methods
    
    Analogous to google#4215.
    
    Resolves google#4239.
    
    Fixes google#4251
    
    COPYBARA_INTEGRATE_REVIEW=google#4251 from DataDog:halil.sener/4239-non-final-static-field-junit-5-before-all 8a109a8
    PiperOrigin-RevId: 600484897
    hisener authored and Error Prone Team committed Jan 22, 2024
    Configuration menu
    Copy the full SHA
    4165ecd View commit details
    Browse the repository at this point in the history

Commits on Jan 25, 2024

  1. Work around a javac end position bug for empty statements

    See https://bugs.openjdk.org/browse/JDK-8324736
    
    Fixes google#4245
    
    PiperOrigin-RevId: 601554857
    cushon authored and Error Prone Team committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    0be7a89 View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2024

  1. Resolve a couple of lingering @ResultIgnorabilityUnspecified in EP.

    PiperOrigin-RevId: 601751926
    graememorgan authored and Error Prone Team committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    417b935 View commit details
    Browse the repository at this point in the history
  2. Fix a crash in UnnecessaryStringBuilder

    Fixes external google#4195
    
    PiperOrigin-RevId: 601777043
    graememorgan authored and Error Prone Team committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    7d1ae83 View commit details
    Browse the repository at this point in the history
  3. Optionally recommend against static import of Truth8.assertThat.

    The methods there will be moving into the main `Truth` class. Users will have various options for how to migrate, but one option involves avoiding static imports. We will provide more instructions as part of our Truth releases. (See, e.g., [the release notes for Truth 1.3.0](https://github.com/google/truth/releases/tag/v1.3.0).)
    
    Rough outline of the option that involves avoiding static imports:
    
    - The problem with adding `Truth8.assertThat(OptionalInt)` (or a similar overload) to `Truth` is that anyone who static imports both `Truth.assertThat` and `Truth8.assertThat` will see ambiguity errors if they use that method.
    - The solution is to stop using static import for `Truth8.assertThat`. Once all its static imports are gone, we can add the new methods to `Truth` without breaking anyone, and then we can migrate users.
    - Avoiding static import for `Truth8.assertThat` would be tough to swallow for the most common types, `Stream` and `Optional`. Luckily, I found an alternative approach that works for those, as discussed in the linked release notes. (That approach works for those types because they're generic types.)
    
    PiperOrigin-RevId: 601863378
    cpovirk authored and Error Prone Team committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    6a75fc1 View commit details
    Browse the repository at this point in the history

Commits on Jan 27, 2024

  1. Add more documentation for LenientFormatStringValidation

    PiperOrigin-RevId: 601904095
    cushon authored and Error Prone Team committed Jan 27, 2024
    Configuration menu
    Copy the full SHA
    ec9d69a View commit details
    Browse the repository at this point in the history

Commits on Jan 29, 2024

  1. Exempt methods annotated with @StartBundle or @FinishBundle since the…

    …y are called reflectively by the Apache Beam framework.
    
    https://beam.apache.org/releases/javadoc/current/org/apache/beam/sdk/transforms/DoFn.html
    
    PiperOrigin-RevId: 602412808
    java-team-github-bot authored and Error Prone Team committed Jan 29, 2024
    Configuration menu
    Copy the full SHA
    95e66ac View commit details
    Browse the repository at this point in the history

Commits on Jan 30, 2024

  1. Update Truth version

    cushon authored and Error Prone Team committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    f5df283 View commit details
    Browse the repository at this point in the history
  2. Automatic code cleanup.

    PiperOrigin-RevId: 602812366
    cpovirk authored and Error Prone Team committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    e45f6b7 View commit details
    Browse the repository at this point in the history
  3. Automatic code cleanup.

    PiperOrigin-RevId: 602812834
    cpovirk authored and Error Prone Team committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    e6e2706 View commit details
    Browse the repository at this point in the history

Commits on Jan 31, 2024

  1. Migrate usages of Truth8.assertThat to equivalent usages of `Truth.…

    …assertThat`.
    
    The `Truth8` methods will be hidden in the future. All callers will use `Truth`.
    
    To make that migration possible, upgrade Truth to 1.3.0.
    
    (progress toward google/truth#746)
    
    PiperOrigin-RevId: 603108718
    cpovirk authored and Error Prone Team committed Jan 31, 2024
    Configuration menu
    Copy the full SHA
    4eb812d View commit details
    Browse the repository at this point in the history

Commits on Feb 1, 2024

  1. Add some known thread safe types to[]

    Tested:
        TAP for global presubmit queue
        []
    PiperOrigin-RevId: 603189890
    chaoren authored and Error Prone Team committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    d7cc8bb View commit details
    Browse the repository at this point in the history
  2. Return the "real" Symbol instead of sometimes a Symbol whose `own…

    …er` is a subclass.
    
    We accomplish this by calling `baseSymbol()` on the initial `Symbol`.
    
    (We likely should do this in more places in Error Prone, including the location in `ASTHelpers.getSymbol` that I've flagged and perhaps anywhere else that we directly access `tree.sym`.)
    
    Thanks to @msridhar for links to relevant JDK discussions, notably [JDK-8293890](https://bugs.openjdk.org/browse/JDK-8293890).
    
    Effects:
    - This change definitely helps with [static imports](uber/NullAway#764), as demonstrated in a new test in `ParameterNameTest`, which fails before this change. (I didn't actually look into why the test fails before. Maybe the "fake" `Symbol` lacks the parameter names of the original?)
    - I didn't check whether it helps with [`someSerializable.equals`](uber/NullAway#897). It seems likely to, but _shrug_ for now.
    - I had expected this to help with the `TestCase.fail` handling in `ReturnMissingNullable`, but it turns out that I'm wrong on multiple levels. I updated its comments and tests accordingly:
       - `TestCase.fail` _does_ exist as a declared method nowadays; it's not merely inherited from `Assert`. I must have been looking at [quite an old version](junit-team/junit4@dde798f#diff-f9834c0e0ef1d54e1757e221b7b4248c2ba8e0de41d2f0fadac5927b906edd85R226).
       - The problem there comes not from the need for `ASTHelpers.getSymbol` to use `baseSymbol()` but instead for the need for `MethodMatchState.ownerType` to look at the actual `owner` instead of the type of the receiver tree. (If it started to do that, it would then benefit from this change to produce the correct `owner`.) I added a link to the appropriate bug there.
    PiperOrigin-RevId: 603374262
    cpovirk authored and Error Prone Team committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    e5a6d0d View commit details
    Browse the repository at this point in the history

Commits on Feb 3, 2024

  1. Remove references to -XepOpt:Android:Java8Libs

    PiperOrigin-RevId: 603821511
    cushon authored and Error Prone Team committed Feb 3, 2024
    Configuration menu
    Copy the full SHA
    20562d0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    41fbd95 View commit details
    Browse the repository at this point in the history

Commits on Feb 5, 2024

  1. Update Truth to [1.4.0](https://github.com/google/truth/releases/tag/…

    …v1.4.0).
    
    PiperOrigin-RevId: 604375179
    cpovirk authored and Error Prone Team committed Feb 5, 2024
    Configuration menu
    Copy the full SHA
    a36ed6f View commit details
    Browse the repository at this point in the history
  2. Add another AndroidJdkLibsChecker regression test

    PiperOrigin-RevId: 604449600
    cushon authored and Error Prone Team committed Feb 5, 2024
    Configuration menu
    Copy the full SHA
    618d488 View commit details
    Browse the repository at this point in the history

Commits on Feb 6, 2024

  1. Fix typos

    This PR fixes a few typos I spotted in the documentation of the project.
    
    Fixes google#4224
    
    COPYBARA_INTEGRATE_REVIEW=google#4224 from deining:fix-typos 25978d6
    PiperOrigin-RevId: 604736232
    deining authored and Error Prone Team committed Feb 6, 2024
    Configuration menu
    Copy the full SHA
    5f20325 View commit details
    Browse the repository at this point in the history
  2. Rollforward of google@654d1db: Handle Joiner.on(...) in AbstractToStr…

    …ing.
    
    Not yet handling the Iterable overload; that's a bit more involved given the lack of prior art.
    
    Handily there was a 'isInVarargsPosition' _right there_.
    
    PiperOrigin-RevId: 604758974
    graememorgan authored and Error Prone Team committed Feb 6, 2024
    Configuration menu
    Copy the full SHA
    0bd7432 View commit details
    Browse the repository at this point in the history

Commits on Feb 7, 2024

  1. Automatic code cleanup.

    PiperOrigin-RevId: 605025464
    cpovirk authored and Error Prone Team committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    3ff139f View commit details
    Browse the repository at this point in the history
  2. ErrorProne: Update TestParameterInjector version

    This is to unblock unknown commit
    
    PiperOrigin-RevId: 605082043
    java-team-github-bot authored and Error Prone Team committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    68badf0 View commit details
    Browse the repository at this point in the history

Commits on Feb 8, 2024

  1. Automatic code cleanup.

    PiperOrigin-RevId: 605217009
    java-team-github-bot authored and Error Prone Team committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    b799927 View commit details
    Browse the repository at this point in the history

Commits on Feb 12, 2024

  1. Update Android API diff

    PiperOrigin-RevId: 606334307
    cushon authored and Error Prone Team committed Feb 12, 2024
    Configuration menu
    Copy the full SHA
    32312a2 View commit details
    Browse the repository at this point in the history

Commits on Feb 14, 2024

  1. Drop diagnostics that are reported inside ErrorProneTokens

    javac's tokenize now emits some diagnostics (including the `text-blocks` lint
    warnings), and this can result in ErrorProneTokens causing bogus diagnostics to
    be logged.
    
    PiperOrigin-RevId: 607014734
    cushon authored and Error Prone Team committed Feb 14, 2024
    Configuration menu
    Copy the full SHA
    a1f4fa7 View commit details
    Browse the repository at this point in the history
  2. Add a test case demonstrating a CanIgnoreReturnValueSuggester bug.

    PiperOrigin-RevId: 607088772
    kluever authored and Error Prone Team committed Feb 14, 2024
    Configuration menu
    Copy the full SHA
    4f060e1 View commit details
    Browse the repository at this point in the history
  3. Add some known thread safe types to[]

    These types are already in []
    
    TAP train ticket - []
    
    PiperOrigin-RevId: 607088877
    java-team-github-bot authored and Error Prone Team committed Feb 14, 2024
    Configuration menu
    Copy the full SHA
    ae3a19f View commit details
    Browse the repository at this point in the history

Commits on Feb 20, 2024

  1. Add a check for comparing System.console() to null

    See https://bugs.openjdk.org/browse/JDK-8309155
    
    PiperOrigin-RevId: 608688611
    cushon authored and Error Prone Team committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    404a34b View commit details
    Browse the repository at this point in the history

Commits on Feb 21, 2024

  1. ErrorProne check to flag calls to Enum.ordinal().

    TESTED: unknown commit
    PiperOrigin-RevId: 608797794
    java-team-github-bot authored and Error Prone Team committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    1eda7f8 View commit details
    Browse the repository at this point in the history
  2. Add an @Ignored unit test for a JUnitIncompatibleType CCE

    google#4291
    
    PiperOrigin-RevId: 609002759
    cushon authored and Error Prone Team committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    2afe510 View commit details
    Browse the repository at this point in the history
  3. Internal change.

    PiperOrigin-RevId: 609097523
    cushon authored and Error Prone Team committed Feb 21, 2024
    Configuration menu
    Copy the full SHA
    19a0731 View commit details
    Browse the repository at this point in the history

Commits on Feb 22, 2024

  1. ModifiedButNotUsed: exempt unused-prefixes.

    PiperOrigin-RevId: 609364784
    graememorgan authored and Error Prone Team committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    0565b72 View commit details
    Browse the repository at this point in the history
  2. Some small behavior-preserving refactoring of CanIgnoreReturnValueSug…

    …gester
    
    PiperOrigin-RevId: 609382750
    nick-someone authored and Error Prone Team committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    3108612 View commit details
    Browse the repository at this point in the history
  3. Stop suggesting @CanIgnoreReturnValue on Builder methods that retur…

    …n useful values
    
    By limiting our eagerness to annotate eligible Builder methods to only the `abstract` methods. We don't suggest annotating abstract/overridable methods with @cirv in general, but for Builders, we choose to do so, since we expect that the only reasonable override of the method involves returning "this" or similar.
    
    PiperOrigin-RevId: 609396324
    nick-someone authored and Error Prone Team committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    e3725d2 View commit details
    Browse the repository at this point in the history
  4. Fix handling of default cases in arrow switches

    And consolidate some reflective workarounds for switch API changes.
    
    Fixes google#4266
    
    PiperOrigin-RevId: 609484284
    cushon authored and Error Prone Team committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    f768b0b View commit details
    Browse the repository at this point in the history

Commits on Feb 23, 2024

  1. Move the EnumOrdinal.md doc to the right place (it got overwritten by…

    … automation).
    
    Also, add a comment about manually providing an index if you need a stable one.
    
    PiperOrigin-RevId: 609531242
    graememorgan authored and Error Prone Team committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    f3dbb09 View commit details
    Browse the repository at this point in the history

Commits on Feb 26, 2024

  1. Fix some mistakes in the EnumOrdinal examples

    PiperOrigin-RevId: 610431336
    Stephan202 authored and Error Prone Team committed Feb 26, 2024
    Configuration menu
    Copy the full SHA
    297019c View commit details
    Browse the repository at this point in the history
  2. ImpossibleNullComparison: emit empty fixes.

    There's a subtle logic error here: empty fixes are meant to be emitted, there's just no fix.
    
    PiperOrigin-RevId: 610434295
    graememorgan authored and Error Prone Team committed Feb 26, 2024
    Configuration menu
    Copy the full SHA
    af37d35 View commit details
    Browse the repository at this point in the history
  3. Recommend using var for var unused = ...; and `var thrown = asser…

    …tThrows(MyException.class, () -> ...);`
    
    PiperOrigin-RevId: 610457244
    kluever authored and Error Prone Team committed Feb 26, 2024
    Configuration menu
    Copy the full SHA
    ad513d5 View commit details
    Browse the repository at this point in the history

Commits on Mar 5, 2024

  1. Increase year range on Date usages.

    PiperOrigin-RevId: 612829610
    kluever authored and Error Prone Team committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    3292632 View commit details
    Browse the repository at this point in the history
  2. Ignore disabled checks passed to -XepPatchChecks

    Rather than throwing an `NoSuchElementException`.
    
    Fixes google#3908.
    
    Fixes google#4028
    
    COPYBARA_INTEGRATE_REVIEW=google#4028 from PicnicSupermarket:gdejong/remove-disabled-checks 3a75f22
    PiperOrigin-RevId: 612956455
    oxkitsune authored and Error Prone Team committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    9da2d55 View commit details
    Browse the repository at this point in the history

Commits on Mar 8, 2024

  1. feat: add jpms definition for annotations

    ## Summary
    
    Minimal set of changes to ship a `module-info.java`, and support JVM 1.8 for the `annotations` module only.
    
    ### Reasoning
    
    It costs almost nothing to support _only_ the annotations on JVM 1.8, for projects which transitively include `error-prone-annotations`, which can happen via a simple dependency on something like Guava. But, it would be ideal to [ship a `module-info.java`](google#2649), so `annotations` is now a `Multi-Release` JAR, with a `module-info.class` in `META-INF/versions/9`.
    
    I am working downstream to [support JPMS in Guava](google/guava#2970), and this PR will be necessary for that to eventually land (without hackery). [Checker Framework recently merged their support](typetools/checker-framework#6326) which means Error Prone is one of the last things on the classpath for Guava without a `module-info.java` definition.
    
    Automatic Modules also aren't the answer because they cannot be used with `jlink`. Such dependencies must be processed by tools like Moditect before they can be used in fully modular Java builds. Because Error Prone Annotations is a dependency in Guava, and is itself very popular, many projects need Error Prone to adopt JPMS so they can ship their own code with modular Java support.
    
    There may be libraries out there that depend on the annotations _and not the compiler_, who wish to ship a MRJAR and retain JVM 1.8 support (Guava).
    
    ### Non-release version number change
    
    One wrinkle here is that the Maven project version [is used unconditionally](https://github.com/apache/maven-compiler-plugin/blob/74cfc72acae4f55708bca189b2170167e83df6b3/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java#L304-L305) [as the `--module-version`][0]; however, [`HEAD-SNAPSHOT` is not a valid module identifier](https://lists.apache.org/thread/qtghq13qgjoc4pn6ovsdxgnjnm4ozv4d). This leaves only a few choices to support JPMS through recent (`3.8.x+`) Maven Compiler plugin versions:
    
    - `HEAD-SNAPSHOT` needs to become `1.0-HEAD-SNAPSHOT`, and then it is a valid `--module-version`
    - Or, Maven Compiler Plugin needs to ship a bugfix and Error Prone will need to wait for a release (if a bugfix ships at all)
    
    I understand this can be a breaking change somewhere within Google, but I don't see a way around this without resorting to severe build hacks. I've gotten it to build anyway by building the `module-info.java` only in a separate Maven project, and then copying it into the JAR at the last moment, but there are serious issues with that route so I suggest it be abandoned in favor of a version string change during dev, if possible.
    
    ## Changelog
    
    - feat: add `module-info` to `annotations` module
    - feat: ship `annotations` as a `Multi-Release` JAR
    - feat: support `1.8` through latest JDK for `annotations` module
    - fix: remove automatic module definition from `annotations` module
    - fix: `HEAD-SNAPSHOT` → `1.0-HEAD-SNAPSHOT`, because of a Maven Compiler Plugin issue [precluding use as a module version][0]
    
    Fixes and closes google#2649
    
    [0]: https://issues.apache.org/jira/browse/MCOMPILER-579
    
    Fixes google#4311
    
    COPYBARA_INTEGRATE_REVIEW=google#4311 from sgammon:feat/jpms d209b0c
    PiperOrigin-RevId: 614026439
    sgammon authored and Error Prone Team committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    0e95364 View commit details
    Browse the repository at this point in the history

Commits on Mar 9, 2024

  1. Add the 'compile' goal for 'compile-java9'

    google#4314 (comment)
    
    Fixes google#4314
    
    COPYBARA_INTEGRATE_REVIEW=google#4314 from cushon:module 604430d
    PiperOrigin-RevId: 614276837
    cushon authored and Error Prone Team committed Mar 9, 2024
    Configuration menu
    Copy the full SHA
    ea5ef6d View commit details
    Browse the repository at this point in the history

Commits on Mar 12, 2024

  1. fix: module name → com.google.errorprone.annotations

    ## Summary
    
    Fixes the module name: ~~`com.google.errorprone.annotation`~~ → `com.google.errorprone.annotations`. Amends the OSGi build not to include `Automatic-Module-Name` in the `MANIFEST.MF` for the `annotations` project.
    
    ## Changelog
    
    - fix: name in `module-info.java` for `annotations` module
    - fix: don't emit `Automatic-Module-Name` in `annotations` module
    - chore: preserve all other aspects of OSGi and JAR builds
    
    Relates to [discussion](google#4311 (comment)) in google#4311. Double checked for correct JAR structure; see [these screenshots](google#4311 (comment)).
    
    cc / @cushon @ben-manes
    
    Fixes google#4317
    
    COPYBARA_INTEGRATE_REVIEW=google#4317 from sgammon:fix/module-name bc52c58
    PiperOrigin-RevId: 615114274
    sgammon authored and Error Prone Team committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    9d99ee7 View commit details
    Browse the repository at this point in the history

Commits on Mar 13, 2024

  1. Initial implementation of a check for class initialization deadlocks

    google#2062
    
    PiperOrigin-RevId: 615515920
    cushon authored and Error Prone Team committed Mar 13, 2024
    Configuration menu
    Copy the full SHA
    1d99484 View commit details
    Browse the repository at this point in the history

Commits on Mar 14, 2024

  1. Don't check interfaces for class initialization cycles

    Circular initialization causes deadlocks for non-interface classes because of
    the requirement that super classes be initialized first, but that doesn't apply
    to interfaces, only concrete classes.
    
    google#2062
    
    PiperOrigin-RevId: 615642376
    cushon authored and Error Prone Team committed Mar 14, 2024
    Configuration menu
    Copy the full SHA
    1b576a7 View commit details
    Browse the repository at this point in the history
  2. Add heuristics for classes with private constructors/factories, and f…

    …or non-static inner classes
    
    google#2062
    
    PiperOrigin-RevId: 615879331
    cushon authored and Error Prone Team committed Mar 14, 2024
    Configuration menu
    Copy the full SHA
    ddbeec3 View commit details
    Browse the repository at this point in the history

Commits on Mar 15, 2024

  1. Tighten the AlmostJavadoc heuristic for HTML tags.

    PiperOrigin-RevId: 616116744
    graememorgan authored and Error Prone Team committed Mar 15, 2024
    Configuration menu
    Copy the full SHA
    7f9c6a1 View commit details
    Browse the repository at this point in the history

Commits on Mar 18, 2024

  1. ImpossibleNullComparison: match on all primitives.

    PiperOrigin-RevId: 616822108
    graememorgan authored and Error Prone Team committed Mar 18, 2024
    Configuration menu
    Copy the full SHA
    c2a1a7c View commit details
    Browse the repository at this point in the history
  2. Treat builder setter methods inside `@dagger.producers.ProductionComp…

    …onent.Builder` and `@dagger.producers.ProductionSubcomponent.Builder` as ignorable.
    
    #checkreturnvalue
    
    PiperOrigin-RevId: 616946969
    kluever authored and Error Prone Team committed Mar 18, 2024
    Configuration menu
    Copy the full SHA
    1b36127 View commit details
    Browse the repository at this point in the history

Commits on Mar 19, 2024

  1. Detect multiple sets on the same proto oneof.

    PiperOrigin-RevId: 617130971
    graememorgan authored and Error Prone Team committed Mar 19, 2024
    Configuration menu
    Copy the full SHA
    0d2f5e5 View commit details
    Browse the repository at this point in the history
  2. Document some suggested fixes for ClassInitializationDeadlock

    google#2062
    
    PiperOrigin-RevId: 617293200
    cushon authored and Error Prone Team committed Mar 19, 2024
    Configuration menu
    Copy the full SHA
    0cb0873 View commit details
    Browse the repository at this point in the history
  3. Fix MultipleNullnessAnnotations's ability to read type annotations fr…

    …om type variable uses
    
    For whatever reason, the type annotations cannot be accessed using the `Tree`s for the corresponding AST node for those types (`getType(methodTree.getReturnType())` and `getType(variableTree.getType())`.
    
    Fixes google#4320
    
    PiperOrigin-RevId: 617311880
    cushon authored and Error Prone Team committed Mar 19, 2024
    Configuration menu
    Copy the full SHA
    449618c View commit details
    Browse the repository at this point in the history
  4. ClassInitializationDeadlock: improve handling of classes that can't b…

    …e initialized outside the current compilation unit
    
    Consider all classes in the super type hierarchy between the subclass and containing superclass, to catch deadlocks where an intermediate supertype can be instantiated.
    
    This also fixes an NPE with an existing check for the direct super type.
    
    google#2062
    
    PiperOrigin-RevId: 617314919
    cushon authored and Error Prone Team committed Mar 19, 2024
    Configuration menu
    Copy the full SHA
    e5f0814 View commit details
    Browse the repository at this point in the history

Commits on Mar 20, 2024

  1. Rip out TestParametersNotInitialized:MoreRunners flag.

    PiperOrigin-RevId: 617515136
    graememorgan authored and Error Prone Team committed Mar 20, 2024
    Configuration menu
    Copy the full SHA
    ec13312 View commit details
    Browse the repository at this point in the history
  2. When an inlined method refers to method arguments in the true or false

    branch of a conditional statement, refuse to allow it to be inlined.
    
    Before calling the method in question, the caller has definitely
    executed the expressions that yield the values passed to the method.
    
    However, after inlining the body of the method into the callsite, one
    of the two expressions will no longer be executed, leading to a subtle
    behavior change if the un-executed expression was side-effecting.
    
    PiperOrigin-RevId: 617624766
    nick-someone authored and Error Prone Team committed Mar 20, 2024
    Configuration menu
    Copy the full SHA
    437293d View commit details
    Browse the repository at this point in the history

Commits on Mar 21, 2024

  1. Rip out ImmutableNullComparison:EmitEmptyFixes.

    PiperOrigin-RevId: 617789741
    graememorgan authored and Error Prone Team committed Mar 21, 2024
    Configuration menu
    Copy the full SHA
    58473c5 View commit details
    Browse the repository at this point in the history

Commits on Mar 22, 2024

  1. Fix a typo in SuggestedFix.checkNotSyntheticConstructor

    PiperOrigin-RevId: 618176103
    graememorgan authored and Error Prone Team committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    5840b4d View commit details
    Browse the repository at this point in the history

Commits on Mar 25, 2024

  1. Rename TruthSelfEquals to a more sensible name.

    PiperOrigin-RevId: 618828938
    graememorgan authored and Error Prone Team committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    9d5491d View commit details
    Browse the repository at this point in the history
  2. Handle exhaustive switches on sealed types in MissingDefault

    PiperOrigin-RevId: 618889679
    cushon authored and Error Prone Team committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    cd6a504 View commit details
    Browse the repository at this point in the history
  3. Fix a crash in NonCanonicalType with type annotations

    Fixes google#4343
    
    PiperOrigin-RevId: 618890911
    cushon authored and Error Prone Team committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    af9dad8 View commit details
    Browse the repository at this point in the history

Commits on Mar 26, 2024

  1. Tidy some SuggestedFix usages.

    I added a `toBuilder` method to avoid the `SuggestedFix.builder().merge(x)` dance, and made use of the newer static `merge` method in a few places.
    
    PiperOrigin-RevId: 619220321
    graememorgan authored and Error Prone Team committed Mar 26, 2024
    Configuration menu
    Copy the full SHA
    527171c View commit details
    Browse the repository at this point in the history
  2. Remove mutable state from ThreadSafety.

    Ironically, this is stopping the class being thread-safe.
    
    PiperOrigin-RevId: 619256145
    graememorgan authored and Error Prone Team committed Mar 26, 2024
    Configuration menu
    Copy the full SHA
    29d9335 View commit details
    Browse the repository at this point in the history

Commits on Mar 27, 2024

  1. Yoda conditions: consider static fields which are in SHOUTY_CASE to…

    … be constant.
    
    Motivated by `Boolean.TRUE`, but that seemed a bit special-casey.
    
    PiperOrigin-RevId: 619497318
    graememorgan authored and Error Prone Team committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    9b2c2a9 View commit details
    Browse the repository at this point in the history
  2. Fix an ArrayToString false positive for the varargs overload of `Join…

    …er.join(Object, Object, Object...)`
    
    google#4233 (review)
    
    PiperOrigin-RevId: 619537499
    cushon authored and Error Prone Team committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    ed4b61d View commit details
    Browse the repository at this point in the history

Commits on Mar 28, 2024

  1. Prepare RedundantSetterCall for becoming an ERROR.

    PiperOrigin-RevId: 620003152
    graememorgan authored and Error Prone Team committed Mar 28, 2024
    Configuration menu
    Copy the full SHA
    48ec7d9 View commit details
    Browse the repository at this point in the history

Commits on Apr 2, 2024

  1. Wrangle MixedArrayDimensions to be an error internally, but not ext…

    …ernally.
    
    I added the third_party exemption proactively, and had to hardcode _one last annoying exemption_.
    
    PiperOrigin-RevId: 621130845
    graememorgan authored and Error Prone Team committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    474a4ac View commit details
    Browse the repository at this point in the history
  2. Handle unqualified instance method names in refaster

    Previously unqualified methods names were being handled using logic intended for local variables, which failed to match them.
    
    Unqualified instance method names are relatively rare in templates. The motivating example was a template intended to match on an anonymous class creation, where code in the class called a method from a superclass by its simple name.
    
    PiperOrigin-RevId: 621197168
    cushon authored and Error Prone Team committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    e4c9409 View commit details
    Browse the repository at this point in the history
  3. Warn about returning a null Table, too.

    PiperOrigin-RevId: 621206548
    cpovirk authored and Error Prone Team committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    0c12a77 View commit details
    Browse the repository at this point in the history
  4. Drop text about 'legacy methods' From RestrictedApi methods

    PiperOrigin-RevId: 621319804
    cushon authored and Error Prone Team committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    4ce508b View commit details
    Browse the repository at this point in the history

Commits on Apr 4, 2024

  1. Add @snippet as a known inline tag.

    Fixes external google#4308.
    
    PiperOrigin-RevId: 621845649
    graememorgan authored and Error Prone Team committed Apr 4, 2024
    Configuration menu
    Copy the full SHA
    200eb43 View commit details
    Browse the repository at this point in the history

Commits on Apr 5, 2024

  1. Allow CONST_CASE != null in YodaCondition

    Follow-up to google@9b2c2a9
    
    PiperOrigin-RevId: 622020333
    cushon authored and Error Prone Team committed Apr 5, 2024
    Configuration menu
    Copy the full SHA
    23547ac View commit details
    Browse the repository at this point in the history

Commits on Apr 15, 2024

  1. Don't suggest ImmutableSet if ImmutableList is unused.

    PiperOrigin-RevId: 624898303
    java-team-github-bot authored and Error Prone Team committed Apr 15, 2024
    Configuration menu
    Copy the full SHA
    53d787c View commit details
    Browse the repository at this point in the history
  2. NearbyCallers: scan the body of expression lambdas.

    PiperOrigin-RevId: 624922054
    graememorgan authored and Error Prone Team committed Apr 15, 2024
    Configuration menu
    Copy the full SHA
    5a7b8d9 View commit details
    Browse the repository at this point in the history

Commits on Apr 16, 2024

  1. Fix a crash in JUnitIncompatibleType

    Fixes google#4291
    
    PiperOrigin-RevId: 625359890
    cushon authored and Error Prone Team committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    a6ab21a View commit details
    Browse the repository at this point in the history

Commits on Apr 18, 2024

  1. Correction to UseCorrectAssertInTests.

    Contrary to the current text, blaze test actually does enable asserts, in both dbg and opt modes. I've verified this by running a JUnit test containing "assert false" with "blaze test -c opt" and "blaze test -c dbg".
    
    My tests use a java_library BUILD rule that includes all the *Test.java files, and a GenTestRules to create the actual test targets.
    
    PiperOrigin-RevId: 626049936
    java-team-github-bot authored and Error Prone Team committed Apr 18, 2024
    Configuration menu
    Copy the full SHA
    9d66272 View commit details
    Browse the repository at this point in the history
  2. Stop mentioning @Var in[]

    PiperOrigin-RevId: 626072465
    cushon authored and Error Prone Team committed Apr 18, 2024
    Configuration menu
    Copy the full SHA
    07c1a7c View commit details
    Browse the repository at this point in the history

Commits on Apr 23, 2024

  1. Encourage when/thenReturn over doReturn/when.

    I've been very over-conservative about the heuristics on what to avoid, but nonetheless here's a huge sample flume: unknown commit
    
    PiperOrigin-RevId: 627396784
    graememorgan authored and Error Prone Team committed Apr 23, 2024
    Configuration menu
    Copy the full SHA
    92c106d View commit details
    Browse the repository at this point in the history

Commits on Apr 24, 2024

  1. Fix for a crash in RedundantSetterCall.

    []
    
    PiperOrigin-RevId: 627663284
    graememorgan authored and Error Prone Team committed Apr 24, 2024
    Configuration menu
    Copy the full SHA
    3ee6f41 View commit details
    Browse the repository at this point in the history
  2. VoidUsed: flag Void variables being _used_, where they can simply…

    … be replaced with a literal `null`.
    
    Findings here (unknown commit) before I fixed the bug with assignments.
    
    PiperOrigin-RevId: 627676095
    graememorgan authored and Error Prone Team committed Apr 24, 2024
    Configuration menu
    Copy the full SHA
    f289d9e View commit details
    Browse the repository at this point in the history
  3. Remove a very literal change-detector test, and move the comment to t…

    …he production code (which seems more discoverable).
    
    PiperOrigin-RevId: 627693317
    graememorgan authored and Error Prone Team committed Apr 24, 2024
    Configuration menu
    Copy the full SHA
    fd9b826 View commit details
    Browse the repository at this point in the history

Commits on Apr 26, 2024

  1. Release Error Prone 2.27.0

    cushon committed Apr 26, 2024
    Configuration menu
    Copy the full SHA
    ebe0a01 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bd85693 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5e3b69e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    883d2da View commit details
    Browse the repository at this point in the history