< prev index next >

src/jdk.unsupported/share/classes/sun/misc/Unsafe.java

Print this page
*** 642,10 ***
--- 642,13 ---
          }
          Class<?> declaringClass = f.getDeclaringClass();
          if (declaringClass.isHidden()) {
              throw new UnsupportedOperationException("can't get field offset on a hidden class: " + f);
          }
+         if (f.getDeclaringClass().isPrimitiveClass()) {
+             throw new UnsupportedOperationException("can't get field offset on an inline class: " + f);
+         }
          if (declaringClass.isRecord()) {
              throw new UnsupportedOperationException("can't get field offset on a record class: " + f);
          }
          return theInternalUnsafe.objectFieldOffset(f);
      }

*** 674,10 ***
--- 677,13 ---
          }
          Class<?> declaringClass = f.getDeclaringClass();
          if (declaringClass.isHidden()) {
              throw new UnsupportedOperationException("can't get field offset on a hidden class: " + f);
          }
+         if (f.getDeclaringClass().isPrimitiveClass()) {
+             throw new UnsupportedOperationException("can't get static field offset on an inline class: " + f);
+         }
          if (declaringClass.isRecord()) {
              throw new UnsupportedOperationException("can't get field offset on a record class: " + f);
          }
          return theInternalUnsafe.staticFieldOffset(f);
      }

*** 699,10 ***
--- 705,13 ---
          }
          Class<?> declaringClass = f.getDeclaringClass();
          if (declaringClass.isHidden()) {
              throw new UnsupportedOperationException("can't get base address on a hidden class: " + f);
          }
+         if (f.getDeclaringClass().isPrimitiveClass()) {
+             throw new UnsupportedOperationException("can't get base address on an inline class: " + f);
+         }
          if (declaringClass.isRecord()) {
              throw new UnsupportedOperationException("can't get base address on a record class: " + f);
          }
          return theInternalUnsafe.staticFieldBase(f);
      }
< prev index next >