< prev index next >

src/java.base/share/classes/jdk/internal/misc/InnocuousThread.java

Print this page
@@ -181,28 +181,30 @@
              INHERITEDACCESSCONTROLCONTEXT = UNSAFE.objectFieldOffset
                  (tk, "inheritedAccessControlContext");
              CONTEXTCLASSLOADER = UNSAFE.objectFieldOffset
                  (tk, "contextClassLoader");
  
-             long tg = UNSAFE.objectFieldOffset(tk, "group");
              long gp = UNSAFE.objectFieldOffset(gk, "parent");
-             ThreadGroup group = (ThreadGroup)
-                 UNSAFE.getReference(Thread.currentThread(), tg);
+             ThreadGroup group = Thread.currentThread().getThreadGroup();
  
              while (group != null) {
                  ThreadGroup parent = (ThreadGroup)UNSAFE.getReference(group, gp);
                  if (parent == null)
                      break;
                  group = parent;
              }
              final ThreadGroup root = group;
+ 
              if (System.getSecurityManager() == null) {
-                 INNOCUOUSTHREADGROUP = new ThreadGroup(root, "InnocuousThreadGroup");
+                 @SuppressWarnings("deprecation")
+                 ThreadGroup g = new ThreadGroup(root, "InnocuousThreadGroup");
+                 INNOCUOUSTHREADGROUP = g;
              } else {
                  INNOCUOUSTHREADGROUP = AccessController.doPrivileged(
                      new PrivilegedAction<ThreadGroup>() {
                          @Override
+                         @SuppressWarnings("deprecation")
                          public ThreadGroup run() {
                              return new ThreadGroup(root, "InnocuousThreadGroup");
                          }
                      });
              }
< prev index next >