IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
IKVM.Java.Externs.ikvm.runtime.Util Class Reference

Static Public Member Functions

static global::java.lang.Class getClassFromObject (object o)
 
static global::java.lang.Class getClassFromTypeHandle (RuntimeTypeHandle handle)
 
static global::java.lang.Class getClassFromTypeHandle (RuntimeTypeHandle handle, int rank)
 
static global::java.lang.Class getFriendlyClassFromType (Type type)
 
static Type getInstanceTypeFromClass (global::java.lang.Class classObject)
 Gets the underlying CLR Type instance.
 
static Type getRuntimeTypeFromClass (global::java.lang.Class classObject)
 Gets the underlying CLR Type instance resovled fully at runtime.
 
static Exception mapException (Exception e)
 
static Exception unmapException (Exception e)
 

Detailed Description

Definition at line 32 of file Util.cs.

Member Function Documentation

◆ getClassFromObject()

static global.java.lang.Class IKVM.Java.Externs.ikvm.runtime.Util.getClassFromObject ( object o)
static

Definition at line 35 of file Util.cs.

36 {
37#if FIRST_PASS
38 throw new NotImplementedException();
39#else
40 return GetTypeWrapperFromObject(JVM.Context, o).ClassObject;
41#endif
42 }
Main state of the running JVM.

◆ getClassFromTypeHandle() [1/2]

static global.java.lang.Class IKVM.Java.Externs.ikvm.runtime.Util.getClassFromTypeHandle ( RuntimeTypeHandle handle)
static

Definition at line 67 of file Util.cs.

68 {
69#if FIRST_PASS
70 throw new NotImplementedException();
71#else
72 var t = Type.GetTypeFromHandle(handle);
73 if (t.IsPrimitive || JVM.Context.ClassLoaderFactory.IsRemappedType(t) || t == typeof(void))
74 return JVM.Context.ManagedJavaTypeFactory.GetJavaTypeFromManagedType(t).ClassObject;
75
76 if (!IsVisibleAsClass(t))
77 return null;
78
79 var tw = JVM.Context.ClassLoaderFactory.GetJavaTypeFromType(t);
80 if (tw != null)
81 return tw.ClassObject;
82
83 return null;
84#endif
85 }
IKVM.Reflection.Type Type
RuntimeManagedJavaTypeFactory ManagedJavaTypeFactory
Gets the RuntimeManagedJavaTypeFactory associated with this instance of the runtime.
RuntimeClassLoaderFactory ClassLoaderFactory
Gets the RuntimeClassLoaderFactory associated with this instance of the runtime.
RuntimeJavaType GetJavaTypeFromManagedType(Type type)
Gets the RuntimeJavaType associated with the specified managed type, or creates one on demand.

◆ getClassFromTypeHandle() [2/2]

static global.java.lang.Class IKVM.Java.Externs.ikvm.runtime.Util.getClassFromTypeHandle ( RuntimeTypeHandle handle,
int rank )
static

Definition at line 87 of file Util.cs.

88 {
89#if FIRST_PASS
90 throw new NotImplementedException();
91#else
92 var t = Type.GetTypeFromHandle(handle);
93 if (t.IsPrimitive || JVM.Context.ClassLoaderFactory.IsRemappedType(t) || t == typeof(void))
94 return JVM.Context.ManagedJavaTypeFactory.GetJavaTypeFromManagedType(t).MakeArrayType(rank).ClassObject;
95
96 if (!IsVisibleAsClass(t))
97 return null;
98
99 var tw = JVM.Context.ClassLoaderFactory.GetJavaTypeFromType(t);
100 if (tw != null)
101 return tw.MakeArrayType(rank).ClassObject;
102
103 return null;
104#endif
105 }

◆ getFriendlyClassFromType()

static global.java.lang.Class IKVM.Java.Externs.ikvm.runtime.Util.getFriendlyClassFromType ( Type type)
static

Definition at line 107 of file Util.cs.

108 {
109#if FIRST_PASS
110 throw new NotImplementedException();
111#else
112 int rank = 0;
113 while (ReflectUtil.IsVector(type))
114 {
115 type = type.GetElementType();
116 rank++;
117 }
118
119 if (type.DeclaringType != null && JVM.Context.AttributeHelper.IsGhostInterface(type.DeclaringType))
120 type = type.DeclaringType;
121
122 if (!IsVisibleAsClass(type))
123 return null;
124
125 var wrapper = JVM.Context.ClassLoaderFactory.GetJavaTypeFromType(type);
126 if (wrapper == null)
127 return null;
128
129 if (rank > 0)
130 wrapper = wrapper.MakeArrayType(rank);
131
132 return wrapper.ClassObject;
133#endif
134 }
AttributeHelper AttributeHelper
Gets the AttributeHelper associated with this instance of the runtime.

◆ getInstanceTypeFromClass()

static Type IKVM.Java.Externs.ikvm.runtime.Util.getInstanceTypeFromClass ( global.java.lang.Class classObject)
static

Gets the underlying CLR Type instance.

Parameters
classObject
Returns

Definition at line 163 of file Util.cs.

164 {
165 var wrapper = RuntimeJavaType.FromClass(classObject);
166 if (wrapper.IsRemapped && wrapper.IsFinal)
167 return wrapper.TypeAsTBD;
168 else
169 return wrapper.TypeAsBaseType;
170 }

◆ getRuntimeTypeFromClass()

static Type IKVM.Java.Externs.ikvm.runtime.Util.getRuntimeTypeFromClass ( global.java.lang.Class classObject)
static

Gets the underlying CLR Type instance resovled fully at runtime.

Parameters
classObject
Returns

Definition at line 177 of file Util.cs.

178 {
179 var wrapper = RuntimeJavaType.FromClass(classObject);
180 wrapper.Finish();
181
182 if (wrapper.IsRemapped && wrapper.IsFinal)
183 return wrapper.TypeAsTBD;
184 else
185 return wrapper.TypeAsBaseType;
186 }

◆ mapException()

static Exception IKVM.Java.Externs.ikvm.runtime.Util.mapException ( Exception e)
static

Definition at line 189 of file Util.cs.

190 {
191#if FIRST_PASS
192 throw new NotImplementedException();
193#else
194 return JVM.Context.ExceptionHelper.MapException<Exception>(e, true, false);
195#endif
196 }
ExceptionHelper ExceptionHelper
Gets the ExceptionHelper associated with this instance of the runtime.

◆ unmapException()

static Exception IKVM.Java.Externs.ikvm.runtime.Util.unmapException ( Exception e)
static

Definition at line 198 of file Util.cs.

199 {
200#if FIRST_PASS
201 throw new NotImplementedException();
202#else
203 return ExceptionHelper.UnmapException(e);
204#endif
205 }

The documentation for this class was generated from the following file: