IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
DirectMethodHandle.cs
Go to the documentation of this file.
1/*
2 Copyright (C) 2011-2015 Jeroen Frijters
3
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
7
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely, subject to the following restrictions:
11
12 1. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
16 2. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
18 3. This notice may not be removed or altered from any source distribution.
19
20 Jeroen Frijters
21 jeroen@frijters.net
22
23*/
24using System;
25
26using IKVM.Runtime;
27
29{
30
31 static class DirectMethodHandle
32 {
33
34 // this is called from DirectMethodHandle.makeAllocator() via a map.xml prologue patch
35 public static global::java.lang.invoke.DirectMethodHandle makeStringAllocator(global::java.lang.invoke.MemberName member)
36 {
37#if FIRST_PASS
38 throw new NotImplementedException();
39#else
40 // we cannot construct strings via the standard two-pass approach (allocateObject followed by constructor invocation),
41 // so we special case string construction here (to call our static factory method instead)
42 if (member.getDeclaringClass() == JVM.Context.JavaBase.TypeOfJavaLangString.ClassObject)
43 {
44 global::java.lang.invoke.MethodType mt = member.getMethodType().changeReturnType(JVM.Context.JavaBase.TypeOfJavaLangString.ClassObject);
45 return new global::java.lang.invoke.DirectMethodHandle(mt, global::java.lang.invoke.DirectMethodHandle._preparedLambdaForm(mt, global::java.lang.invoke.MethodTypeForm.LF_INVSTATIC), member, null);
46 }
47
48 return null;
49#endif
50 }
51
52 }
53
54}
static global::java.lang.invoke.DirectMethodHandle makeStringAllocator(global::java.lang.invoke.MemberName member)
Main state of the running JVM.
CoreClasses JavaBase
Gets the CoreClasses associated with this instance of the runtime.