-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Static DIM reabstractions don't need to be final? #83189
Comments
cc @lambdageek for visibility |
Yea, @BrzVlad and I discussed this in the context of Mono's DIM implementation - I think the test is wrong - possibly there was some iterations between the runtime and Roslyn and earlier non-final methods were allowed. Reading ECMA-335 augments https://github.com/dotnet/runtime/blob/main/docs/design/specs/Ecma-335-Augments.md#proposed-specification-change-5
My reading of this is that since reabstraction uses |
This section was added for instance default interface methods and wasn't updated for statics - "all virtual instance methods defined on an interface must be". It would really help if @davidwrighton or @trylek could clarify whether we should update the wording to apply to static methods as well and fix the runtime (to throw) and test (to be final). |
@mangod9 I moved this to 8.0, this is blocking implementations in other runtimes. |
Hmm. I have recently fixed this bit to put it in sync with what Roslyn emits in I was under the impression that requiring such overridden methods to be |
@MichalStrehovsky @trylek does this need any fixing in 8? |
If we want to block static reabstractions that are not marked final, we better do it earlier than later. I don't think non-final reabstractions actually work with CoreCLR today - the VM does something completely unexpected if I try to actually override the non-final slot. I believe non-final reabstractions should be blocked by the type loader, but I can't get David to make a statement on this (I tried here, over email, etc.). I'm not in Redmond, so this is my best. Last time I checked, this was blocking the Mono team from making progress on their implementation. |
Moving this to 9 at this point. |
@BrzVlad pointed me to this passing test:
runtime/src/tests/Loader/classloader/StaticVirtualMethods/DiamondShape/svm_diamondshape.il
Lines 235 to 239 in 201aae9
Notice that this is an
.override
markedstatic abstract virtual
. Notably there's nofinal
. This means we create a new slot that someone could individually override (on top of the method we're overriding). Is this intentional?If this was a non-static default interface methods we enforce that these are always marked
final
. If they aren't, the runtime will throwTypeLoadException
"Method implementation on an interface 'X' from assembly 'Y' must be a final method.".FWIW, attempting to actually override this method currently throws a
MissingMethodException
(for a method that exists, whatever that means), and Roslyn does emit these asfinal
, so it should be safe to enforce it here too, unless it's intentional.Cc @davidwrighton @trylek
The text was updated successfully, but these errors were encountered: