Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockito/mockito
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.7.0
Choose a base ref
...
head repository: mockito/mockito
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.8.0
Choose a head ref
  • 10 commits
  • 63 files changed
  • 8 contributors

Commits on Aug 13, 2022

  1. Optimize TypeSafeMatching iteration over class methods (#2729)

    `Class.getMethods` is an inefficient method call which is being called on
    each mock invocation. It ends up constructing new `Method` objects for
    each method on the class, and this can dominate the overall performance
    of Mockito mocks. This commit caches the result of the computation.
    
    Once concern is that this change uses some static state. I considered:
    
    - Instance state - based on where this type is constructed it seemed
      like it'd be a big imposition on code readability elsewhere.
    - Weakly referenced map. Mockito has a type for this, but the
      constructor of that type produces a Thread with which to clean up.
    
    Both of these seemed like overkill compared to the overhead expected
    in the real world (which should be on the order of a few kilobytes of
    RAM at most).
    
    Fixes #2723
    j-baker committed Aug 13, 2022
    Configuration menu
    Copy the full SHA
    89698ba View commit details
    Browse the repository at this point in the history
  2. Fixes #2720: Use StackWalker on Java 9+ to create Locations (#2723)

    In terms of memory allocations, this reduces the overall memory
    allocations of creating a location by an order of magnitude in
    Java 9, and as compared to Java 8.
    
    The implementation is somewhat involved due to these desires:
    
    - Minimize the amount of work done if the Location is never used. This
      is done by not converting the StackFrame into a StackTraceElement,
      instead wrapping in an intermediate state. The StackTraceElement conversion
      will only occur (internally) if the .getFileName() method is called.
    - Ensure the implementation is still Serializable. This is ensured with
      a .writeReplace method.
    - Minimize the number of allocations, which is basically an exercise in
      lambda caching.
    - Ensuring the old mechanism still works on Java 8.
    
    Presently on Java 9+, on a stack depth of 1000 the old mechanism will allocate
    40kB of RAM per call. The new one will allocate 1.5kB of RAM per call,
    which is a huge improvement.
    
    This is still sadly not the 'close-to-no-overhead' solution I was
    looking for. I therefore also added a system property that can be used
    to fully disable Location creation. I'm aware that this is likely not
    the right approach given Mockito has plugins and settings - mostly
    looking for guidance here given I'm not sure what would be idiomatic
    here.
    j-baker committed Aug 13, 2022
    Configuration menu
    Copy the full SHA
    73a861f View commit details
    Browse the repository at this point in the history

Commits on Aug 15, 2022

  1. Configuration menu
    Copy the full SHA
    2ded10e View commit details
    Browse the repository at this point in the history

Commits on Aug 22, 2022

  1. Bump versions.bytebuddy from 1.12.13 to 1.12.14 (#2734)

    Bumps `versions.bytebuddy` from 1.12.13 to 1.12.14.
    
    Updates `byte-buddy` from 1.12.13 to 1.12.14
    - [Release notes](https://github.com/raphw/byte-buddy/releases)
    - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md)
    - [Commits](raphw/byte-buddy@byte-buddy-1.12.13...byte-buddy-1.12.14)
    
    Updates `byte-buddy-agent` from 1.12.13 to 1.12.14
    - [Release notes](https://github.com/raphw/byte-buddy/releases)
    - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md)
    - [Commits](raphw/byte-buddy@byte-buddy-1.12.13...byte-buddy-1.12.14)
    
    Updates `byte-buddy-android` from 1.12.13 to 1.12.14
    - [Release notes](https://github.com/raphw/byte-buddy/releases)
    - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md)
    - [Commits](raphw/byte-buddy@byte-buddy-1.12.13...byte-buddy-1.12.14)
    
    ---
    updated-dependencies:
    - dependency-name: net.bytebuddy:byte-buddy
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: net.bytebuddy:byte-buddy-agent
      dependency-type: direct:production
      update-type: version-update:semver-patch
    - dependency-name: net.bytebuddy:byte-buddy-android
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] committed Aug 22, 2022
    Configuration menu
    Copy the full SHA
    e123c2c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    160e3da View commit details
    Browse the repository at this point in the history
  3. Merge pull request #2736 from mockito/static-varargs-call

    Drop varargs collector before invoking a user method.
    raphw committed Aug 22, 2022
    Configuration menu
    Copy the full SHA
    9b93df7 View commit details
    Browse the repository at this point in the history

Commits on Aug 24, 2022

  1. Bump com.diffplug.spotless from 6.9.1 to 6.10.0 (#2738)

    Bumps com.diffplug.spotless from 6.9.1 to 6.10.0.
    
    ---
    updated-dependencies:
    - dependency-name: com.diffplug.spotless
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] committed Aug 24, 2022
    Configuration menu
    Copy the full SHA
    4b8042e View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2022

  1. Assign GlobalConfiguration initializer to unused variable (#2742)

    (This silences some errorprone static analysis about calling constructors w/o using the new object.)
    kluever committed Aug 30, 2022
    Configuration menu
    Copy the full SHA
    530558a View commit details
    Browse the repository at this point in the history

Commits on Sep 5, 2022

  1. Explicitly add permissions to GitHub actions (#2744)

    Signed-off-by: sashashura <[email protected]>
    sashashura committed Sep 5, 2022
    Configuration menu
    Copy the full SHA
    0753d48 View commit details
    Browse the repository at this point in the history

Commits on Sep 7, 2022

  1. Configuration menu
    Copy the full SHA
    3e910ea View commit details
    Browse the repository at this point in the history
Loading