Last active
August 25, 2022 04:31
-
-
Save Toparvion/adec9052ad23e85e54d72b5bfb5a1aa3 to your computer and use it in GitHub Desktop.
A unit test demonstrating the difference in JOL's layout and stats graph walkers (fails on v0.16)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.openjdk.jol.info; | |
import org.junit.Assert; | |
import org.junit.Test; | |
public class WalkersDifferenceTest { | |
static class A { | |
} | |
static class B { | |
private final A[] bs; | |
B() { | |
bs = new A[] { new A() }; | |
} | |
} | |
@Test | |
public void layoutAndStatsDifference() { | |
B b = new B(); | |
GraphLayout layout = GraphLayout.parseInstance(b); | |
GraphStats stats = GraphStats.parseInstance(b); | |
Assert.assertEquals(layout.totalSize(), stats.totalSize()); | |
Assert.assertEquals(layout.totalCount(), stats.totalCount()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment