RESOLVED FIXED 210775
Classes marked final should not use protected access specifier
https://bugs.webkit.org/show_bug.cgi?id=210775
Summary Classes marked final should not use protected access specifier
Ross Kirsling
Reported 2020-04-20 17:08:20 PDT
Classes marked final should not use protected access specifier
Attachments
Patch (183.43 KB, patch)
2020-04-20 17:09 PDT, Ross Kirsling
no flags
Patch (183.11 KB, patch)
2020-04-20 17:22 PDT, Ross Kirsling
no flags
Patch (183.09 KB, patch)
2020-04-20 17:59 PDT, Ross Kirsling
no flags
Patch (182.40 KB, patch)
2020-04-20 19:16 PDT, Ross Kirsling
no flags
Ross Kirsling
Comment 1 2020-04-20 17:09:18 PDT
Ross Kirsling
Comment 2 2020-04-20 17:22:46 PDT
Joseph Pecoraro
Comment 3 2020-04-20 17:45:24 PDT
The code movement in this patch presents a lot of noise that will make it more difficult to blame / investigate history. Is the movement worth it?
Ross Kirsling
Comment 4 2020-04-20 17:59:50 PDT
Ross Kirsling
Comment 5 2020-04-20 18:05:54 PDT
(In reply to Joseph Pecoraro from comment #3) > The code movement in this patch presents a lot of noise that will make it > more difficult to blame / investigate history. Is the movement worth it? I'd started with just JSC and figured it'd be beneficial to keep things consistently ordered (at least with, say, constructors and finishCreation) as well as to remove any public/private back-and-forth where trivial. I applied that idea to other areas of the codebase too; the WebCore cases might be more questionable but I think the WKL/win cases are pretty nice. Anyway you're free to object, but I feel like constructor declarations would be comparatively rare lines to blame?
Darin Adler
Comment 6 2020-04-20 18:07:39 PDT
Comment on attachment 397040 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=397040&action=review > Source/JavaScriptCore/ChangeLog:3 > + Classes marked final should not use protected access specifier Great rule of thumb! I would say the same about *any* classes that have no classes derived from them, even if they aren’t marked final. > Source/JavaScriptCore/runtime/Structure.h:-176 > -public: This says "public", not "private"!!!
Darin Adler
Comment 7 2020-04-20 18:07:52 PDT Comment hidden (obsolete)
Darin Adler
Comment 8 2020-04-20 18:08:01 PDT Comment hidden (obsolete)
Darin Adler
Comment 9 2020-04-20 18:09:01 PDT
I think a little bit of code movements is worth it for clarity.
Ross Kirsling
Comment 10 2020-04-20 18:17:12 PDT
(In reply to Darin Adler from comment #6) > Comment on attachment 397040 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=397040&action=review > > > Source/JavaScriptCore/ChangeLog:3 > > + Classes marked final should not use protected access specifier > > Great rule of thumb! I would say the same about *any* classes that have no > classes derived from them, even if they aren’t marked final. Indeed -- Yusuke pointed out that JSC even has optimizations that can apply to classes marked final, though for this patch I'm not sure I want to go through all the protected-without-final cases, haha. > > Source/JavaScriptCore/runtime/Structure.h:-176 > > -public: > > This says "public", not "private"!!! Yeah, it seems I was moving a bit too quickly on a few of these. 😅
Ross Kirsling
Comment 11 2020-04-20 19:16:01 PDT
Daniel Bates
Comment 12 2020-04-20 22:39:22 PDT
Ross Kirsling
Comment 13 2020-04-20 22:44:04 PDT
Comment on attachment 397046 [details] Patch (In reply to Daniel Bates from comment #12) > Comment on attachment 397046 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=397046&action=review > > Patch looks good. Thanks for the review!
EWS
Comment 14 2020-04-20 23:11:13 PDT
Committed r260415: <https://trac.webkit.org/changeset/260415> All reviewed patches have been landed. Closing bug and clearing flags on attachment 397046 [details].
Radar WebKit Bug Importer
Comment 15 2020-04-20 23:12:17 PDT
Note You need to log in before you can comment on or make changes to this bug.