IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
Types.cs
Go to the documentation of this file.
1/*
2 Copyright (C) 2009 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;
25using System.Threading;
26
27#if IMPORTER || EXPORTER
28using Type = IKVM.Reflection.Type;
29#endif
30
31namespace IKVM.Runtime
32{
33
37 class Types
38 {
39
40 readonly RuntimeContext context;
41
42 Type typeOfObject;
43 Type typeOfValueType;
44 Type typeOfEnum;
45 Type typeOfType;
46 Type typeOfString;
47 Type typeOfException;
48 Type typeOfArray;
49 Type typeOfAttribute;
50 Type typeOfDelegate;
51 Type typeOfMulticastDelegate;
52 Type typeOfRuntimeTypeHandle;
53
54 Type typeOfIntPtr;
55 Type typeOfVoid;
56 Type typeOfBoolean;
57 Type typeOfByte;
58 Type typeOfSByte;
59 Type typeOfChar;
60 Type typeOfInt16;
61 Type typeOfUInt16;
62 Type typeOfInt32;
63 Type typeOfUInt32;
64 Type typeOfInt64;
65 Type typeOfUInt64;
66 Type typeOfSingle;
67 Type typeOfDouble;
68
69 Type typeOfIsVolatile;
70
76 public Types(RuntimeContext context)
77 {
78 this.context = context ?? throw new ArgumentNullException(nameof(context));
79 }
80
86 Type Import(System.Type type)
87 {
88 return context.Resolver.ResolveCoreType(type.FullName).AsReflection();
89 }
90
91 public Type Object => typeOfObject ??= Import(typeof(System.Object));
92
93 public Type ValueType => typeOfValueType ??= Import(typeof(System.ValueType));
94
95 public Type Enum => typeOfEnum ??= Import(typeof(System.Enum));
96
97 public Type Type => typeOfType ??= Import(typeof(System.Type));
98
99 public Type String => typeOfString ??= Import(typeof(System.String));
100
101 public Type Exception => typeOfException ??= Import(typeof(System.Exception));
102
103 public Type Array => typeOfArray ??= Import(typeof(System.Array));
104
105 public Type Attribute => typeOfAttribute ??= Import(typeof(System.Attribute));
106
107 public Type Delegate => typeOfDelegate ??= Import(typeof(System.Delegate));
108
109 public Type MulticastDelegate => typeOfMulticastDelegate ??= Import(typeof(System.MulticastDelegate));
110
111 public Type RuntimeTypeHandle => typeOfRuntimeTypeHandle ??= Import(typeof(System.RuntimeTypeHandle));
112
113 public Type IntPtr => typeOfIntPtr ??= Import(typeof(IntPtr));
114
115 public Type Void => typeOfVoid ??= Import(typeof(void));
116
117 public Type Boolean => typeOfBoolean ??= Import(typeof(bool));
118
119 public Type Byte => typeOfByte ??= Import(typeof(byte));
120
121 public Type SByte => typeOfSByte ??= Import(typeof(sbyte));
122
123 public Type Char => typeOfChar ??= Import(typeof(char));
124
125 public Type Int16 => typeOfInt16 ??= Import(typeof(short));
126
127 public Type UInt16 => typeOfUInt16 ??= Import(typeof(ushort));
128
129 public Type Int32 => typeOfInt32 ??= Import(typeof(int));
130
131 public Type UInt32 => typeOfUInt32 ??= Import(typeof(uint));
132
133 public Type Int64 => typeOfInt64 ??= Import(typeof(long));
134
135 public Type UInt64 => typeOfUInt64 ??= Import(typeof(ulong));
136
137 public Type Single => typeOfSingle ??= Import(typeof(float));
138
139 public Type Double => typeOfDouble ??= Import(typeof(double));
140
141 public Type IsVolatile => typeOfIsVolatile ??= Import(typeof(System.Runtime.CompilerServices.IsVolatile));
142
143 }
144
145}
IKVM.Reflection.Type Type
Maintains services relevant to an instane of the IKVM runtime.
Provides various cached system types.
Definition Types.cs:38
Type RuntimeTypeHandle
Definition Types.cs:111
Type MulticastDelegate
Definition Types.cs:109
Types(RuntimeContext context)
Initializes a new instance.
Definition Types.cs:76