RFR: 8055461: getNextID in ImageIcon class can lead to overflow

Prasanta Sadhukhan psadhukhan at openjdk.org
Wed Jun 11 13:28:29 UTC 2025


On Wed, 11 Jun 2025 12:46:54 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

> With the change that you propose, it will be impossible to load images with `ImageIcon` once the value of `mediaTrackerId` reaches `Integer.MAX_VALUE`.

OK.

> I think a better solution is to create a new MediaTracker, and start anew with id of zero.

So, we need to have mediaTrackerID1 and use that but then what about when next Integer.MAX_VALUE is reached, create another MediaTracker and again use another mediaTrackerID2 ? it will be a loop then...
Won;t it better and simpler to make the id "long" which will make it use 2*64 images in one application?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25666#issuecomment-2962704818


More information about the client-libs-dev mailing list