/libcore/luni/src/test/java/libcore/java/lang/invoke/ |
D | ExplicitCastArgumentsTest.java | 151 MethodHandle mh = explicitCastArgumentToIdentity(Child.class, Parent.class); in explicitCastArgumentParentToChild() local 153 Child c = (Child) mh.invokeExact(new Parent()); in explicitCastArgumentParentToChild() 160 MethodHandle mh = explicitCastArgumentToIdentity(Child.class, Parent.class); in explicitCastArgumentNullParentToChild() local 161 Child c = (Child) mh.invokeExact((Parent) null); in explicitCastArgumentNullParentToChild() 167 MethodHandle mh = explicitCastArgumentToIdentity(Parent.class, Child.class); in explicitCastArgumentChildToParent() local 168 Parent p = (Parent) mh.invokeExact(new Child()); in explicitCastArgumentChildToParent() 174 MethodHandle mh = explicitCastArgumentToIdentity(Parent.class, Child.class); in explicitCastArgumentNullChildToParent() local 175 Parent p = (Parent) mh.invokeExact((Child) null); in explicitCastArgumentNullChildToParent() 181 MethodHandle mh = explicitCastReturnValueFromIdentity(Parent.class, Child.class); in explicitCastReturnValueNullParentToChild() local 182 Child c = (Child) mh.invokeExact((Parent) null); in explicitCastReturnValueNullParentToChild() [all …]
|
D | MethodHandlesTest.java | 419 MethodHandle mh = MethodHandles.lookup().findSpecial(F.class /* refC */, "callInner", in testfindSpecial_invokeSuperInterfaceBehaviour() local 423 mh.invokeExact(g, oc); in testfindSpecial_invokeSuperInterfaceBehaviour() 608 MethodHandle mh = BarImpl.lookup.findVirtual( in testfindVirtual() local 610 String str = (String) mh.invoke(new BarImpl()); in testfindVirtual() 615 mh = MethodHandles.lookup().findVirtual(BarImpl.class, "foo", in testfindVirtual() 617 str = (String) mh.invoke(new BarImpl()); in testfindVirtual() 629 mh = MethodHandles.lookup().findVirtual( in testfindVirtual() 639 mh = MethodHandles.lookup().findVirtual(BarImpl.class, "bar", in testfindVirtual() 641 str = (String) mh.invoke(new BarImpl()); in testfindVirtual() 645 mh = MethodHandles.lookup().findVirtual(BarImpl.class, "bar", in testfindVirtual() [all …]
|
D | MethodHandleCombinersTest.java | 1702 private static void invokeMultiThreaded(final MethodHandle mh) throws Throwable { in invokeMultiThreaded() argument 1714 mh.invoke(); in invokeMultiThreaded() 1741 MethodHandle mh = MethodHandles.dropArguments(delegate, 0, int.class, Object.class); in testDropInsertArgumentsMultithreaded() local 1742 mh = MethodHandles.insertArguments(mh, 0, 3333, "bogon", "foo", 42); in testDropInsertArgumentsMultithreaded() 1743 invokeMultiThreaded(mh); in testDropInsertArgumentsMultithreaded() 1770 private static void testTargetAndFallback_delegate(MethodHandle mh) throws Throwable { in testTargetAndFallback_delegate() argument 1771 String actual = (String) mh.invoke("target", 42, 56); in testTargetAndFallback_delegate() 1773 actual = (String) mh.invoke("blah", 41, 56); in testTargetAndFallback_delegate() 1815 MethodHandle mh = MethodHandles.lookup().findStatic( in testReferenceArrayGetterMultiThreaded() local 1819 mh = MethodHandles.insertArguments(mh, 0, getter, setter, in testReferenceArrayGetterMultiThreaded() [all …]
|
D | CallSitesTest.java | 48 final MethodHandle mh = methodHandleForAdd2(); in test_ConstantCallSite() local 49 ConstantCallSite site = new ConstantCallSite(mh); in test_ConstantCallSite() 53 site.setTarget(mh); in test_ConstantCallSite() 110 final MethodHandle mh = methodHandleForAdd2(); in test_MutableCallSite() local 111 final MutableCallSite site = new MutableCallSite(mh); in test_MutableCallSite() 168 final MethodHandle mh = methodHandleForAdd2(); in test_VolatileCallSite() local 169 final VolatileCallSite site = new VolatileCallSite(mh); in test_VolatileCallSite()
|
/libcore/ojluni/src/test/java/lang/invoke/ |
D | InvokeWithArgumentsTest.java | 49 MethodHandle mh = L.findStatic(L.lookupClass(), "arity", in testArity() local 53 mh.invokeWithArguments(""); in testArity() 70 MethodHandle mh = L.findStatic(L.lookupClass(), "passThrough", in testArrayNoPassThrough() local 77 String[] expected = (String[]) mh.invokeWithArguments((Object[]) actual); in testArrayNoPassThrough() 87 MethodHandle mh = L.findStatic(L.lookupClass(), "pack", in testArrayPack() local 92 Object[] expected = (Object[]) mh.invokeWithArguments("", actual); in testArrayPack() 103 MethodHandle mh = L.findStatic(L.lookupClass(), "intArray", in testPrimitiveArrayWithNull() local 106 mh.invokeWithArguments(null, null); in testPrimitiveArrayWithNull() 113 MethodHandle mh = L.findStatic(L.lookupClass(), "intArray", in testPrimitiveArrayWithRef() local 116 mh.invokeWithArguments("A", "B"); in testPrimitiveArrayWithRef() [all …]
|
D | PermuteArgsTest.java | 167 static void test(String name, MethodHandle mh) throws Throwable { in test() argument 169 System.out.println("mh = "+name+" : "+mh+" { " in test() 170 +Arrays.toString(junkArgs(mh.type().parameterArray()))); in test() 172 if (!mh.isVarargsCollector()) { in test() 174 testPermutations(mh); in test() 177 MethodType mt = mh.type(); in test() 183 mh1 = adjustArity(mh, arity); in test() 185 System.out.println("*** mh = "+name+" : "+mh+"; arity = "+arity+" => "+ex); in test() 197 static MethodHandle adjustArity(MethodHandle mh, int arity) { in adjustArity() argument 198 MethodType mt = mh.type(); in adjustArity() [all …]
|
D | InvokeGenericTest.java | 306 MethodHandle mh = CALLABLES.get(params); in callable() local 307 if (mh == null) { in callable() 308 mh = collector_MH.asType(methodType(Object.class, params)); in callable() 309 CALLABLES.put(params, mh); in callable() 311 return mh; in callable() 336 MethodHandle mh = callable(Object.class, String.class); in testSimple() local 338 res = resl = (List<?>) mh.invoke((String)args[0], (Object)args[1]); in testSimple() 348 MethodHandle mh = callable(Object.class, Object.class); in testSimplePrims() local 350 res = resl = (List<?>) mh.invoke(args[0], args[1]); in testSimplePrims() 360 MethodHandle mh = callable(Object.class, String.class); in testAlternateName() local [all …]
|
D | MethodHandlesGeneralTest.java | 674 MethodHandle mh; in testAccessor() local 677 case TEST_UNREFLECT: mh = lookup.unreflectGetter(f); break; in testAccessor() 678 case TEST_FIND_FIELD: mh = lookup.findGetter(fclass, fname, ftype); break; in testAccessor() 679 case TEST_FIND_STATIC: mh = lookup.findStaticGetter(fclass, fname, ftype); break; in testAccessor() 681 TEST_UNREFLECT: mh = lookup.unreflectSetter(f); break; in testAccessor() 683 TEST_FIND_FIELD: mh = lookup.findSetter(fclass, fname, ftype); break; in testAccessor() 685 TEST_FIND_STATIC: mh = lookup.findStaticSetter(fclass, fname, ftype); break; in testAccessor() 690 mh = null; in testAccessor() 701 +" => "+mh in testAccessor() 704 …ertEquals(positive0 ? "positive test" : "negative test erroneously passed", positive0, mh != null); in testAccessor() [all …]
|
D | FilterArgumentsTest.java | 81 final MethodHandle mh; field in FilterArgumentsTest.FilterTest 82 FilterTest(MethodHandle mh) { in FilterTest() argument 83 this.mh = mh; in FilterTest() 88 assertEquals("x-0-z", (String)mh.invokeExact("x", 0, 'z')); in run()
|
D | RicochetTest.java | 163 MethodHandle mh = coll.asSpreader(int[].class, nargs); in testIntSpreads() local 164 int[] args3 = (int[]) mh.invokeExact(args); in testIntSpreads() 192 MethodHandle mh = coll.asSpreader(byte[].class, nargs); in testByteSpreads() local 193 byte[] args3 = (byte[]) mh.invokeExact(args); in testByteSpreads() 221 MethodHandle mh = coll.asSpreader(long[].class, nargs); in testLongSpreads() local 222 long[] args3 = (long[]) mh.invokeExact(args); in testLongSpreads() 257 … MethodHandle mh = collectArguments(lister, pos, int[].class, INT_COLLECTORS[collects]); in testIntCollects() local 258 if (mh == null) continue; // no infix collection, yet in testIntCollects() 259 assert(mh.type().parameterCount() == inputs); in testIntCollects() 260 Object observe = mh.asSpreader(int[].class, args.length).invokeExact(args); in testIntCollects() [all …]
|
D | JavaDocExamplesTest.java | 373 MethodType mt; MethodHandle mh; in testMethodHandlesSummary() local 377 mh = lookup.findVirtual(String.class, "replace", mt); in testMethodHandlesSummary() 378 s = (String) mh.invokeExact("daddy",'d','n'); in testMethodHandlesSummary() 382 s = (String) mh.invokeWithArguments("sappy", 'p', 'v'); in testMethodHandlesSummary() 386 mh = lookup.findStatic(java.util.Arrays.class, "asList", mt); in testMethodHandlesSummary() 387 assert(mh.isVarargsCollector()); in testMethodHandlesSummary() 388 x = mh.invoke("one", "two"); in testMethodHandlesSummary() 393 mh = mh.asType(mt); in testMethodHandlesSummary() 394 x = mh.invokeExact((Object)1, (Object)2, (Object)3); in testMethodHandlesSummary() 399 mh = lookup.findVirtual(java.util.List.class, "size", mt); in testMethodHandlesSummary() [all …]
|
/libcore/ojluni/src/test/java/lang/invoke/MethodHandles/ |
D | TestDropReturn.java | 46 MethodHandle mh = MethodHandles.identity(cls); in testDropReturn() local 47 assertEquals(mh.type(), methodType(cls, cls)); in testDropReturn() 48 Object x = mh.invoke(testValue); in testDropReturn() 51 mh = MethodHandles.dropReturn(mh); in testDropReturn() 52 assertEquals(mh.type(), methodType(void.class, cls)); in testDropReturn() 53 mh.invoke(testValue); // should at least work in testDropReturn()
|
/libcore/ojluni/src/test/java/lang/invoke/VarHandles/ |
D | VarHandleTestReflection.java | 73 MethodHandle mh = MethodHandles.lookup().unreflect( in methodHandleInvoke() local 77 Object o = (Object) mh.invoke(v, new Object[]{}); in methodHandleInvoke() 87 MethodHandle mh = MethodHandles.lookup().unreflect( in methodInvocationFromMethodInfo() local 89 MethodHandleInfo info = MethodHandles.lookup().revealDirect(mh); in methodInvocationFromMethodInfo() 98 MethodHandle mh = MethodHandles.varHandleInvoker( in reflectAsFromVarHandleInvoker() local 101 MethodHandleInfo info = MethodHandles.lookup().revealDirect(mh); in reflectAsFromVarHandleInvoker() 110 MethodHandle mh = MethodHandles.publicLookup().findVirtual( in reflectAsFromFindVirtual() local 113 MethodHandleInfo info = MethodHandles.lookup().revealDirect(mh); in reflectAsFromFindVirtual()
|
D | VarHandleBaseTest.java | 239 MethodHandle mh; in findVirtual() local 241 mh = MethodHandles.publicLookup(). in findVirtual() 248 return bind(vh, mh, mt); in findVirtual() 252 MethodHandle mh = MethodHandles.varHandleInvoker( in varHandleInvoker() local 256 return bind(vh, mh, mt); in varHandleInvoker() 260 MethodHandle mh = MethodHandles.varHandleExactInvoker( in varHandleExactInvoker() local 264 return bind(vh, mh, mt); in varHandleExactInvoker() 267 private static MethodHandle bind(VarHandle vh, MethodHandle mh, MethodType emt) { in bind() argument 268 assertEquals(mh.type(), emt.insertParameterTypes(0, VarHandle.class), in bind() 271 MethodHandleInfo info = MethodHandles.lookup().revealDirect(mh); in bind() [all …]
|
/libcore/ojluni/src/test/java/lang/constant/ |
D | NameValidationTest.java | 54 DirectMethodHandleDesc mh = MethodHandleDesc.of(Kind.VIRTUAL, CD_String, "isEmpty", "()Z"); in testMemberNames() local 57 memberNamesHelper(badName, mh, CD_int, null); in testMemberNames() 63 memberNamesHelper(badName, mh, CD_int, new ConstantDesc[0]); in testMemberNames() 71 memberNamesHelper(badName, mh, CD_int, null); in testMemberNames() 72 memberNamesHelper(badName, mh, CD_int, new ConstantDesc[0]); in testMemberNames()
|
/libcore/ojluni/src/test/java/util/Optional/ |
D | BasicInt.java | 161 MethodHandle mh = in OptionalInt_ifPresentOrElse() local 163 mh.invokeExact(receiver, action, emptyAction); in OptionalInt_ifPresentOrElse() 173 MethodHandle mh = in OptionalInt_isEmpty() local 175 return (boolean) mh.invokeExact(receiver); in OptionalInt_isEmpty() 185 MethodHandle mh = in OptionalInt_orElseThrow() local 187 return (int) mh.invokeExact(receiver); in OptionalInt_orElseThrow() 199 MethodHandle mh = in OptionalInt_stream() local 201 return (IntStream) mh.invokeExact(receiver); in OptionalInt_stream()
|
D | BasicDouble.java | 163 MethodHandle mh = MethodHandles.lookup().findVirtual(OptionalDouble.class, in OptionalDouble_ifPresentOrElse() local 166 mh.invokeExact(receiver, action, emptyAction); in OptionalDouble_ifPresentOrElse() 176 MethodHandle mh = in OptionalDouble_isEmpty() local 178 return (boolean) mh.invokeExact(receiver); in OptionalDouble_isEmpty() 188 MethodHandle mh = in OptionalDouble_orElseThrow() local 190 return (double) mh.invokeExact(receiver); in OptionalDouble_orElseThrow() 202 MethodHandle mh = in OptionalDouble_stream() local 204 return (DoubleStream) mh.invokeExact(receiver); in OptionalDouble_stream()
|
D | BasicLong.java | 163 MethodHandle mh = in OptionalLong_ifPresentOrElse() local 165 mh.invokeExact(receiver, action, emptyAction); in OptionalLong_ifPresentOrElse() 175 MethodHandle mh = in OptionalLong_isEmpty() local 177 return (boolean) mh.invokeExact(receiver); in OptionalLong_isEmpty() 187 MethodHandle mh = in OptionalLong_orElseThrow() local 189 return (long) mh.invokeExact(receiver); in OptionalLong_orElseThrow() 201 MethodHandle mh = in OptionalLong_stream() local 203 return (LongStream) mh.invokeExact(receiver); in OptionalLong_stream()
|
D | Basic.java | 329 MethodHandle mh = in Optional_ifPresentOrElse() local 331 mh.invokeExact(receiver, action, emptyAction); in Optional_ifPresentOrElse() 341 MethodHandle mh = MethodHandles.lookup().findVirtual(Optional.class, "isEmpty", type); in Optional_isEmpty() local 342 return (boolean) mh.invokeExact(receiver); in Optional_isEmpty() 353 MethodHandle mh = MethodHandles.lookup().findVirtual(Optional.class, "or", type); in Optional_or() local 354 return (Optional<T>) mh.invokeExact(receiver, supplier); in Optional_or() 364 MethodHandle mh = in Optional_orElseThrow() local 366 return (T) mh.invokeExact(receiver); in Optional_orElseThrow() 378 MethodHandle mh = MethodHandles.lookup().findVirtual(Optional.class, "stream", type); in Optional_stream() local 379 return (Stream<T>) mh.invokeExact(receiver); in Optional_stream()
|
/libcore/ojluni/src/main/java/java/lang/invoke/ |
D | MethodHandle.java | 1489 MethodHandle mh = this; in asFixedArity() local 1490 if (mh.isVarargsCollector()) { in asFixedArity() 1491 mh = ((Transformers.VarargsCollector) mh).asFixedArity(); in asFixedArity() 1493 assert(!mh.isVarargsCollector()); in asFixedArity() 1494 return mh; in asFixedArity()
|
D | ConstantBootstraps.java | 175 MethodHandle mh; in getStaticFinal() local 177 mh = lookup.findStaticGetter(declaringClass, name, type); in getStaticFinal() 181 MethodHandleInfo info = lookup.revealDirect(mh); in getStaticFinal() 194 return mh.invoke(); in getStaticFinal()
|
D | MethodHandles.java | 873 MethodHandle mh = new MethodHandleImpl(method.getArtMethod(), handleKind, methodType); in createMethodHandle() local 875 return new Transformers.VarargsCollector(mh); in createMethodHandle() 877 return mh; in createMethodHandle() 956 MethodHandle mh = findVirtualForMH(name, type); in findVirtual() local 957 if (mh != null) { in findVirtual() 958 return mh; in findVirtual() 962 MethodHandle mh = findVirtualForVH(name, type); in findVirtual() local 963 if (mh != null) { in findVirtual() 964 return mh; in findVirtual() 1090 MethodHandle mh; in createMethodHandleForConstructor() local [all …]
|
/libcore/ojluni/src/test/java/lang/StackWalker/ |
D | GetCallerClassTest.java | 149 MethodHandle mh = lookup.findVirtual(StackWalker.class, "getCallerClass", in methodHandleGetCallerClass() local 151 Class<?> c = (Class<?>) mh.invokeExact(stackWalker); in methodHandleGetCallerClass() 254 MethodHandle mh = lookup.findStatic(GetCallerClassTest.class, in callMethodHandle() local 257 mh.invokeExact(walker, ReflectionTest.class, expectUOE); in callMethodHandle() 265 MethodHandle mh = lookup.findStatic(GetCallerClassTest.class, in callMethodHandleRefl() local 268 mh.invokeExact(walker, ReflectionTest.class, expectUOE); in callMethodHandleRefl()
|
/libcore/ojluni/src/main/java/java/io/ |
D | ObjectStreamClass.java | 2599 synchronized MethodHandle putIfAbsentAndGet(ObjectStreamField[] fields, MethodHandle mh) { in putIfAbsentAndGet() argument 2601 var oldMh = putIfAbsent(key, mh); in putIfAbsentAndGet() 2618 return mh; in putIfAbsentAndGet() 2700 MethodHandle mh = desc.deserializationCtr; in deserializationCtr() local 2701 if (mh != null) return mh; in deserializationCtr() 2702 mh = desc.deserializationCtrs.get(desc.getFields(false)); in deserializationCtr() 2703 if (mh != null) return desc.deserializationCtr = mh; in deserializationCtr() 2717 mh = desc.getRecordConstructor(); in deserializationCtr() 2721 mh = mh.asType(mh.type().changeReturnType(Object.class)); in deserializationCtr() 2725 … mh = MethodHandles.dropArguments(mh, mh.type().parameterCount(), byte[].class, Object[].class); in deserializationCtr() [all …]
|
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/javax/xml/parsers/ |
D | SAXParserFactoryTest.java | 261 MyHandler mh = new MyHandler(); in test_setNamespaceAwareZ() local 265 spf.newSAXParser().parse(is, mh); in test_setNamespaceAwareZ() 270 spf.newSAXParser().parse(is, mh); in test_setNamespaceAwareZ()
|