-
Notifications
You must be signed in to change notification settings - Fork 471
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
ByteBuddy: Do not use Lookup for non-local mocks #2019
Conversation
a9d132d
to
c3e4325
Compare
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
There was a problem hiding this 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!
spock-specs/src/test/groovy/org/spockframework/mock/runtime/ByteBuddyMockMakerSpec.groovy
Show resolved
Hide resolved
spock-specs/src/test/groovy/org/spockframework/mock/runtime/ByteBuddyMockMakerSpec.groovy
Show resolved
Hide resolved
spock-specs/src/test/groovy/org/spockframework/mock/runtime/ByteBuddyMockMakerSpec.groovy
Show resolved
Hide resolved
spock-core/src/main/java/org/spockframework/mock/runtime/ByteBuddyMockFactory.java
Outdated
Show resolved
Hide resolved
spock-core/src/main/java/org/spockframework/mock/runtime/ByteBuddyMockFactory.java
Show resolved
Hide resolved
spock-core/src/main/java/org/spockframework/mock/runtime/ByteBuddyMockFactory.java
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
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. |
@beatbrot Thank you very much for your contribution! |
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