IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
IKVM.Tools.Importer.ImportClassLoader Class Referencesealed

Implementation of RuntimeClassLoader that emits loaded Java types to an AssemblyBuilder. More...

Inheritance diagram for IKVM.Tools.Importer.ImportClassLoader:
IKVM.Runtime.RuntimeClassLoader

Classes

class  ExceptionMapEmitter
 

Public Member Functions

 ImportClassLoader (RuntimeContext context, StaticCompiler compiler, IDiagnosticHandler diagnostics, RuntimeAssemblyClassLoader[] referencedAssemblies, ImportState options, FileInfo assemblyPath, bool targetIsModule, string assemblyName, Dictionary< string, Jar.Item > classes)
 Initializes a new instance.
 
override string ToString ()
 
- Public Member Functions inherited from IKVM.Runtime.RuntimeClassLoader
override string ToString ()
 

Protected Member Functions

override RuntimeJavaType LoadClassImpl (string name, LoadMode mode)
 
override void CheckProhibitedPackage (string className)
 
- Protected Member Functions inherited from IKVM.Runtime.RuntimeClassLoader
virtual RuntimeJavaType FindLoadedClassLazy (string name)
 

Properties

override IDiagnosticHandler Diagnostics [get]
 
- Properties inherited from IKVM.Runtime.RuntimeClassLoader
virtual IDiagnosticHandler Diagnostics [get]
 Gets the IDiagnosticHandler events originated by this class loader should be sent to.
 
RuntimeContext Context [get]
 Gets a reference to the RuntimeContext that this RuntimeClassLoader is hosted within.
 

Additional Inherited Members

- Protected Attributes inherited from IKVM.Runtime.RuntimeClassLoader
java.lang.ClassLoader javaClassLoader
 
- Package Functions inherited from IKVM.Runtime.RuntimeClassLoader
- Static Package Functions inherited from IKVM.Runtime.RuntimeClassLoader

Detailed Description

Implementation of RuntimeClassLoader that emits loaded Java types to an AssemblyBuilder.

Definition at line 50 of file ImportClassLoader.cs.

Constructor & Destructor Documentation

◆ ImportClassLoader()

IKVM.Tools.Importer.ImportClassLoader.ImportClassLoader ( RuntimeContext context,
StaticCompiler compiler,
IDiagnosticHandler diagnostics,
RuntimeAssemblyClassLoader[] referencedAssemblies,
ImportState options,
FileInfo assemblyPath,
bool targetIsModule,
string assemblyName,
Dictionary< string, Jar.Item > classes )

Initializes a new instance.

Parameters
context
compiler
diagnostics
referencedAssemblies
options
assemblyPath
targetIsModule
assemblyName
classes
Exceptions
ArgumentNullException

Definition at line 99 of file ImportClassLoader.cs.

99 :
100 base(context, options.codegenoptions, null)
101 {
102 this.compiler = compiler ?? throw new ArgumentNullException(nameof(compiler));
103 this.diagnostics = diagnostics ?? throw new ArgumentNullException(nameof(diagnostics));
104 this.referencedAssemblies = referencedAssemblies;
105 this.state = options;
106 this.classes = classes;
107 this.assemblyName = assemblyName;
108 this.assemblyFile = assemblyPath.Name;
109 this.assemblyDir = assemblyPath.DirectoryName;
110 this.targetIsModule = targetIsModule;
111 Diagnostics.GenericCompilerInfo($"Instantiate CompilerClassLoader for {assemblyName}");
112 }

Member Function Documentation

◆ CheckProhibitedPackage()

override void IKVM.Tools.Importer.ImportClassLoader.CheckProhibitedPackage ( string className)
protectedvirtual

Reimplemented from IKVM.Runtime.RuntimeClassLoader.

Definition at line 3256 of file ImportClassLoader.cs.

3257 {
3258 if (!state.bootstrap)
3259 {
3260 base.CheckProhibitedPackage(className);
3261 }
3262 }

◆ LoadClassImpl()

override RuntimeJavaType IKVM.Tools.Importer.ImportClassLoader.LoadClassImpl ( string name,
LoadMode mode )
protectedvirtual

Reimplemented from IKVM.Runtime.RuntimeClassLoader.

Definition at line 204 of file ImportClassLoader.cs.

205 {
206 foreach (RuntimeAssemblyClassLoader acl in referencedAssemblies)
207 {
208 var tw = acl.DoLoad(name);
209 if (tw != null)
210 return tw;
211 }
212
213 if (!peerLoading.ContainsKey(name))
214 {
215 peerLoading.Add(name, null);
216 try
217 {
218 foreach (ImportClassLoader ccl in peerReferences)
219 {
220 var tw = ccl.PeerLoad(name);
221 if (tw != null)
222 return tw;
223 }
224 if (state.sharedclassloader != null && state.sharedclassloader[0] != this)
225 {
226 var tw = state.sharedclassloader[0].PeerLoad(name);
227 if (tw != null)
228 return tw;
229 }
230 }
231 finally
232 {
233 peerLoading.Remove(name);
234 }
235 }
236
237 var tw1 = GetTypeWrapperCompilerHook(name);
238 if (tw1 != null)
239 {
240 return tw1;
241 }
242
243 // HACK the peer loading mess above may have indirectly loaded the classes without returning it,
244 // so we try once more here
245 tw1 = FindLoadedClass(name);
246 if (tw1 != null)
247 {
248 return tw1;
249 }
250
251 return FindOrLoadGenericClass(name, mode);
252 }
ImportClassLoader(RuntimeContext context, StaticCompiler compiler, IDiagnosticHandler diagnostics, RuntimeAssemblyClassLoader[] referencedAssemblies, ImportState options, FileInfo assemblyPath, bool targetIsModule, string assemblyName, Dictionary< string, Jar.Item > classes)
Initializes a new instance.

◆ ToString()

override string IKVM.Tools.Importer.ImportClassLoader.ToString ( )

Definition at line 199 of file ImportClassLoader.cs.

200 {
201 return "CompilerClassLoader:" + state.assembly;
202 }

Property Documentation

◆ Diagnostics

override IDiagnosticHandler IKVM.Tools.Importer.ImportClassLoader.Diagnostics
get

Definition at line 115 of file ImportClassLoader.cs.


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