-
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
Add support for default interface members in inheritance-based proxy types #661
Add support for default interface members in inheritance-based proxy types #661
Commits on Sep 10, 2023
-
DefaultInterfaceMembersTestCase
: use strings... instead of `MethodBase`s to identify which methods get invoked. This should make tests easier to read & understand.
Configuration menu - View commit details
-
Copy full SHA for dd250a6 - Browse repository at this point
Copy the full SHA dd250a6View commit details -
Add more tests for default interface method impls
Two of these tests are failing: * Class proxies cannot intercept interface methods with a default implementation if the proxied class type does not override it. * Interface proxies cannot proceed to default implementations.
Configuration menu - View commit details
-
Copy full SHA for 5e7cfc4 - Browse repository at this point
Copy the full SHA 5e7cfc4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 501be75 - Browse repository at this point
Copy the full SHA 501be75View commit details -
Configuration menu - View commit details
-
Copy full SHA for 65475c5 - Browse repository at this point
Copy the full SHA 65475c5View commit details -
Fix interception of inherited default impls in class proxies
A class implementing an interface with default method implementations will not necessarily override those methods; in such cases, the methods are currently "invisible" to DynamicProxy and thus won't get proxied. This can be solved by an extra pass over all interfaces to collect such methods, as is done in this commit. Ideally we wouldn't have to iterate over all interfaces more than once, so we should next make an effort to limit the runtime impact of this extra pass.
Configuration menu - View commit details
-
Copy full SHA for ce4be78 - Browse repository at this point
Copy the full SHA ce4be78View commit details -
Reduce impact of extra collection pass
Assuming that default interface methods are relatively rare, if we keep track of which interfaces contain any of them at all, we can then limit our extra pass during class proxy generation to just those interfaces and exclude the rest (i.e. hopefully the majority). Additionally, our collector may skip some of the more expensive checks by bailing out for methods it isn't actually interested in.
Configuration menu - View commit details
-
Copy full SHA for 9e7a15e - Browse repository at this point
Copy the full SHA 9e7a15eView commit details -
Configuration menu - View commit details
-
Copy full SHA for c542f13 - Browse repository at this point
Copy the full SHA c542f13View commit details -
Fix tests for properties with default impls
... by properly forwarding the "standalone" flag in the newly added collector.
Configuration menu - View commit details
-
Copy full SHA for 840748a - Browse repository at this point
Copy the full SHA 840748aView commit details -
Add more tests re: methods with default impls
Those essentially target "mixed" scenarios where default implementations show up next to "regular" methods. This is to better ensure that the new code paths will not interfere with pre-existing logic.
Configuration menu - View commit details
-
Copy full SHA for a7b6a7c - Browse repository at this point
Copy the full SHA a7b6a7cView commit details -
Add test for generic method with default impl
The code changes we made do not suggest that pre-existing logic dealing with generics might somehow no longer work, however we did add a bit of new code for generics which we should target with at least one test.
Configuration menu - View commit details
-
Copy full SHA for 0bb493c - Browse repository at this point
Copy the full SHA 0bb493cView commit details -
Add tests for static interface methods
This includes a test for `static abstract` methods that remains ignored for now, since we haven't implemented support for this C# 11 language feature, nor do we target any runtimes that support it. (The test is being added as a future reminder, once we start targeting .NET 7+.)
Configuration menu - View commit details
-
Copy full SHA for fe40634 - Browse repository at this point
Copy the full SHA fe40634View commit details -
Configuration menu - View commit details
-
Copy full SHA for 27828bd - Browse repository at this point
Copy the full SHA 27828bdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 09d4c15 - Browse repository at this point
Copy the full SHA 09d4c15View commit details -
Add tests for protected methods with default impls
A few of these tests fail due to `Debug.Assert` failures in `Interface- MembersWithDefaultImplementationCollector`.
Configuration menu - View commit details
-
Copy full SHA for 982f5ff - Browse repository at this point
Copy the full SHA 982f5ffView commit details -
Exclude non-overridable methods from collection
`sealed` methods do not show up in interface mappings, so make sure `InterfaceMembersWithDefaultImplementationCollector` can deal with them anyway in case of interfaces that contain both `sealed` methods as well as overridable ones with a default implementation.
Configuration menu - View commit details
-
Copy full SHA for e41315c - Browse repository at this point
Copy the full SHA e41315cView commit details -
Configuration menu - View commit details
-
Copy full SHA for ae9139f - Browse repository at this point
Copy the full SHA ae9139fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 51112db - Browse repository at this point
Copy the full SHA 51112dbView commit details