Skip to content

Remove finalize() overrides - #48

Merged
sylvestre merged 2 commits into
opencollab:masterfrom
danilovesky:remove-split-pane-finalize
Nov 22, 2026
Merged

sylvestre merged 2 commits into
opencollab:masterfrom
danilovesky:remove-split-pane-finalize

Conversation

@danilovesky

Copy link
Copy Markdown
Contributor

Two finalize() overrides found in the source code are removed. Note that finalize() is deprecated for removal since Java 18 (JEP 421) and delays garbage collection.

  • DockingSplitPane.finalize() only called cleanup(), which frees nothing for an unreachable object. However, DefaultDockingPort already calls cleanup() when it discards a split pane.
  • The demo MediaPanel closed its JMF player in finalize(). However, the demo exits the JVM on close, which releases the player anyway.

finalize() only called cleanup(), which clears a field of an object
that is already unreachable, so it freed nothing. A finalizer delays
garbage collection, and finalize() is deprecated for removal (JEP 421).
DefaultDockingPort already calls cleanup() when it discards a split
pane.
finalize() closed the JMF player, but a finalizer may never run and
delays garbage collection, and finalize() is deprecated for removal
(JEP 421). The demo exits the JVM on close, which releases the player.
removeNotify() is no replacement: a docked panel leaves the component
tree on every redock.
@mergify

mergify Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

This pull request is merged.

@sylvestre
sylvestre merged commit e7e6447 into opencollab:master Nov 22, 2026
7 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks for your PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants