RFR: make FieldLayout#data() public

Aleksey Shipilev shade at openjdk.java.net
Thu Nov 11 00:00:01 UTC 2021


On Tue, 9 Nov 2021 17:25:17 GMT, Ivan Ponomarev <duke at openjdk.java.net> wrote:

> Can we have this property public? This is needed for https://github.com/atp-mipt/ljv visualizer: we can use JOL to get object fields in consistent order, but then we also need `FieldData` itself in order to get fields' values

I want to keep the API as narrow as possible, I am sure you understand.
Do you need `data()` accessor now? Do you need `refField()` accessor?
Can you pseudo-code or point the usage example?

Maybe it would be better to provide the specific accessor, like: 

Object value(Object instance) { 
  if (instance == null) {
     return null;
  }
  return ObjectUtils.value(instance, f);
}


Also, LJV seems to overlap with JOL quite significantly, so maybe it would be even better to merge LJV into JOL, so that it can get whatever JOL internals it needs ;)

-------------

PR: https://git.openjdk.java.net/jol/pull/19


More information about the jol-dev mailing list