On Tue, 24 Feb 2026 17:02:27 GMT, Alexey Ivanov <[email protected]> wrote:
> During the discussions in https://github.com/openjdk/jdk/pull/29433, I looked > at the source code of `MediaTracker` and found several issues for cleaning up. > > - The `target` field in `MediaTracker` is initialised in the constructor, > it's never changed; > - The visibility of the `head` field in `MediaTracker` can be reduced to > `private`; > - The `tracker` and `ID` fields in the `MediaEntry` class are never changed > after being set in the constructor, therefore it's `final`; > - The `getID` method of `MediaEntry` should be `final`, subclasses shouldn't > be able to change the returned id; > - The fields in `ImageMediaEntry`—`image`, `width` and `height`—can also be > `final`. > - The `ImageMediaEntry` class itself is `final`. > > Additionally, I added the `@Override` annotation to overridden methods. This pull request has now been integrated. Changeset: 3e087d8e Author: Alexey Ivanov <[email protected]> URL: https://git.openjdk.org/jdk/commit/3e087d8ebd8c2f860a168b223c5f049dc1c9c068 Stats: 14 lines in 1 file changed: 4 ins; 0 del; 10 mod 8378585: Mark fields in MediaTracker final Reviewed-by: serb, prr ------------- PR: https://git.openjdk.org/jdk/pull/29899
