test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff test/compiler/classUnloading/anonymousClass

test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java

Print this page




   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import sun.hotspot.WhiteBox;
  25 import sun.misc.Unsafe;
  26 import sun.misc.IOUtils;
  27 
  28 import java.lang.reflect.Method;
  29 import java.net.URL;
  30 import java.net.URLConnection;
  31 
  32 /*
  33  * @test TestAnonymousClassUnloading
  34  * @bug 8054402
  35  * @summary "Tests unloading of anonymous classes."
  36  * @library /testlibrary /testlibrary/whitebox
  37  * @compile TestAnonymousClassUnloading.java
  38  * @run main ClassFileInstaller TestAnonymousClassUnloading
  39  *                              sun.hotspot.WhiteBox
  40  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  41  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-BackgroundCompilation TestAnonymousClassUnloading
  42  */
  43 public class TestAnonymousClassUnloading {
  44     private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
  45     private static final Unsafe UNSAFE = Unsafe.getUnsafe();
  46     private static int COMP_LEVEL_SIMPLE = 1;
  47     private static int COMP_LEVEL_FULL_OPTIMIZATION = 4;
  48 
  49     /**
  50      * We override hashCode here to be able to access this implementation
  51      * via an Object reference (we cannot cast to TestAnonymousClassUnloading).
  52      */
  53     @Override
  54     public int hashCode() {
  55         return 42;
  56     }
  57 
  58     /**
  59      * Does some work by using the anonymousClass.
  60      * @param anonymousClass Class performing some work (will be unloaded)




   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import jdk.testlib.WhiteBox;
  25 import sun.misc.Unsafe;
  26 import sun.misc.IOUtils;
  27 
  28 import java.lang.reflect.Method;
  29 import java.net.URL;
  30 import java.net.URLConnection;
  31 
  32 /*
  33  * @test TestAnonymousClassUnloading
  34  * @bug 8054402
  35  * @summary "Tests unloading of anonymous classes."
  36  * @library /testlibrary /../../test/lib
  37  * @compile TestAnonymousClassUnloading.java
  38  * @run main ClassFileInstaller TestAnonymousClassUnloading
  39  *                              jdk.testlib.WhiteBox
  40  *                              jdk.testlib.WhiteBox$WhiteBoxPermission
  41  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-BackgroundCompilation TestAnonymousClassUnloading
  42  */
  43 public class TestAnonymousClassUnloading {
  44     private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
  45     private static final Unsafe UNSAFE = Unsafe.getUnsafe();
  46     private static int COMP_LEVEL_SIMPLE = 1;
  47     private static int COMP_LEVEL_FULL_OPTIMIZATION = 4;
  48 
  49     /**
  50      * We override hashCode here to be able to access this implementation
  51      * via an Object reference (we cannot cast to TestAnonymousClassUnloading).
  52      */
  53     @Override
  54     public int hashCode() {
  55         return 42;
  56     }
  57 
  58     /**
  59      * Does some work by using the anonymousClass.
  60      * @param anonymousClass Class performing some work (will be unloaded)


test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File