8375350: Remove usage of AppContext from javax.imageio implementation

Reviewed-by: kizune, dnguyen
This commit is contained in:
Phil Race 2026-01-16 00:47:24 +00:00
parent 1d889b92bd
commit fddba3b7ec

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -47,7 +47,6 @@ import javax.imageio.spi.ImageTranscoderSpi;
import javax.imageio.spi.ServiceRegistry;
import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream;
import sun.awt.AppContext;
/**
* A class containing static convenience methods for locating
@ -108,9 +107,7 @@ public final class ImageIO {
// ImageInputStreams
/**
* A class to hold information about caching. Each
* {@code ThreadGroup} will have its own copy
* via the {@code AppContext} mechanism.
* A class to hold information about caching.
*/
static class CacheInfo {
boolean useCache = true;
@ -144,17 +141,12 @@ public final class ImageIO {
}
}
private static final CacheInfo info = new CacheInfo();
/**
* Returns the {@code CacheInfo} object associated with this
* {@code ThreadGroup}.
* Returns the {@code CacheInfo} object.
*/
private static synchronized CacheInfo getCacheInfo() {
AppContext context = AppContext.getAppContext();
CacheInfo info = (CacheInfo)context.get(CacheInfo.class);
if (info == null) {
info = new CacheInfo();
context.put(CacheInfo.class, info);
}
return info;
}