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

ByteBuddy: Do not use Lookup for non-local mocks #2019

Merged

Conversation

beatbrot
Copy link
Contributor

@beatbrot beatbrot commented Oct 12, 2024

ByteBuddy: Do not use Lookup for non-local mocks

This PR introduces the concept of local mocks. A mock is considered to be local if the target class' classloader can also load all additional interfaces (incl. ISpockMockObject).

The lookup classloading strategy may only be used if a mock is local.
Otherwise we have to defer to other strategies.

Fixes #2017

@beatbrot beatbrot force-pushed the bytebuddy-local-mock-detection branch from a9d132d to c3e4325 Compare October 12, 2024 11:20
This commit introduces the concept of local mocks. A mock is considered
to be local if the target class' classloader can also load all
additional interfaces (incl. `ISpockMockObject`).

The lookup classloading strategy may only be used if a mock is local.
Otherwise we have to defer to other strategies.

Fixes spockframework#2017
@beatbrot beatbrot marked this pull request as ready for review October 12, 2024 11:20
Copy link
Member

@AndreasTu AndreasTu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your PR!

Copy link

codecov bot commented Oct 12, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 81.89%. Comparing base (2c7db77) to head (777420c).
Report is 142 commits behind head on master.

Files with missing lines Patch % Lines
...ckframework/mock/runtime/ByteBuddyMockFactory.java 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2019      +/-   ##
============================================
+ Coverage     80.44%   81.89%   +1.44%     
- Complexity     4337     4614     +277     
============================================
  Files           441      448       +7     
  Lines         13534    14443     +909     
  Branches       1707     1826     +119     
============================================
+ Hits          10888    11828     +940     
+ Misses         2008     1939      -69     
- Partials        638      676      +38     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@beatbrot beatbrot requested a review from AndreasTu October 12, 2024 11:56
@AndreasTu AndreasTu added this to the 2.4-M5 milestone Oct 12, 2024
@AndreasTu
Copy link
Member

@beatbrot Thank you very much for your contribution!
I would like to wait with the merge to give @leonard84 time to respond, if he has any comments about this PR.

@leonard84 leonard84 enabled auto-merge (squash) October 18, 2024 09:18
@leonard84 leonard84 merged commit 3076826 into spockframework:master Oct 18, 2024
26 checks passed
@beatbrot beatbrot deleted the bytebuddy-local-mock-detection branch October 18, 2024 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants