Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions src/java.base/share/classes/jdk/internal/access/JavaAWTAccess.java

This file was deleted.

11 changes: 0 additions & 11 deletions src/java.base/share/classes/jdk/internal/access/SharedSecrets.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ interface and provides the ability to call package-private methods
*/

public class SharedSecrets {
private static JavaAWTAccess javaAWTAccess;
private static JavaAWTFontAccess javaAWTFontAccess;
private static JavaBeansAccess javaBeansAccess;
private static JavaLangAccess javaLangAccess;
Expand Down Expand Up @@ -321,16 +320,6 @@ public static void setJavaUtilZipFileAccess(JavaUtilZipFileAccess access) {
javaUtilZipFileAccess = access;
}

public static void setJavaAWTAccess(JavaAWTAccess jaa) {
javaAWTAccess = jaa;
}

public static JavaAWTAccess getJavaAWTAccess() {
// this may return null in which case calling code needs to
// provision for.
return javaAWTAccess;
}

public static void setJavaAWTFontAccess(JavaAWTFontAccess jafa) {
javaAWTFontAccess = jafa;
}
Expand Down
63 changes: 0 additions & 63 deletions src/java.desktop/share/classes/sun/awt/AppContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
import java.beans.PropertyChangeListener;
import java.lang.ref.SoftReference;

import jdk.internal.access.JavaAWTAccess;
import jdk.internal.access.SharedSecrets;
import sun.util.logging.PlatformLogger;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
Expand Down Expand Up @@ -746,67 +744,6 @@ public synchronized PropertyChangeListener[] getPropertyChangeListeners(
return changeSupport.getPropertyChangeListeners(propertyName);
}

// Set up JavaAWTAccess in SharedSecrets
static {
SharedSecrets.setJavaAWTAccess(new JavaAWTAccess() {
private boolean hasRootThreadGroup(final AppContext ecx) {
return ecx.threadGroup.getParent() == null;
}

/**
* Returns the AppContext used for applet logging isolation, or null if
* the default global context can be used.
* If there's no applet, or if the caller is a stand alone application,
* or running in the main app context, returns null.
* Otherwise, returns the AppContext of the calling applet.
* @return null if the global default context can be used,
* an AppContext otherwise.
**/
public Object getAppletContext() {
// There's no AppContext: return null.
// No need to call getAppContext() if numAppContext == 0:
// it means that no AppContext has been created yet, and
// we don't want to trigger the creation of a main app
// context since we don't need it.
if (numAppContexts.get() == 0) return null;

AppContext ecx = null;

// Not sure we really need to re-check numAppContexts here.
// If all applets have gone away then we could have a
// numAppContexts coming back to 0. So we recheck
// it here because we don't want to trigger the
// creation of a main AppContext in that case.
// This is probably not 100% MT-safe but should reduce
// the window of opportunity in which that issue could
// happen.
if (numAppContexts.get() > 0) {
// Defaults to thread group caching.
// This is probably not required as we only really need
// isolation in a deployed applet environment, in which
// case ecx will not be null when we reach here
// However it helps emulate the deployed environment,
// in tests for instance.
ecx = ecx != null ? ecx : getAppContext();
}

// getAppletContext() may be called when initializing the main
// app context - in which case mainAppContext will still be
// null. To work around this issue we simply use
// AppContext.threadGroup.getParent() == null instead, since
// mainAppContext is the only AppContext which should have
// the root TG as its thread group.
// See: JDK-8023258
final boolean isMainAppContext = ecx == null
|| mainAppContext == ecx
|| mainAppContext == null && hasRootThreadGroup(ecx);

return isMainAppContext ? null : ecx;
}

});
}

public static <T> T getSoftReferenceValue(Object key,
Supplier<T> supplier) {

Expand Down
Loading