RFR: 8376420: Remove AppContext from javax/swing/ImageIcon.java [v2]

Alexey Ivanov aivanov at openjdk.org
Thu Jan 29 17:40:54 UTC 2026


On Wed, 28 Jan 2026 20:31:00 GMT, Phil Race <prr at openjdk.org> wrote:

>> src/java.desktop/share/classes/javax/swing/ImageIcon.java line 346:
>> 
>>> 344:     }
>>> 345: 
>>> 346:     private static final MediaTracker MEDIA_TRACKER = new MediaTracker(new Component() {});
>> 
>> Is there a particular reason to create a new anonymous class extending `Component` instead of simply instantiating?
>> 
>> 
>> new MediaTracker(new Component());
>> 
>> 
>> Is it only to follow what `createComponent` does?
>> 
>> With the removal of `AppContext` and `SecurityManager`, is the anonymous class still necessary?
>
> Component is an abstract class.

Yeah, I missed it… I should've looked more thoroughly at the declaration of the `Component` class.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29433#discussion_r2742778775


More information about the client-libs-dev mailing list