2using System.Collections.Generic;
3using System.Collections.Immutable;
4using System.Diagnostics;
18 readonly
Assembly _underlyingAssembly;
19 readonly ConditionalWeakTable<Module, IkvmReflectionModuleSymbol> _modules =
new();
21 global::System.Reflection.AssemblyName? _assemblyName;
22 ImmutableArray<CustomAttributeSymbol> _customAttributes =
default;
32 _underlyingAssembly = underlyingAssembly ??
throw new ArgumentNullException(nameof(underlyingAssembly));
43 Debug.Assert(module.Assembly == _underlyingAssembly);
47 internal Assembly UnderlyingAssembly => _underlyingAssembly;
49 public string?
FullName => _underlyingAssembly.FullName;
53 public IEnumerable<IModuleSymbol>
Modules => ResolveModuleSymbols(_underlyingAssembly.Modules);
55 public IEnumerable<ITypeSymbol>
DefinedTypes => ResolveTypeSymbols(_underlyingAssembly.DefinedTypes);
57 public IEnumerable<ITypeSymbol>
ExportedTypes => ResolveTypeSymbols(_underlyingAssembly.ExportedTypes);
61 public override bool IsMissing => _underlyingAssembly.__IsMissing;
65 return ResolveTypeSymbols(_underlyingAssembly.GetExportedTypes());
70 return _underlyingAssembly.GetModule(name) is
Module m ? GetOrCreateModuleSymbol(m) :
null;
75 return ResolveModuleSymbols(_underlyingAssembly.GetModules()).CastArray<
IModuleSymbol>();
78 public ImmutableArray<IModuleSymbol>
GetModules(
bool getResourceModules)
80 return ResolveModuleSymbols(_underlyingAssembly.GetModules(getResourceModules)).CastArray<
IModuleSymbol>();
83 global::System.Reflection.AssemblyName ToName(
AssemblyName src)
85#pragma warning disable SYSLIB0037
86 return new global::System.Reflection.AssemblyName()
89 Version = src.Version,
90 CultureName = src.CultureName,
91 HashAlgorithm = (global::System.Configuration.Assemblies.AssemblyHashAlgorithm)src.HashAlgorithm,
92 Flags = (global::System.Reflection.AssemblyNameFlags)src.Flags,
93 ContentType = (global::System.Reflection.AssemblyContentType)src.ContentType,
95#pragma warning restore SYSLIB0037
98 public global::System.Reflection.AssemblyName
GetName()
100 return _assemblyName ??= ToName(_underlyingAssembly.GetName());
105 var l = _underlyingAssembly.GetReferencedAssemblies().ToImmutableArray();
106 var a = ImmutableArray.CreateBuilder<global::System.Reflection.AssemblyName>(l.Length);
107 for (
int i = 0; i < l.Length; i++)
110 return a.DrainToImmutable();
125 return ResolveTypeSymbols(_underlyingAssembly.GetTypes());
130 return _customAttributes.IsDefault ? _customAttributes = ResolveCustomAttributes(_underlyingAssembly.GetCustomAttributesData()) : _customAttributes;
135 return ResolveCustomAttributes(_underlyingAssembly.__GetCustomAttributes(((
IkvmReflectionTypeSymbol)attributeType).UnderlyingType,
false));
IKVM.Reflection.Module Module
IKVM.Reflection.Type Type
IKVM.Reflection.Assembly Assembly
IKVM.Reflection.AssemblyName AssemblyName
global::java.lang.invoke.LambdaForm.Name Name
ImmutableArray< IModuleSymbol > GetModules(bool getResourceModules)
Gets all the modules that are part of this assembly, specifying whether to include resource modules.
ImmutableArray< global::System.Reflection.AssemblyName > GetReferencedAssemblies()
Gets the AssemblyName objects for all the assemblies referenced by this assembly.
IEnumerable< ITypeSymbol > DefinedTypes
Gets a collection of the types defined in this assembly.
IMethodSymbol? EntryPoint
Gets the entry point of this assembly.
ImmutableArray< IModuleSymbol > GetModules()
Gets all the modules that are part of this assembly.
bool IsDefined(ITypeSymbol attributeType)
Indicates whether one or more instance of attributeType is defined on this member.
ITypeSymbol? GetType(string name)
Gets the ITypeSymbol object with the specified name in the assembly instance.
ITypeSymbol? GetType(string name, bool throwOnError)
Gets the ITypeSymbol object with the specified name in the assembly instance and optionally throws an...
IModuleSymbol ManifestModule
Gets the module that contains the manifest for the current assembly.
ImmutableArray< CustomAttributeSymbol > GetCustomAttributes(ITypeSymbol attributeType)
Returns an array of custom attributes defined on this member, identified by type, or an empty array i...
override bool IsMissing
Returns true if the symbol is missing.
IEnumerable< IModuleSymbol > Modules
Gets a collection that contains the modules in this assembly.
ITypeSymbol[] GetTypes()
Gets all types defined in this assembly.
IModuleSymbol? GetModule(string name)
Gets the specified module in this assembly.
ImmutableArray< CustomAttributeSymbol > GetCustomAttributes()
Returns an array of all of the custom attributes defined on this member, excluding named attributes,...
global::System.Reflection.AssemblyName GetName()
Gets an AssemblyName for this assembly.
ITypeSymbol[] GetExportedTypes()
Gets the public types defined in this assembly that are visible outside the assembly.
string? FullName
Gets the display name of the assembly.
IkvmReflectionAssemblySymbol(IkvmReflectionSymbolContext context, Assembly underlyingAssembly)
Initializes a new instance.
IEnumerable< ITypeSymbol > ExportedTypes
Gets a collection of the public types defined in this assembly that are visible outside the assembly.
Implementation of IModuleSymbol derived from System.Reflection.
Holds references to symbols derived from System.Reflection.
IkvmReflectionTypeSymbol GetOrCreateTypeSymbol(Type type)
Gets or creates a IkvmReflectionTypeSymbol for the specified Type.
IkvmReflectionSymbolContext Context
Gets the associated IkvmReflectionSymbolContext.
Represents an assembly, which is a reusable, versionable, and self-describing building block of a com...
Discovers the attributes of a method and provides access to method metadata.
Performs reflection on a module.
Represents type declarations: class types, interface types, array types, value types,...