hotspot/test/serviceability/dcmd/ClassLoaderStatsTest.java
author iignatyev
Sat, 19 Jul 2014 00:34:20 +0400
changeset 25736 6f35dbe32581
parent 25051 8110ec6e7340
permissions -rw-r--r--
8032449: Get rid of JMX in test/compiler Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25051
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
     1
/*
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
     4
 *
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
     8
 *
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    13
 * accompanied this code).
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    14
 *
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    18
 *
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    21
 * questions.
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    22
 */
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    23
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    24
/*
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    25
 * @test
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    26
 *
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    27
 * @build ClassLoaderStatsTest DcmdUtil
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    28
 * @run main ClassLoaderStatsTest
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    29
 */
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    30
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    31
import java.io.BufferedReader;
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    32
import java.io.File;
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    33
import java.io.FileInputStream;
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    34
import java.io.IOException;
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    35
import java.io.StringReader;
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    36
import java.nio.ByteBuffer;
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    37
import java.nio.channels.FileChannel;
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    38
import java.util.regex.Matcher;
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    39
import java.util.regex.Pattern;
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    40
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    41
public class ClassLoaderStatsTest {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    42
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    43
    // ClassLoader         Parent              CLD*               Classes   ChunkSz   BlockSz  Type
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    44
    // 0x00000007c0215928  0x0000000000000000  0x0000000000000000       0         0         0  org.eclipse.osgi.baseadaptor.BaseAdaptor$1
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    45
    // 0x00000007c0009868  0x0000000000000000  0x00007fc52aebcc80       1      6144      3768  sun.reflect.DelegatingClassLoader
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    46
    // 0x00000007c0009868  0x0000000000000000  0x00007fc52b8916d0       1      6144      3688  sun.reflect.DelegatingClassLoader
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    47
    // 0x00000007c0009868  0x00000007c0038ba8  0x00007fc52afb8760       1      6144      3688  sun.reflect.DelegatingClassLoader
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    48
    // 0x00000007c0009868  0x0000000000000000  0x00007fc52afbb1a0       1      6144      3688  sun.reflect.DelegatingClassLoader
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    49
    // 0x0000000000000000  0x0000000000000000  0x00007fc523416070    5019  30060544  29956216  <boot classloader>
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    50
    //                                                                455   1210368    672848   + unsafe anonymous classes
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    51
    // 0x00000007c016b5c8  0x00000007c0038ba8  0x00007fc52a995000       5      8192      5864  org.netbeans.StandardModule$OneModuleClassLoader
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    52
    // 0x00000007c0009868  0x00000007c016b5c8  0x00007fc52ac13640       1      6144      3896  sun.reflect.DelegatingClassLoader
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    53
    // ...
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    54
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    55
    static Pattern clLine = Pattern.compile("0x\\p{XDigit}*\\s*0x\\p{XDigit}*\\s*0x\\p{XDigit}*\\s*(\\d*)\\s*(\\d*)\\s*(\\d*)\\s*(.*)");
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    56
    static Pattern anonLine = Pattern.compile("\\s*(\\d*)\\s*(\\d*)\\s*(\\d*)\\s*.*");
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    57
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    58
    public static DummyClassLoader dummyloader;
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    59
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    60
    public static void main(String arg[]) throws Exception {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    61
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    62
        // create a classloader and load our special class
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    63
        dummyloader = new DummyClassLoader();
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    64
        Class<?> c = Class.forName("TestClass", true, dummyloader);
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    65
        if (c.getClassLoader() != dummyloader) {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    66
            throw new RuntimeException("TestClass defined by wrong classloader: " + c.getClassLoader());
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    67
        }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    68
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    69
        String result = DcmdUtil.executeDcmd("VM.classloader_stats");
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    70
        BufferedReader r = new BufferedReader(new StringReader(result));
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    71
        String line;
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    72
        while((line = r.readLine()) != null) {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    73
            Matcher m = clLine.matcher(line);
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    74
            if (m.matches()) {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    75
                // verify that DummyClassLoader has loaded 1 class and 1 anonymous class
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    76
                if (m.group(4).equals("ClassLoaderStatsTest$DummyClassLoader")) {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    77
                    System.out.println("line: " + line);
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    78
                    if (!m.group(1).equals("1")) {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    79
                        throw new Exception("Should have loaded 1 class: " + line);
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    80
                    }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    81
                    checkPositiveInt(m.group(2));
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    82
                    checkPositiveInt(m.group(3));
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    83
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    84
                    String next = r.readLine();
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    85
                    System.out.println("next: " + next);
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    86
                    Matcher m1 = anonLine.matcher(next);
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    87
                    m1.matches();
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    88
                    if (!m1.group(1).equals("1")) {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    89
                        throw new Exception("Should have loaded 1 anonymous class, but found : " + m1.group(1));
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    90
                    }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    91
                    checkPositiveInt(m1.group(2));
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    92
                    checkPositiveInt(m1.group(3));
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    93
                }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    94
            }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    95
        }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    96
    }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    97
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    98
    private static void checkPositiveInt(String s) throws Exception {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
    99
        if (Integer.parseInt(s) <= 0) {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   100
            throw new Exception("Value should have been > 0: " + s);
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   101
        }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   102
    }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   103
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   104
    public static class DummyClassLoader extends ClassLoader {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   105
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   106
        public static final String CLASS_NAME = "TestClass";
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   107
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   108
        static ByteBuffer readClassFile(String name)
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   109
        {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   110
            File f = new File(System.getProperty("test.classes", "."),
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   111
                              name);
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   112
            try (FileInputStream fin = new FileInputStream(f);
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   113
                 FileChannel fc = fin.getChannel())
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   114
            {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   115
                return fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   116
            } catch (IOException e) {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   117
                throw new RuntimeException("Can't open file: " + name, e);
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   118
            }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   119
        }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   120
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   121
        protected Class<?> loadClass(String name, boolean resolve)
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   122
            throws ClassNotFoundException
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   123
        {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   124
            Class<?> c;
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   125
            if (!"TestClass".equals(name)) {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   126
                c = super.loadClass(name, resolve);
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   127
            } else {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   128
                // should not delegate to the system class loader
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   129
                c = findClass(name);
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   130
                if (resolve) {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   131
                    resolveClass(c);
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   132
                }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   133
            }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   134
            return c;
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   135
        }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   136
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   137
        protected Class<?> findClass(String name)
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   138
            throws ClassNotFoundException
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   139
        {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   140
            if (!"TestClass".equals(name)) {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   141
                throw new ClassNotFoundException("Unexpected class: " + name);
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   142
            }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   143
            return defineClass(name, readClassFile(name + ".class"), null);
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   144
        }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   145
    } /* DummyClassLoader */
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   146
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   147
}
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   148
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   149
class TestClass {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   150
    static {
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   151
        // force creation of anonymous class (for the lambdaform)
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   152
        Runnable r = () -> System.out.println("Hello");
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   153
        r.run();
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   154
    }
8110ec6e7340 8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
diff changeset
   155
}