Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3cb92f

Browse files
committed
[mono][interp] Don't devirtualize final methods
They can still be overriden
1 parent 3b7d61d commit e3cb92f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/mono/mono/mini/interp/transform.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3330,7 +3330,8 @@ interp_try_devirt (MonoClass *this_klass, MonoMethod *target_method)
33303330
if (m_class_is_valuetype (new_target_method->klass))
33313331
return NULL;
33323332

3333-
if ((new_target_method->flags & METHOD_ATTRIBUTE_FINAL) || m_class_is_sealed (this_klass))
3333+
// final methods can still be overriden with explicit overrides
3334+
if (m_class_is_sealed (this_klass))
33343335
return new_target_method;
33353336

33363337
return NULL;

0 commit comments

Comments
 (0)