< prev index next >

test/java/lang/invoke/MethodHandlesTest.java

Print this page
rev 17241 : 8180890: move c.o.testlibrary.jsr292 classes to jdk/test/java/lang/invoke directory
Reviewed-by: duke
rev 17242 : [mq]: 8180890-1
   1 /*
   2  * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   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 /* @test
  25  * @summary unit tests for java.lang.invoke.MethodHandles
  26  * @library /lib/testlibrary /lib/testlibrary/jsr292
  27  * @compile MethodHandlesTest.java remote/RemoteExample.java
  28  * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -esa test.java.lang.invoke.MethodHandlesTest
  29  */
  30 
  31 package test.java.lang.invoke;
  32 


  33 import test.java.lang.invoke.remote.RemoteExample;
  34 import java.lang.invoke.*;
  35 import static java.lang.invoke.MethodType.methodType;



  36 import java.lang.invoke.MethodHandles.Lookup;
  37 import java.lang.reflect.*;
  38 import java.util.*;
  39 import org.junit.*;
  40 import static org.junit.Assert.*;
  41 import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;













  42 


  43 
  44 /**
  45  *
  46  * @author jrose
  47  */
  48 public class MethodHandlesTest {
  49     static final Class<?> THIS_CLASS = MethodHandlesTest.class;
  50     // How much output?
  51     static int verbosity = 0;
  52     static {
  53         String vstr = System.getProperty(THIS_CLASS.getSimpleName()+".verbosity");
  54         if (vstr == null)
  55             vstr = System.getProperty(THIS_CLASS.getName()+".verbosity");
  56         if (vstr != null)  verbosity = Integer.parseInt(vstr);
  57     }
  58 
  59     // Set this true during development if you want to fast-forward to
  60     // a particular new, non-working test.  Tests which are known to
  61     // work (or have recently worked) test this flag and return on true.
  62     static final boolean CAN_SKIP_WORKING;


   1 /*
   2  * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   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 /* @test
  25  * @summary unit tests for java.lang.invoke.MethodHandles
  26  * @library /lib/testlibrary /java/lang/invoke/common
  27  * @compile MethodHandlesTest.java remote/RemoteExample.java
  28  * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -esa test.java.lang.invoke.MethodHandlesTest
  29  */
  30 
  31 package test.java.lang.invoke;
  32 
  33 import org.junit.*;
  34 import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
  35 import test.java.lang.invoke.remote.RemoteExample;
  36 
  37 import java.lang.invoke.CallSite;
  38 import java.lang.invoke.MethodHandle;
  39 import java.lang.invoke.MethodHandleProxies;
  40 import java.lang.invoke.MethodHandles;
  41 import java.lang.invoke.MethodHandles.Lookup;
  42 import java.lang.invoke.MethodType;
  43 import java.lang.invoke.MutableCallSite;
  44 import java.lang.invoke.WrongMethodTypeException;
  45 import java.lang.reflect.Array;
  46 import java.lang.reflect.Field;
  47 import java.lang.reflect.Method;
  48 import java.lang.reflect.Modifier;
  49 import java.lang.reflect.UndeclaredThrowableException;
  50 import java.util.ArrayList;
  51 import java.util.Arrays;
  52 import java.util.Collection;
  53 import java.util.Collections;
  54 import java.util.Formatter;
  55 import java.util.HashMap;
  56 import java.util.HashSet;
  57 import java.util.List;
  58 import java.util.Map;
  59 import java.util.Set;
  60 
  61 import static java.lang.invoke.MethodType.methodType;
  62 import static org.junit.Assert.*;
  63 
  64 /**
  65  *
  66  * @author jrose
  67  */
  68 public class MethodHandlesTest {
  69     static final Class<?> THIS_CLASS = MethodHandlesTest.class;
  70     // How much output?
  71     static int verbosity = 0;
  72     static {
  73         String vstr = System.getProperty(THIS_CLASS.getSimpleName()+".verbosity");
  74         if (vstr == null)
  75             vstr = System.getProperty(THIS_CLASS.getName()+".verbosity");
  76         if (vstr != null)  verbosity = Integer.parseInt(vstr);
  77     }
  78 
  79     // Set this true during development if you want to fast-forward to
  80     // a particular new, non-working test.  Tests which are known to
  81     // work (or have recently worked) test this flag and return on true.
  82     static final boolean CAN_SKIP_WORKING;


< prev index next >