Home
last modified time | relevance | path

Searched refs:MethodHandle (Results 1 – 25 of 96) sorted by relevance

1234

/libcore/ojluni/src/lambda/java/java/lang/invoke/
DMethodHandles.java41 reflectAs(Class<T> expected, MethodHandle target) { return null; } in reflectAs()
60MethodHandle findStatic(Class<?> refc, String name, MethodType type) throws NoSuchMethodException,… in findStatic()
62 …public MethodHandle findVirtual(Class<?> refc, String name, MethodType type) throws NoSuchMethodEx… in findVirtual()
64 …public MethodHandle findConstructor(Class<?> refc, MethodType type) throws NoSuchMethodException, … in findConstructor()
66 public MethodHandle findSpecial(Class<?> refc, String name, MethodType type, in findSpecial()
69 …public MethodHandle findGetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldExcept… in findGetter()
71 …public MethodHandle findSetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldExcept… in findSetter()
73 …public MethodHandle findStaticGetter(Class<?> refc, String name, Class<?> type) throws NoSuchField… in findStaticGetter()
75 …public MethodHandle findStaticSetter(Class<?> refc, String name, Class<?> type) throws NoSuchField… in findStaticSetter()
77 …public MethodHandle bind(Object receiver, String name, MethodType type) throws NoSuchMethodExcepti… in bind()
[all …]
DMethodHandle.java28 public abstract class MethodHandle { class
40 public MethodHandle asType(MethodType newType) { return null; } in asType()
42 public MethodHandle asCollector(Class<?> arrayType, int arrayLength) { return null; } in asCollector()
44 public MethodHandle asVarargsCollector(Class<?> arrayType) { return null; } in asVarargsCollector()
48 public MethodHandle asFixedArity() { return null; } in asFixedArity()
50 public MethodHandle bindTo(Object x) { return null; } in bindTo()
/libcore/luni/src/test/java/libcore/java/lang/invoke/
DExplicitCastArgumentsTest.java19 import java.lang.invoke.MethodHandle;
98 private static MethodHandle explicitCastArgumentToIdentity(Class identityClass, in explicitCastArgumentToIdentity()
100 MethodHandle identity = MethodHandles.identity(identityClass); in explicitCastArgumentToIdentity()
107 private static MethodHandle explicitCastReturnValueFromIdentity(Class identityClass, in explicitCastReturnValueFromIdentity()
109 MethodHandle identity = MethodHandles.identity(identityClass); in explicitCastReturnValueFromIdentity()
116 private static MethodHandle nullConstantExplicitCastToPrimitive(Class constantType, in nullConstantExplicitCastToPrimitive()
127 private static MethodHandle explicitCastVoidReturnValue(Class toType) throws Throwable { in explicitCastVoidReturnValue()
128 MethodHandle m = in explicitCastVoidReturnValue()
151 MethodHandle mh = explicitCastArgumentToIdentity(Child.class, Parent.class); in explicitCastArgumentParentToChild()
160 MethodHandle mh = explicitCastArgumentToIdentity(Child.class, Parent.class); in explicitCastArgumentNullParentToChild()
[all …]
DCallSitesTest.java23 import java.lang.invoke.MethodHandle;
36 ConstantCallSite site = new ConstantCallSite((MethodHandle) null); in test_ConstantCallSiteConstructorNullMethodHandle()
42 private static MethodHandle methodHandleForAdd2() throws Throwable { in methodHandleForAdd2()
48 final MethodHandle mh = methodHandleForAdd2(); in test_ConstantCallSite()
60 OurConstantCallSite(MethodType targetType, MethodHandle createTargetHook) throws Throwable { in OurConstantCallSite()
64 static MethodHandle createTargetHook(OurConstantCallSite callSite) throws Throwable { in createTargetHook()
74 MethodHandle createTargetHook = in test_ConstantCallSiteWithHook()
76 MethodType.methodType(MethodHandle.class, in test_ConstantCallSiteWithHook()
93 MutableCallSite callSite = new MutableCallSite((MethodHandle) null); in test_MutableCallSiteConstructorNullMethodHandle()
110 final MethodHandle mh = methodHandleForAdd2(); in test_MutableCallSite()
[all …]
DMethodHandleCombinersTest.java20 import java.lang.invoke.MethodHandle;
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()
125 MethodHandle delegate = MethodHandles.lookup().findStatic(MethodHandleCombinersTest.class, in testDropArguments_List()
129 MethodHandle transform = MethodHandles.dropArguments( in testDropArguments_List()
173 MethodHandle target = MethodHandles.lookup().findStatic(MethodHandleCombinersTest.class, in testCatchException()
178 MethodHandle handler = MethodHandles.lookup().findStatic(MethodHandleCombinersTest.class, in testCatchException()
183 MethodHandle adapter = MethodHandles.catchException(target, IllegalArgumentException.class, in testCatchException()
257 MethodHandle test = MethodHandles.lookup().findStatic(MethodHandleCombinersTest.class, in testGuardWithTest()
[all …]
/libcore/ojluni/src/main/java/java/lang/invoke/
DCallSite.java93 MethodHandle target; // Note: This field is known to the JVM. Do not change.
129 CallSite(MethodHandle target) { in CallSite()
148 CallSite(MethodType targetType, MethodHandle createTargetHook) throws Throwable { in CallSite()
151 MethodHandle boundTarget = (MethodHandle) createTargetHook.invokeWithArguments(selfCCS); in CallSite()
185 public abstract MethodHandle getTarget(); in getTarget()
205 public abstract void setTarget(MethodHandle newTarget); in setTarget()
207 void checkTargetChange(MethodHandle oldTarget, MethodHandle newTarget) { in checkTargetChange()
214 private static WrongMethodTypeException wrongTargetType(MethodHandle target, MethodType type) { in wrongTargetType()
232 public abstract MethodHandle dynamicInvoker(); in dynamicInvoker()
234 /*non-public*/ MethodHandle makeDynamicInvoker() { in makeDynamicInvoker()
[all …]
DMethodHandles.java193 reflectAs(Class<T> expected, MethodHandle target) { in reflectAs()
841MethodHandle findStatic(Class<?> refc, String name, MethodType type) throws NoSuchMethodException,… in findStatic()
849 return createMethodHandle(method, MethodHandle.INVOKE_STATIC, type); in findStatic()
852 private MethodHandle findVirtualForMH(String name, MethodType type) { in findVirtualForMH()
861 private MethodHandle findVirtualForVH(String name, MethodType type) { in findVirtualForVH()
871 private static MethodHandle createMethodHandle(Method method, int handleKind, in createMethodHandle()
873 MethodHandle mh = new MethodHandleImpl(method.getArtMethod(), handleKind, methodType); in createMethodHandle()
952 …public MethodHandle findVirtual(Class<?> refc, String name, MethodType type) throws NoSuchMethodEx… in findVirtual()
955 if (refc == MethodHandle.class) { in findVirtual()
956 MethodHandle mh = findVirtualForMH(name, type); in findVirtual()
[all …]
DMethodHandle.java423 public abstract class MethodHandle { class
451 /*private*/ MethodHandle asTypeCache;
463 private MethodHandle cachedSpreadInvoker;
497 protected MethodHandle(long artFieldOrMethod, int handleKind, MethodType type) { in MethodHandle() method in MethodHandle
701 MethodHandle invoker = cachedSpreadInvoker; in invokeWithArguments()
830 public MethodHandle asType(MethodType newType) { in asType()
838 MethodHandle atc = asTypeCached(newType); in asType()
845 private MethodHandle asTypeCached(MethodType newType) { in asTypeCached()
846 MethodHandle atc = asTypeCache; in asTypeCached()
855 /*non-public*/ MethodHandle asTypeUncached(MethodType newType) { in asTypeUncached()
[all …]
DVarHandle.java499 @MethodHandle.PolymorphicSignature
525 @MethodHandle.PolymorphicSignature
557 @MethodHandle.PolymorphicSignature
587 @MethodHandle.PolymorphicSignature
617 @MethodHandle.PolymorphicSignature
644 @MethodHandle.PolymorphicSignature
681 @MethodHandle.PolymorphicSignature
712 @MethodHandle.PolymorphicSignature
748 @MethodHandle.PolymorphicSignature
783 @MethodHandle.PolymorphicSignature
[all …]
DConstantCallSite.java43 public ConstantCallSite(MethodHandle target) { in ConstantCallSite()
81 …protected ConstantCallSite(MethodType targetType, MethodHandle createTargetHook) throws Throwable { in ConstantCallSite()
95 @Override public final MethodHandle getTarget() { in getTarget()
106 @Override public final void setTarget(MethodHandle ignore) { in setTarget()
118 public final MethodHandle dynamicInvoker() { in dynamicInvoker()
DMutableCallSite.java105 public MutableCallSite(MethodHandle target) { in MutableCallSite()
124 @Override public final MethodHandle getTarget() { in getTarget()
148 @Override public void setTarget(MethodHandle newTarget) { in setTarget()
157 public final MethodHandle dynamicInvoker() { in dynamicInvoker()
DVolatileCallSite.java58 public VolatileCallSite(MethodHandle target) { in VolatileCallSite()
76 @Override public final MethodHandle getTarget() { in getTarget()
93 @Override public void setTarget(MethodHandle newTarget) { in setTarget()
102 public final MethodHandle dynamicInvoker() { in dynamicInvoker()
/libcore/ojluni/src/test/java/lang/invoke/
DLoopCombinatorTest.java42 import java.lang.invoke.MethodHandle;
63 MethodHandle[] counterClause = new MethodHandle[]{Fac.MH_zero, Fac.MH_inc}; in testLoopFac()
64MethodHandle[] accumulatorClause = new MethodHandle[]{Fac.MH_one, Fac.MH_mult, Fac.MH_pred, Fac.MH… in testLoopFac()
65 MethodHandle loop = MethodHandles.loop(counterClause, accumulatorClause); in testLoopFac()
73 MethodHandle[] counterClause = new MethodHandle[]{null, Fac.MH_inc}; in testLoopFacNullInit()
74MethodHandle[] accumulatorClause = new MethodHandle[]{Fac.MH_one, Fac.MH_mult, Fac.MH_pred, Fac.MH… in testLoopFacNullInit()
75 MethodHandle loop = MethodHandles.loop(counterClause, accumulatorClause); in testLoopFacNullInit()
83MethodHandle[] counterClause = new MethodHandle[]{null, Loop.MH_inc, Loop.MH_pred, Loop.MH_fin}; in testLoopNullInit()
84 MethodHandle loop = MethodHandles.loop(counterClause); in testLoopNullInit()
92MethodHandle loop = MethodHandles.loop(new MethodHandle[]{Empty.MH_f, Empty.MH_f, Empty.MH_pred, n… in testLoopVoid1()
[all …]
DJavaDocExamplesTest.java90 private static final MethodHandle CONCAT_2, HASHCODE_2, ADD_2, SUB_2;
112 MethodHandle CONCAT_3 = LOOKUP.findVirtual(String.class, in testMisc()
114 MethodHandle HASHCODE_3 = LOOKUP.findVirtual(Object.class, in testMisc()
127 MethodHandle MH_asList = publicLookup().findStatic(Arrays.class, in testFindStatic()
135 MethodHandle MH_concat = publicLookup().findVirtual(String.class, in testFindVirtual()
137 MethodHandle MH_hashCode = publicLookup().findVirtual(Object.class, in testFindVirtual()
139 MethodHandle MH_hashCode_String = publicLookup().findVirtual(String.class, in testFindVirtual()
145 MethodHandle MH_subSequence = publicLookup().findVirtual(CharSequence.class, in testFindVirtual()
153 MethodHandle MH_newString = publicLookup() in testFindVirtual()
161 MethodHandle MH_newArrayList = publicLookup().findConstructor( in testFindConstructor()
[all …]
DTryFinallyTest.java33 import java.lang.invoke.MethodHandle;
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()
85MethodHandle identity = TryFinally.MH_throwingTargetIdentity.asType(methodType(argType, argType)); in testTryFinallyException()
86 MethodHandle tryFinally = MethodHandles.tryFinally( in testTryFinallyException()
95MethodHandle tfVoid = MethodHandles.tryFinally(TryFinally.MH_print, TryFinally.MH_printMore); in testTryFinallyVoid()
102MethodHandle helloMore = MethodHandles.tryFinally(TryFinally.MH_greetMore, TryFinally.MH_exclaimMo… in testTryFinallySublist()
109 MethodHandle c = TryFinally.MH_voidCleanup; in omitTrailingArguments()
120 public static void testTryFinallyOmitTrailingArguments(MethodHandle cleanup) throws Throwable { in testTryFinallyOmitTrailingArguments()
[all …]
DDropArgumentsTest.java33 import java.lang.invoke.MethodHandle;
47MethodHandle cat = lookup().findVirtual(String.class, "concat", methodType(String.class, String.cl… in testDropArgumentsToMatch()
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()
61MethodHandle cat = lookup().findVirtual(String.class, "concat", methodType(String.class, String.cl… in dropArgumentsToMatchNPEData()
63 { (MethodHandle) null, 0, cat.type().parameterList(), 0 }, in dropArgumentsToMatchNPEData()
70 …public void dropArgumentsToMatchNPE(MethodHandle target, int pos, List<Class<?>> valueType, int sk… in dropArgumentsToMatchNPE()
77MethodHandle cat = lookup().findVirtual(String.class, "concat", methodType(String.class, String.cl… in dropArgumentsToMatchIAEData()
90 …public void dropArgumentsToMatchIAE(MethodHandle target, int pos, List<Class<?>> valueType, int sk… in dropArgumentsToMatchIAE()
[all …]
DFoldTest.java34 import java.lang.invoke.MethodHandle;
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()
89MethodHandle trace = LOOKUP.findVirtual(StringWriter.class, "write", methodType(void.class, String… in testFoldArgumentsExample()
90MethodHandle cat = LOOKUP.findVirtual(String.class, "concat", methodType(String.class, String.clas… in testFoldArgumentsExample()
92 MethodHandle catTrace = MethodHandles.foldArguments(cat, 1, trace); in testFoldArgumentsExample()
133 static final MethodHandle MH_adder;
134 static final MethodHandle MH_adder1;
[all …]
DRicochetTest.java105 MethodHandle idreturn = filterReturnValue(list8ints, identity(Object.class)); in testFilterReturnValue()
108 MethodHandle add0 = addL.bindTo(0); in testFilterReturnValue()
115 MethodHandle add0 = addL.bindTo(0); in testFilterObject()
118 MethodHandle add13 = addL.bindTo(bump13); in testFilterObject()
119 MethodHandle add13_0 = addL.bindTo(opI2(bump13, 0)); in testFilterObject()
120 MethodHandle add13_1 = addL.bindTo(opI2(0, bump13)); in testFilterObject()
143 MethodHandle id = identity(int[].class); in testIntSpreads()
152 MethodHandle coll = id.asCollector(int[].class, nargs); in testIntSpreads()
163 MethodHandle mh = coll.asSpreader(int[].class, nargs); in testIntSpreads()
172 MethodHandle id = identity(byte[].class); in testByteSpreads()
[all …]
DPermuteArgsReturnVoidTest.java36 import java.lang.invoke.MethodHandle;
56 MethodHandle consumeIdentity = l.findStatic( in testReturnOnStack()
59 MethodHandle consumeVoid = l.findStatic( in testReturnOnStack()
63 MethodHandle f = MethodHandles.foldArguments(consumeIdentity, consumeVoid); in testReturnOnStack()
65MethodHandle p = MethodHandles.permuteArguments(f, MethodType.methodType(String.class, String.clas… in testReturnOnStack()
76 MethodHandle consumeIdentity = dropArguments( in testReturnFromArg()
78 MethodHandle consumeVoid = l.findStatic( in testReturnFromArg()
82 MethodHandle f = MethodHandles.foldArguments(consumeIdentity, consumeVoid); in testReturnFromArg()
84MethodHandle p = MethodHandles.permuteArguments(f, MethodType.methodType(String.class, String.clas… in testReturnFromArg()
DVarArgsTest.java32 import java.lang.invoke.MethodHandle;
46 MethodHandle deepToString = publicLookup() in testWithVarargs()
49 MethodHandle ts = deepToString.withVarargs(false); in testWithVarargs()
51 MethodHandle ts1 = deepToString.withVarargs(true); in testWithVarargs()
63 MethodHandle asList = publicLookup() in testWithVarargs2()
65 MethodHandle asListWithVarargs = asList.withVarargs(asList.isVarargsCollector()); in testWithVarargs2()
75 MethodHandle lenMH = publicLookup() in testWithVarargsIAE()
77 MethodHandle lenMHWithVarargs = lenMH.withVarargs(true); in testWithVarargsIAE()
DSpreadCollectTest.java35 import java.lang.invoke.MethodHandle;
57 MethodHandle spreader = SpreadCollect.MH_forSpreading.asSpreader(1, int[].class, 3); in testAsSpreader()
65MethodHandle compare = LOOKUP.findStatic(Objects.class, "compare", methodType(int.class, Object.cl… in testAsSpreaderExample()
66 MethodHandle compare2FromArray = compare.asSpreader(0, Object[].class, 2); in testAsSpreaderExample()
93MethodHandle h = MethodHandles.dropArguments(MethodHandles.constant(String.class, ""), 0, int.clas… in testAsSpreaderIllegalMethodType()
94 MethodHandle s = h.asSpreader(String[].class, 1); in testAsSpreaderIllegalMethodType()
114 MethodHandle collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 1); in testAsCollector()
127 MethodHandle collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 1); in testAsCollectorInvokeWithArguments()
140MethodHandle collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 1); in testAsCollectorLeading()
153MethodHandle collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 1); in testAsCollectorLeadingInvokeWithArguments()
[all …]
/libcore/ojluni/src/test/sun/invoke/util/
DWrapperTest.java31 import java.lang.invoke.MethodHandle;
48 MethodHandle h1 = MethodHandles.constant(Short.class, (short)42); in testShortZeroConversion()
49 MethodHandle h2 = h1.asType(MethodType.methodType(void.class)); // drop 42 in testShortZeroConversion()
50 MethodHandle h3 = h2.asType(MethodType.methodType(short.class)); // add 0 in testShortZeroConversion()
51 MethodHandle h4 = h3.asType(MethodType.methodType(Object.class)); // box in testShortZeroConversion()
61 MethodHandle h1 = MethodHandles.constant(Integer.class, 42); in testIntZeroConversion()
62 MethodHandle h2 = h1.asType(MethodType.methodType(void.class)); // drop 42 in testIntZeroConversion()
63 MethodHandle h3 = h2.asType(MethodType.methodType(int.class)); // add 0 in testIntZeroConversion()
64 MethodHandle h4 = h3.asType(MethodType.methodType(Object.class)); // box in testIntZeroConversion()
74 MethodHandle h1 = MethodHandles.constant(Long.class, 42L); in testLongZeroConversion()
[all …]
/libcore/ojluni/src/main/java/java/lang/runtime/
DObjectMethods.java29 import java.lang.invoke.MethodHandle;
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);
58 private static final MethodHandle CLASS_IS_INSTANCE;
59 private static final MethodHandle OBJECT_EQUALS;
60 private static final MethodHandle OBJECTS_EQUALS;
61 private static final MethodHandle OBJECTS_HASHCODE;
62 private static final MethodHandle OBJECTS_TOSTRING;
63 private static final MethodHandle OBJECT_EQ;
[all …]
/libcore/ojluni/annotations/hiddenapi/java/lang/invoke/
DMethodHandles.java46 java.lang.Class<T> expected, java.lang.invoke.MethodHandle target) { in reflectAs()
51 java.lang.invoke.MethodHandle target) { in getMethodHandleImpl()
63 public static java.lang.invoke.MethodHandle arrayElementGetter(java.lang.Class<?> arrayClass) in arrayElementGetter()
100 public static java.lang.invoke.MethodHandle arrayElementSetter(java.lang.Class<?> arrayClass) in arrayElementSetter()
154 public static java.lang.invoke.MethodHandle spreadInvoker( in spreadInvoker()
159 public static java.lang.invoke.MethodHandle exactInvoker(java.lang.invoke.MethodType type) { in exactInvoker()
163 public static java.lang.invoke.MethodHandle invoker(java.lang.invoke.MethodType type) { in invoker()
167 private static java.lang.invoke.MethodHandle methodHandleForVarHandleAccessor( in methodHandleForVarHandleAccessor()
174 public static java.lang.invoke.MethodHandle varHandleExactInvoker( in varHandleExactInvoker()
179 public static java.lang.invoke.MethodHandle varHandleInvoker( in varHandleInvoker()
[all …]
/libcore/ojluni/src/test/java/lang/invoke/MethodHandles/
DTestTableSwitch.java35 import java.lang.invoke.MethodHandle;
47 static final MethodHandle MH_IntConsumer_accept;
48 static final MethodHandle MH_check;
62 public static MethodHandle simpleTestCase(String value) { in simpleTestCase()
66 public static MethodHandle simpleTestCase(Class<?> type, Object value) { in simpleTestCase()
136 MethodHandle collector = MH_check; in testNonVoidHandles()
142 MethodHandle defaultCase = simpleTestCase(type, defaultReturnValue); in testNonVoidHandles()
145 MethodHandle[] cases = new MethodHandle[numCases]; in testNonVoidHandles()
149 MethodHandle theCase = simpleTestCase(type, returnValue); in testNonVoidHandles()
154 MethodHandle mhSwitch = MethodHandles.tableSwitch( in testNonVoidHandles()
[all …]

1234