RFR: Extend API to support JOL IntelliJ Idea plugin
Aleksey Shipilev
shade at openjdk.java.net
Tue Oct 6 14:55:18 UTC 2020
On Thu, 1 Oct 2020 09:27:59 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> [JOL Intellij Idea Plugin](https://github.com/stokito/IdeaJol) internally uses JOL.
>> Internally in the
>> [PsiClassAdapter](https://github.com/stokito/IdeaJol/blob/master/src/main/java/com/github/stokito/IdeaJol/PsiClassAdapter.java)
>> it makes exactly the same as `org.openjdk.jol.info.ClassData#parse` but it creates the ClassData from Idea's AST/Psi
>> tree instead of raw `Class`. Unfortunately to be able to do this we need to extend API a little bit. Here is a short
>> list of changes that I did: 1. Added an overloaded method ClassData.addSuperClassData(ClassData) so I can create an
>> instance of `ClassData` 2. Added `lossesInternal`, `lossesExternal` and `lossesTotal` fields to `ClassLayout` so they
>> calculated only once on instance creation and then can be accessed multiple times via geters by JTable 3.
>> `FieldData.create()` internally evaluate if the field is contended but we do this based on Psi tree. So we need to open
>> and make public the `FieldData` constructor.
>
> This looks fine. Again, I'll integrate once OCA and other integration blockers resolve and bots allow me to integrate.
@stokito, could you please merge/rebase off the current `master`? It includes the automatically-triggered workflow with
pre-integration checks.
> jol-core/src/main/java/org/openjdk/jol/info/ClassLayout.java line 130:
>
>> 128: * @param check whether to check important invariants
>> 129: */
>> 130: public static ClassLayout createClassLayout(ClassData classData, SortedSet<FieldLayout> fields, int
>> headerSize, long instanceSize, boolean check) {
>
> `ClassLayout.createClassLayout` seems tautological, maybe `ClassLayout.create`?
This also matches e.g. `FieldData.create`.
-------------
PR: https://git.openjdk.java.net/jol/pull/4
More information about the jol-dev
mailing list