/libcore/luni/src/test/java/libcore/java/lang/invoke/ |
D | MethodHandleCombinersTest.java | 21 import java.lang.invoke.MethodHandles; 34 MethodHandle handle = MethodHandles.throwException(String.class, in testThrowException() 59 MethodHandle delegate = MethodHandles.lookup().findStatic(MethodHandleCombinersTest.class, in testDropArguments() 63 MethodHandle transform = MethodHandles.dropArguments( in testDropArguments() 77 transform = MethodHandles.dropArguments(delegate, 1, int.class, Object.class); in testDropArguments() 82 transform = MethodHandles.dropArguments(delegate, 2, int.class, Object.class); in testDropArguments() 98 transform = MethodHandles.dropArguments(delegate, 0, int.class, Object.class); in testDropArguments() 105 MethodHandles.dropArguments(delegate, -1, int.class, Object.class); in testDropArguments() 112 MethodHandles.dropArguments(delegate, 3, int.class, Object.class); in testDropArguments() 118 MethodHandles.dropArguments(delegate, 1, void.class); in testDropArguments() [all …]
|
D | MethodHandlesTest.java | 23 import java.lang.invoke.MethodHandles; 24 import java.lang.invoke.MethodHandles.Lookup; 38 import static java.lang.invoke.MethodHandles.Lookup.*; 44 MethodHandles.Lookup publicLookup = MethodHandles.publicLookup(); in test_publicLookupClassAndModes() 50 MethodHandles.Lookup defaultLookup = MethodHandles.lookup(); in test_defaultLookupClassAndModes() 56 MethodHandles.Lookup defaultLookup = MethodHandles.lookup(); in test_LookupIn() 60 MethodHandles.Lookup siblingLookup = defaultLookup.in(PackageSibling.class); in test_LookupIn() 65 MethodHandles.Lookup nonSibling = defaultLookup.in(Vector.class); in test_LookupIn() 69 MethodHandles.Lookup inner2 = Inner1.lookup.in(Inner2.class); in test_LookupIn() 73 MethodHandles.lookup().in(null); in test_LookupIn() [all …]
|
D | CallSitesTest.java | 24 import java.lang.invoke.MethodHandles; 25 import java.lang.invoke.MethodHandles.Lookup; 31 import static java.lang.invoke.MethodHandles.Lookup.*; 44 return MethodHandles.lookup().findStatic(CallSitesTest.class, "add2", mt); in methodHandleForAdd2() 67 return MethodHandles.lookup().findStatic(CallSitesTest.class, "add2", add2MethodType); in createTargetHook() 75 MethodHandles.lookup().findStatic(OurConstantCallSite.class, "createTargetHook", in test_ConstantCallSiteWithHook() 122 MethodHandles.lookup().findStatic(CallSitesTest.class, "add3", mt_add3); in test_MutableCallSite() 134 MethodHandles.lookup().findStatic(CallSitesTest.class, "sub2", in test_MutableCallSite() 180 MethodHandles.lookup().findStatic(CallSitesTest.class, "add3", mt_add3); in test_VolatileCallSite() 193 MethodHandles.lookup().findStatic(CallSitesTest.class, "sub2", in test_VolatileCallSite() [all …]
|
/libcore/ojluni/src/test/java/lang/invoke/ |
D | TryFinallyTest.java | 34 import java.lang.invoke.MethodHandles; 35 import java.lang.invoke.MethodHandles.Lookup; 49 static final Lookup LOOKUP = MethodHandles.lookup(); 53 MethodHandle hello = MethodHandles.tryFinally(TryFinally.MH_greet, TryFinally.MH_exclaim); in testTryFinally() 75 MethodHandle identity = MethodHandles.identity(argType); in testTryFinally() 76 MethodHandle tryFinally = MethodHandles.tryFinally( in testTryFinally() 78 MethodHandles.dropArguments(identity, 0, Throwable.class)); in testTryFinally() 86 MethodHandle tryFinally = MethodHandles.tryFinally( in testTryFinallyException() 88 MethodHandles.dropArguments(identity, 0, TryFinally.T1.class)); in testTryFinallyException() 95 … MethodHandle tfVoid = MethodHandles.tryFinally(TryFinally.MH_print, TryFinally.MH_printMore); in testTryFinallyVoid() [all …]
|
D | PermuteArgsReturnVoidTest.java | 37 import java.lang.invoke.MethodHandles; 40 import static java.lang.invoke.MethodHandles.dropArguments; 41 import static java.lang.invoke.MethodHandles.identity; 54 MethodHandles.Lookup l = MethodHandles.lookup(); in testReturnOnStack() 63 MethodHandle f = MethodHandles.foldArguments(consumeIdentity, consumeVoid); in testReturnOnStack() 65 …MethodHandle p = MethodHandles.permuteArguments(f, MethodType.methodType(String.class, String.clas… in testReturnOnStack() 74 MethodHandles.Lookup l = MethodHandles.lookup(); in testReturnFromArg() 82 MethodHandle f = MethodHandles.foldArguments(consumeIdentity, consumeVoid); in testReturnFromArg() 84 …MethodHandle p = MethodHandles.permuteArguments(f, MethodType.methodType(String.class, String.clas… in testReturnFromArg()
|
D | LoopCombinatorTest.java | 43 import java.lang.invoke.MethodHandles; 44 import java.lang.invoke.MethodHandles.Lookup; 59 static final Lookup LOOKUP = MethodHandles.lookup(); 65 MethodHandle loop = MethodHandles.loop(counterClause, accumulatorClause); in testLoopFac() 75 MethodHandle loop = MethodHandles.loop(counterClause, accumulatorClause); in testLoopFacNullInit() 84 MethodHandle loop = MethodHandles.loop(counterClause); in testLoopNullInit() 92 …MethodHandle loop = MethodHandles.loop(new MethodHandle[]{Empty.MH_f, Empty.MH_f, Empty.MH_pred, n… in testLoopVoid1() 101 … MethodHandle loop = MethodHandles.loop(new MethodHandle[]{null, Empty.MH_f, Empty.MH_pred, null}); in testLoopVoid2() 110 …MethodHandle loop = MethodHandles.loop(new MethodHandle[]{null, Empty.MH_f, Empty.MH_pred, Empty.M… in testLoopVoid3() 121 MethodHandle loop = MethodHandles.loop(counterClause, accumulatorClause, dotClause); in testLoopFacWithVoidState() [all …]
|
D | ArrayLengthTest.java | 32 import java.lang.invoke.MethodHandles; 58 MethodHandle arrayLength = MethodHandles.arrayLength(arrayClass); in testArrayLength() 61 Object array = MethodHandles.arrayConstructor(arrayClass).invoke(10); in testArrayLength() 67 MethodHandle arrayLength = MethodHandles.arrayLength(arrayClass); in testArrayLengthInvokeNPE() 73 MethodHandles.arrayLength(String.class); in testArrayLengthNoArray() 78 MethodHandles.arrayLength(null); in testArrayLengthNPE() 83 MethodHandle arrayLength = MethodHandles.arrayLength(String[].class); in testNullReference()
|
D | DropArgumentsTest.java | 34 import java.lang.invoke.MethodHandles; 38 import static java.lang.invoke.MethodHandles.*; 49 MethodHandle d0 = MethodHandles.dropArgumentsToMatch(cat, 0, bigType.parameterList(), 3); in testDropArgumentsToMatch() 51 MethodHandle d1 = MethodHandles.dropArgumentsToMatch(cat, 0, bigType.parameterList(), 0); in testDropArgumentsToMatch() 53 MethodHandle d2 = MethodHandles.dropArgumentsToMatch(cat, 1, bigType.parameterList(), 4); in testDropArgumentsToMatch() 71 MethodHandles.dropArgumentsToMatch(target, pos, valueType , skip); in dropArgumentsToMatchNPE() 91 MethodHandles.dropArgumentsToMatch(target, pos, valueType , skip); in dropArgumentsToMatchIAE() 100 …MethodHandle handle2 = MethodHandles.dropArgumentsToMatch(cat, 0, bigTypewithVoid.parameterList(),… in dropArgumentsToMatchTestWithVoid() 117 MethodHandle mh1 = MethodHandles.lookup().findStatic(MethodSet.class, "mVoid", in dropArgumentsToMatchPosSkipRange() 123 MethodHandle mh2 = MethodHandles.lookup().findStatic(MethodSet.class, "mVoid", in dropArgumentsToMatchPosSkipRange()
|
D | ConstantIdentityMHTest.java | 33 import java.lang.invoke.MethodHandles; 36 import static java.lang.invoke.MethodHandles.*; 61 assertEquals(MethodHandles.zero(expectedtype).type().toString(), expected); in testZero() 67 MethodHandle mh = MethodHandles.zero(null); in testZeroNPE() 74 MethodHandle mhEmpty = MethodHandles.empty(cat.type()); in testEmpty() 81 MethodHandle lenEmptyMH = MethodHandles.empty(null); in testEmptyNPE()
|
D | ArrayConstructorTest.java | 33 import java.lang.invoke.MethodHandles; 44 static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); 72 MethodHandle h = MethodHandles.arrayConstructor(clazz); in testArrayConstructorNegative() 85 MethodHandle h = MethodHandles.arrayConstructor(String[].class); in testArrayConstructor() 93 MethodHandle h = MethodHandles.arrayConstructor(String[].class); in testArrayConstructorNegativeIndex()
|
D | CountedLoopIterationCountsTest.java | 34 import java.lang.invoke.MethodHandles; 61 MethodHandle loop = MethodHandles.countedLoop( in run() 62 … MethodHandles.constant(int.class, start), // iterate from given start (inclusive) ... in run() 63 MethodHandles.constant(int.class, end), // ... to given end (exclusive) in run() 82 MH_m1 = MethodHandles.constant(int.class, -1); 83 … MH_step = MethodHandles.lookup().findStatic(CountedLoopIterationCountsTest.class, "step",
|
D | FoldTest.java | 35 import java.lang.invoke.MethodHandles; 36 import java.lang.invoke.MethodHandles.Lookup; 50 static final Lookup LOOKUP = MethodHandles.lookup(); 55 MethodHandle fold = MethodHandles.foldArguments(Fold.MH_multer, 0, Fold.MH_adder); in testFold0a() 63 MethodHandle fold = MethodHandles.foldArguments(Fold.MH_multer, 1, Fold.MH_adder1); in testFold1a() 71 MethodHandle fold = MethodHandles.foldArguments(Fold.MH_str, 0, Fold.MH_comb); in testFold0b() 79 MethodHandle fold = MethodHandles.foldArguments(Fold.MH_str, 1, Fold.MH_comb2); in testFold1b() 92 MethodHandle catTrace = MethodHandles.foldArguments(cat, 1, trace); in testFoldArgumentsExample()
|
D | JavaDocExamplesTest.java | 34 import static java.lang.invoke.MethodHandles.*; 180 static Lookup lookup() { return MethodHandles.lookup(); } in lookup() 250 MethodHandle mh1 = MethodHandles.explicitCastArguments(MethodHandles.constant(Object.class, null), … in testZero() 252 MethodHandle mh2 = MethodHandles.empty(methodType(type)); in testZero() 374 MethodHandles.Lookup lookup = MethodHandles.lookup(); in testMethodHandlesSummary() 599 MethodHandle MH_upcase = MethodHandles.lookup() in testMutableCallSite() 601 MethodHandle worker1 = MethodHandles.filterReturnValue(MH_name, MH_upcase); in testMutableCallSite() 602 name.setTarget(MethodHandles.constant(String.class, "Rocky")); in testMutableCallSite() 604 name.setTarget(MethodHandles.constant(String.class, "Fred")); in testMutableCallSite() 616 MethodHandle MH_dear = MethodHandles.insertArguments(MH_cat, 1, ", dear?"); in testMutableCallSite() [all …]
|
/libcore/ojluni/src/test/java/lang/invoke/MethodHandles/ |
D | TestTableSwitch.java | 25 package test.java.lang.invoke.MethodHandles; 36 import java.lang.invoke.MethodHandles; 52 MethodHandles.Lookup lookup = MethodHandles.lookup(); 67 return MethodHandles.dropArguments(MethodHandles.constant(type, value), 0, int.class); in simpleTestCase() 138 collector = MethodHandles.insertArguments(collector, 0, testArguments); in testNonVoidHandles() 143 defaultCase = MethodHandles.collectArguments(defaultCase, 1, collector); in testNonVoidHandles() 150 theCase = MethodHandles.collectArguments(theCase, 1, collector); in testNonVoidHandles() 154 MethodHandle mhSwitch = MethodHandles.tableSwitch( in testNonVoidHandles() 179 MethodHandle mhSwitch = MethodHandles.tableSwitch( in testVoidHandles() 194 MethodHandles.tableSwitch(null, simpleTestCase("test")); in testNullDefaultHandle() [all …]
|
D | TestDropReturn.java | 25 package test.java.lang.invoke.MethodHandles; 37 import java.lang.invoke.MethodHandles; 46 MethodHandle mh = MethodHandles.identity(cls); in testDropReturn() 51 mh = MethodHandles.dropReturn(mh); in testDropReturn()
|
/libcore/ojluni/src/test/java/lang/invoke/VarHandles/ |
D | VarHandleTestReflection.java | 37 import java.lang.invoke.MethodHandles; 53 return MethodHandles.lookup(). in handle() 73 MethodHandle mh = MethodHandles.lookup().unreflect( in methodHandleInvoke() 87 MethodHandle mh = MethodHandles.lookup().unreflect( in methodInvocationFromMethodInfo() 89 MethodHandleInfo info = MethodHandles.lookup().revealDirect(mh); in methodInvocationFromMethodInfo() 90 Method im = info.reflectAs(Method.class, MethodHandles.lookup()); in methodInvocationFromMethodInfo() 98 MethodHandle mh = MethodHandles.varHandleInvoker( in reflectAsFromVarHandleInvoker() 101 MethodHandleInfo info = MethodHandles.lookup().revealDirect(mh); in reflectAsFromVarHandleInvoker() 103 info.reflectAs(Method.class, MethodHandles.lookup()); in reflectAsFromVarHandleInvoker() 110 MethodHandle mh = MethodHandles.publicLookup().findVirtual( in reflectAsFromFindVirtual() [all …]
|
/libcore/ojluni/src/main/java/java/lang/invoke/ |
D | ConstantBootstraps.java | 92 public static Object nullConstant(MethodHandles.Lookup lookup, String name, Class<?> type) { in nullConstant() 111 public static Class<?> primitiveClass(MethodHandles.Lookup lookup, String name, Class<?> type) { in primitiveClass() 144 …public static <E extends Enum<E>> E enumConstant(MethodHandles.Lookup lookup, String name, Class<E… in enumConstant() 168 public static Object getStaticFinal(MethodHandles.Lookup lookup, String name, Class<?> type, in getStaticFinal() 224 public static Object getStaticFinal(MethodHandles.Lookup lookup, String name, Class<?> type) { in getStaticFinal() 258 public static Object invoke(MethodHandles.Lookup lookup, String name, Class<?> type, in invoke() 289 …public static VarHandle fieldVarHandle(MethodHandles.Lookup lookup, String name, Class<VarHandle> … in fieldVarHandle() 323 …public static VarHandle staticFieldVarHandle(MethodHandles.Lookup lookup, String name, Class<VarHa… in staticFieldVarHandle() 355 …public static VarHandle arrayVarHandle(MethodHandles.Lookup lookup, String name, Class<VarHandle> … in arrayVarHandle() 364 return MethodHandles.arrayElementVarHandle(validateClassAccess(lookup, arrayClass)); in arrayVarHandle() [all …]
|
D | CallSite.java | 31 import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; 112 this.target = MethodHandles.throwException(type.returnType(), IllegalStateException.class); in CallSite() 113 this.target = MethodHandles.insertArguments( in CallSite() 116 this.target = MethodHandles.dropArguments(this.target, 0, type.ptypes()); in CallSite() 237 MethodHandle invoker = MethodHandles.exactInvoker(this.type()); in makeDynamicInvoker() 238 return MethodHandles.foldArguments(invoker, getTarget); in makeDynamicInvoker()
|
/libcore/ojluni/src/main/java/java/lang/runtime/ |
D | ObjectMethods.java | 30 import java.lang.invoke.MethodHandles; 55 private static final MethodHandle FALSE = MethodHandles.constant(boolean.class, false); 56 private static final MethodHandle TRUE = MethodHandles.constant(boolean.class, true); 57 private static final MethodHandle ZERO = MethodHandles.constant(int.class, 0); 76 MethodHandles.Lookup publicLookup = MethodHandles.publicLookup(); 77 MethodHandles.Lookup lookup = MethodHandles.lookup(); 211 …MethodHandle instanceFalse = MethodHandles.dropArguments(FALSE, 0, receiverClass, Object.class); /… in makeEquals() 212 …MethodHandle instanceTrue = MethodHandles.dropArguments(TRUE, 0, receiverClass, Object.class); // … in makeEquals() 214 …MethodHandle isInstance = MethodHandles.dropArguments(CLASS_IS_INSTANCE.bindTo(receiverClass), 0, … in makeEquals() 215 …MethodHandle accumulator = MethodHandles.dropArguments(TRUE, 0, receiverClass, receiverClass); // … in makeEquals() [all …]
|
/libcore/ojluni/src/test/java/lang/invoke/VarHandles/accessibility/ |
D | TestFieldLookupAccessibility.java | 41 import java.lang.invoke.MethodHandles; 58 Object lookup(MethodHandles.Lookup l, Field f) throws Exception { in MH_GETTER() 67 Object lookup(MethodHandles.Lookup l, Field f) throws Exception { in MH_SETTER() 76 Object lookup(MethodHandles.Lookup l, Field f) throws Exception { in MH_STATIC_GETTER() 85 Object lookup(MethodHandles.Lookup l, Field f) throws Exception { in MH_STATIC_SETTER() 94 Object lookup(MethodHandles.Lookup l, Field f) throws Exception { in MH_UNREFLECT_GETTER() 99 Object lookup(MethodHandles.Lookup l, Field f) throws Exception { in MH_UNREFLECT_GETTER_ACCESSIBLE() 104 Object lookup(MethodHandles.Lookup l, Field f) throws Exception { in MH_UNREFLECT_SETTER() 113 Object lookup(MethodHandles.Lookup l, Field f) throws Exception { in MH_UNREFLECT_SETTER_ACCESSIBLE() 118 Object lookup(MethodHandles.Lookup l, Field f) throws Exception { in VH() [all …]
|
/libcore/ojluni/src/test/java/lang/invoke/VarHandles/accessibility/pkg/ |
D | C.java | 27 import java.lang.invoke.MethodHandles; 31 public static MethodHandles.Lookup lookup() { in lookup() 32 return MethodHandles.lookup(); in lookup()
|
D | B_extends_A.java | 27 import java.lang.invoke.MethodHandles; 31 public static MethodHandles.Lookup lookup() { in lookup() 32 return MethodHandles.lookup(); in lookup()
|
/libcore/ojluni/src/test/java/lang/invoke/VarHandles/accessibility/pkg/subpkg/ |
D | C.java | 27 import java.lang.invoke.MethodHandles; 31 public static MethodHandles.Lookup lookup() { in lookup() 32 return MethodHandles.lookup(); in lookup()
|
D | B_extends_A.java | 29 import java.lang.invoke.MethodHandles; 33 public static MethodHandles.Lookup lookup() { in lookup() 34 return MethodHandles.lookup(); in lookup()
|
/libcore/luni/src/test/java/libcore/sun/invoke/util/ |
D | VerifyAccessTest.java | 24 import java.lang.invoke.MethodHandles; 38 MethodHandles.Lookup.PACKAGE)); in testIsClassAccessible() 40 MethodHandles.Lookup.PACKAGE)); in testIsClassAccessible() 44 MethodHandles.Lookup.PACKAGE)); in testIsClassAccessible()
|