Bug 43995 - [generator] Add support for making types sealed
Summary: [generator] Add support for making types sealed
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: master
Hardware: PC Mac OS
: Normal enhancement
Target Milestone: (C10)
Assignee: Sebastien Pouliot
Depends on:
Reported: 2016-09-05 09:38 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2016-11-25 18:26 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Rolf Bjarne Kvinge [MSFT] 2016-09-05 09:38:38 UTC
Some classes aren't meant to be subclassed (based on their documentation).

Example: RPScreenRecorder [1], there's a sharedInstance property that returns the only valid instance.

Making classes sealed also:

* Makes us able to generate less code for the bound methods (they don't have to be virtual, and can assume nobody will override them, so their implementation can be simpler)
* Makes the registrar able to just skip those types completely, no processing needed.

Unfortunately the generator completely ignores the [Sealed] attribute on types, it's only honored on methods.

[1] https://developer.apple.com/library/ios/documentation/ReplayKit/Reference/RPScreenRecorder_Ref/
Comment 1 Sebastien Pouliot 2016-11-23 08:34:37 UTC
PR https://github.com/xamarin/xamarin-macios/pull/1227