27using System.Runtime.InteropServices;
30using IKVM.ByteCode.Encoding;
38 static partial class ClassLoader
59 public static global::java.lang.Class
defineClass0(global::java.lang.ClassLoader
self,
string name,
byte[] b,
int off,
int len, global::java.security.ProtectionDomain pd)
62 throw new NotImplementedException();
64 var buf =
new byte[len];
65 Array.Copy(b, off, buf, 0, len);
66 return DefineClass(
self, name, ReadClass(buf), pd,
null);
82 public static global::java.lang.Class
defineClass1(global::java.lang.ClassLoader
self,
string name,
byte[] b,
int off,
int len, global::java.security.ProtectionDomain pd,
string source)
85 throw new NotImplementedException();
87 var buf =
new byte[len];
88 Array.Copy(b, off, buf, 0, len);
89 return DefineClass(
self, name, ReadClass(buf), pd, source);
104 public static unsafe global::java.lang.Class
defineClass2(global::java.lang.ClassLoader
self,
string name, global::java.nio.ByteBuffer bb,
int off,
int len, global::java.security.ProtectionDomain pd,
string source)
107 throw new NotImplementedException();
109 var buf =
new byte[bb.remaining()];
111 return DefineClass(
self, name, ReadClass(buf), pd, source);
115#if FIRST_PASS == false
122 static IKVM.ByteCode.Decoding.ClassFile ReadClass(
byte[] buffer)
126 return IKVM.ByteCode.Decoding.ClassFile.Read(buffer);
128 catch (InvalidClassMagicException)
130 throw new global::java.lang.ClassFormatError(
"Incompatible magic value");
132 catch (ByteCodeException e)
134 throw new global::java.lang.ClassFormatError(e.Message);
147 static global::java.lang.Class DefineClass(global::java.lang.ClassLoader
self,
string name,
IKVM.ByteCode.Decoding.ClassFile clazz, global::java.security.ProtectionDomain pd,
string source)
153 if (name !=
null && classFile.Name != name)
154 throw new global::java.lang.NoClassDefFoundError(name +
" (wrong name: " + classFile.Name +
")");
156 var type = runtimeClassLoader.DefineClass(classFile, pd);
160 return type.ClassObject;
175 public static void resolveClass0(global::java.lang.ClassLoader
self, global::java.lang.Class clazz)
186 public static global::java.lang.Class
findBootstrapClass(global::java.lang.ClassLoader
self,
string name)
189 throw new NotImplementedException();
193 return JVM.Context.
ClassLoaderFactory.GetBootstrapClassLoader().TryLoadClassByName(name)?.ClassObject;
208 public static global::java.lang.Class
findLoadedClass0(global::java.lang.ClassLoader
self,
string name)
211 throw new NotImplementedException();
213 return name !=
null ? (
JVM.Context.
ClassLoaderFactory.GetClassLoaderWrapper(
self).FindLoadedClass(name)?.ClassObject) :
null;
225 throw new NotImplementedException();
239 throw new NotImplementedException();
241 return new global::ikvm.runtime.EnumerationWrapper(
JVM.Context.
ClassLoaderFactory.GetBootstrapClassLoader().GetResources(name));
static global::java.lang.Class defineClass1(global::java.lang.ClassLoader self, string name, byte[] b, int off, int len, global::java.security.ProtectionDomain pd, string source)
Implements the native method 'defineClass1'.
static global::java.lang.Class defineClass0(global::java.lang.ClassLoader self, string name, byte[] b, int off, int len, global::java.security.ProtectionDomain pd)
Implements the native method 'defineClass0'.
static global::java.lang.Class findLoadedClass0(global::java.lang.ClassLoader self, string name)
Implements the native method 'findLoadedClass0'.
static unsafe global::java.lang.Class defineClass2(global::java.lang.ClassLoader self, string name, global::java.nio.ByteBuffer bb, int off, int len, global::java.security.ProtectionDomain pd, string source)
Implements the native method 'defineClass2'.
static void registerNatives()
Implements the native method 'registerNatives'.
static object retrieveDirectives()
Implements the native method 'retrieveDirectives'.
static global::java.lang.Class findBootstrapClass(global::java.lang.ClassLoader self, string name)
Implements the native method 'findBootstrapClass'.
static global::java.util.Enumeration getBootstrapResources(string name)
Implements the native method 'getBootstrapResources'.
static global::java.net.URL getBootstrapResource(string name)
Implements the native method 'getBootstrapResource'.
static void resolveClass0(global::java.lang.ClassLoader self, global::java.lang.Class clazz)
Implements the native method 'resolveClass0'.
Represents an internal error that occurred within IKVM.
Main state of the running JVM.
.NET exception that corresponds to a Java exception.
IDiagnosticHandler Diagnostics
Gets the IDiagnosticHandler where events should be sent.
RuntimeClassLoaderFactory ClassLoaderFactory
Gets the RuntimeClassLoaderFactory associated with this instance of the runtime.