RFR(XS): 8209736: runtime/RedefineTests/ModifyAnonymous.java fails with NullPointerException when running in CDS mode

Calvin Cheung calvin.cheung at oracle.com
Fri Aug 31 20:33:59 UTC 2018

Hi Jiangli,

On 8/31/18, 1:10 PM, Jiangli Zhou wrote:
> Hi Calvin,
> How about use a separate loop (before the main test loop in runTest()) 
> to print out the class names in the allLoadedClasses array?
  109     static void runTest() {
  110         while (!done) {
  111             Class[] allLoadedClasses = inst.getAllLoadedClasses();
  112             int len = allLoadedClasses.length;
  113             for (int idx = 0; idx < len; idx++) {

Did you mean print out all the class names after line 111? There would 
be too much output since there's a while loop enclosing it.
Or did you mean something else?
> If null is discovered, throw a RuntimeException(). That helps to 
> provide more debugging information and also will not silent the issue 
> that causes the NPE if it does' resurface again.
I don't think throwing a RuntimeException() gives anymore info than the 
existing NPE.
The idea of this change is that after a null clazz is encountered, let 
the test continue to run. It may fail in a different way which may give 
us more clues.

> Thanks,
> Jiangli
> On 8/31/18 11:33 AM, Calvin Cheung wrote:
>> bug: https://bugs.openjdk.java.net/browse/JDK-8209736
>> webrev: http://cr.openjdk.java.net/~ccheung/8209736/webrev.00/
>> The test failure is no longer reproducible; it happened only once in 
>> tier3 and once in tier6 testing.
>> This simple change is just adding a null check on the variable clazz 
>> and prints the array size and index if it is null.
>> Testing: hs-tier{1,2,3} with default CDS archive in JDK.
>> thanks,
>> Calvin

More information about the hotspot-runtime-dev mailing list