IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
IKVM.Runtime.RuntimeManagedByteCodeJavaType Class Reference

Represents a runtime Java type derived from a .NET assembly which was the result of the IKVM compiler. More...

Inheritance diagram for IKVM.Runtime.RuntimeManagedByteCodeJavaType:
IKVM.Runtime.RuntimeManagedByteCodeJavaType.GhostJavaType

Classes

class  CompiledAnnotation
 
class  GhostJavaType
 
class  RemappedJavaType
 

Public Member Functions

 RuntimeManagedByteCodeJavaType (RuntimeContext context, ExModifiers exmod, string name)
 Initializes a new instance.
 
 RuntimeManagedByteCodeJavaType (RuntimeContext context, string name, Type type)
 Initializes a new instance.
 

Protected Member Functions

override void LazyPublishMethods ()
 
override void LazyPublishFields ()
 

Detailed Description

Represents a runtime Java type derived from a .NET assembly which was the result of the IKVM compiler.

Definition at line 41 of file RuntimeManagedByteCodeJavaType.RemappedJavaType.cs.

Constructor & Destructor Documentation

◆ RuntimeManagedByteCodeJavaType() [1/2]

IKVM.Runtime.RuntimeManagedByteCodeJavaType.RuntimeManagedByteCodeJavaType ( RuntimeContext context,
ExModifiers exmod,
string name )

Initializes a new instance.

Parameters
context
exmod
name

Definition at line 181 of file RuntimeManagedByteCodeJavaType.cs.

181 :
182 base(context, exmod.IsInternal ? TypeFlags.InternalAccess : TypeFlags.None, exmod.Modifiers, name)
183 {
184 baseTypeWrapper = context.VerifierJavaTypeFactory.Null;
185 }

◆ RuntimeManagedByteCodeJavaType() [2/2]

IKVM.Runtime.RuntimeManagedByteCodeJavaType.RuntimeManagedByteCodeJavaType ( RuntimeContext context,
string name,
Type type )

Initializes a new instance.

Parameters
context
name
type

Definition at line 193 of file RuntimeManagedByteCodeJavaType.cs.

193 :
194 this(context, GetModifiers(context, type), name)
195 {
196 Debug.Assert(!(type is TypeBuilder));
197 Debug.Assert(!type.Name.EndsWith("[]"));
198
199 this.type = type;
200 }

Member Function Documentation

◆ LazyPublishFields()

override void IKVM.Runtime.RuntimeManagedByteCodeJavaType.LazyPublishFields ( )
protected

Definition at line 866 of file RuntimeManagedByteCodeJavaType.cs.

867 {
868 const BindingFlags flags = BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance;
869
870 var fields = new List<RuntimeJavaField>();
871 var rawfields = type.GetFields(flags);
872 Array.Sort(rawfields, SortFieldByToken);
873
874 // FXBUG on .NET 3.5 and Mono Type.GetProperties() will not return "duplicate" properties (i.e. that have the same name and type, but differ in custom modifiers).
875 // .NET 4.0 works as expected. We don't have a workaround, because that would require name mangling again and this situation is very unlikely anyway.
876 var properties = type.GetProperties(flags);
877 foreach (var field in rawfields)
878 {
879 var hideFromJavaFlags = Context.AttributeHelper.GetHideFromJavaFlags(field);
880 if ((hideFromJavaFlags & HideFromJavaFlags.Code) != 0)
881 {
882 if (field.Name.StartsWith(NamePrefix.Type2AccessStubBackingField, StringComparison.Ordinal))
883 {
884 var tw = GetFieldTypeWrapper(Context, field);
885 var name = field.Name.Substring(NamePrefix.Type2AccessStubBackingField.Length);
886 for (int i = 0; i < properties.Length; i++)
887 {
888 if (properties[i] != null && name == properties[i].Name && MatchTypes(tw, GetPropertyTypeWrapper(properties[i])))
889 {
890 fields.Add(new RuntimeManagedByteCodeAccessStubJavaField(this, properties[i], field, tw));
891 properties[i] = null;
892 break;
893 }
894 }
895 }
896 }
897 else
898 {
899 if (field.IsSpecialName && field.Name.StartsWith("__<", StringComparison.Ordinal))
900 {
901 // skip
902 }
903 else
904 {
905 fields.Add(CreateFieldWrapper(field, hideFromJavaFlags));
906 }
907 }
908 }
909
910 foreach (var property in properties)
911 if (property != null)
912 AddPropertyFieldWrapper(fields, property, null);
913
914 SetFields(fields.ToArray());
915 }
global::java.lang.invoke.LambdaForm.Name Name
AttributeHelper AttributeHelper
Gets the AttributeHelper associated with this instance of the runtime.

◆ LazyPublishMethods()

override void IKVM.Runtime.RuntimeManagedByteCodeJavaType.LazyPublishMethods ( )
protected

Definition at line 669 of file RuntimeManagedByteCodeJavaType.cs.

670 {
671 const BindingFlags flags = BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance;
672
673 var isDelegate = type.BaseType == Context.Types.MulticastDelegate;
674 var methods = new List<RuntimeJavaMethod>();
675
676 foreach (var ctor in type.GetConstructors(flags))
677 {
678 var hideFromJavaFlags = Context.AttributeHelper.GetHideFromJavaFlags(ctor);
679 if (isDelegate && !ctor.IsStatic && (hideFromJavaFlags & HideFromJavaFlags.Code) == 0)
680 methods.Add(new DelegateConstructorJavaMethod(this, ctor));
681 else
682 AddMethodOrConstructor(ctor, hideFromJavaFlags, methods);
683 }
684
685 AddMethods(type.GetMethods(flags), methods);
686
687 if (type.IsInterface && (type.IsPublic || type.IsNestedPublic))
688 {
689 var privateInterfaceMethods = type.GetNestedType(NestedTypeName.PrivateInterfaceMethods, BindingFlags.NonPublic);
690 if (privateInterfaceMethods != null)
691 AddMethods(privateInterfaceMethods.GetMethods(flags), methods);
692 }
693
694 SetMethods(methods.ToArray());
695 }
Types Types
Gets the Types associated with this instance of the runtime.
Type MulticastDelegate
Definition Types.cs:109

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