[JIRA] (MDA-268) Remove field nulling in doDestroy methods

Ian Young (Jira) jira at shibboleth.atlassian.net
Tue Mar 1 17:35:20 UTC 2022


Ian Young ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ae127cb03-43ed-473d-b6ba-592949cb4be8 ) *created* an issue

Metadata Aggregator ( https://shibboleth.atlassian.net/browse/MDA?atlOrigin=eyJpIjoiNzk5NzEzMWYzNTE1NDViMDk5OTk0YjM1ODQyNGIxOWQiLCJwIjoiaiJ9 ) / Improvement ( https://shibboleth.atlassian.net/browse/MDA-268?atlOrigin=eyJpIjoiNzk5NzEzMWYzNTE1NDViMDk5OTk0YjM1ODQyNGIxOWQiLCJwIjoiaiJ9 ) MDA-268 ( https://shibboleth.atlassian.net/browse/MDA-268?atlOrigin=eyJpIjoiNzk5NzEzMWYzNTE1NDViMDk5OTk0YjM1ODQyNGIxOWQiLCJwIjoiaiJ9 ) Remove field nulling in doDestroy methods ( https://shibboleth.atlassian.net/browse/MDA-268?atlOrigin=eyJpIjoiNzk5NzEzMWYzNTE1NDViMDk5OTk0YjM1ODQyNGIxOWQiLCJwIjoiaiJ9 )

Issue Type: Improvement Affects Versions: 0.9.2 Assignee: Ian Young ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ae127cb03-43ed-473d-b6ba-592949cb4be8 ) Created: 01/Mar/22 12:35 PM Fix Versions: 0.10.0 Priority: Trivial Reporter: Ian Young ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ae127cb03-43ed-473d-b6ba-592949cb4be8 )

A lot of the MDA beans follow a convention (from the very early days of the code) that if a bean has local fields, they should be set to null during the doDestroy method.

This is (presumably) intended to make things easier for the Java garbage collection system to free up the now unreferenced objects. I think this is both a premature optimisation and in addition making assumptions about the garbage collector that may have been true a couple of decades ago that are unlikely to be true today.

Apart from being potentially ineffective and cluttering the code, this also makes both coverage analysis and some automated code analysis more difficult. It’s also in some cases forcing fields to be non-`final` when they could be final.

This should all be stripped out. In most cases, the doDestroy method can be removed entirely. We should also check that fields are converted to final where this change means that’s possible.

( https://shibboleth.atlassian.net/browse/MDA-268#add-comment?atlOrigin=eyJpIjoiNzk5NzEzMWYzNTE1NDViMDk5OTk0YjM1ODQyNGIxOWQiLCJwIjoiaiJ9 ) Add Comment ( https://shibboleth.atlassian.net/browse/MDA-268#add-comment?atlOrigin=eyJpIjoiNzk5NzEzMWYzNTE1NDViMDk5OTk0YjM1ODQyNGIxOWQiLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100192- sha1:31e1add )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/commits/attachments/20220301/ebb2a84d/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-comment-icon-40993b17-0b1e-4f85-affb-d42b857346ba
Type: image/png
Size: 1084 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20220301/ebb2a84d/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-avatar-1d36389b-0164-4466-9985-a0ce2f2fae8f
Type: image/png
Size: 457 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20220301/ebb2a84d/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-trivial-cda19a93-94be-4c07-89f2-072ec9e82c2b
Type: image/png
Size: 563 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20220301/ebb2a84d/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-footer-desktop-logo-d1b5b2aa-b69a-4020-a255-d6faafa54d49
Type: image/png
Size: 10805 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20220301/ebb2a84d/attachment-0007.png>


More information about the commits mailing list