Java9下jol是不是有点坏了?

Is jol a little broken under Java9?

使用 java-9 build 9-ea+149 和 jol 0.6

运行这个简单的代码:

ArrayList<Integer> list = new ArrayList<>();
list.add(12);

System.out.println(ClassLayout.parseInstance(list).toPrintable());

输出:

  OFFSET  SIZE     TYPE DESCRIPTION                    VALUE
  0     4          (object header)                01 00 00 00 (00000001 00000000 00000000 00000000) (1)
  4     4          (object header)                00 00 00 00 (00000000 00000000 00000000 00000000) (0)
  8     4          (object header)                0e 8d 00 f8 (00001110 10001101 00000000 11111000) (-134181618)
 12     4      int AbstractList.modCount          (access denied)
 16     4      int ArrayList.size                 (access denied)
 20     4 Object[] ArrayList.elementData          (access denied)

这个拒绝访问的部分来自FieldData.java方法中的:

public String safeValue(Object object) {
    if (refField != null) {
        try {
            return ObjectUtils.safeToString(refField.get(object));
        } catch (IllegalAccessException iae) {
            // exception, try again
        }

        try {
            refField.setAccessible(true);
            return ObjectUtils.safeToString(refField.get(object));
        } catch (Exception e) {
            return "(access denied)";
        }
    } else {
        return "N/A";
    }
}

而实际的例外是:

Unable to make field protected transient int java.util.AbstractList.modCount accessible: module java.base does not "opens java.util" to unnamed module @479d31f3.

我认为这与不安全功能被锁定有关。问题是我如何将其发送到 运行?

我看过如下属性:

-XaddExports:java.base/sun.security.provider=ALL-UNNAMED

但不能真正说出它应该是什么样子。

解决方案确实是提出正确的论点..

--add-opens java.base/java.util=ALL-UNNAMED

按照建议