28using IKVM.ByteCode.Decoding;
33 sealed partial class ClassFile
36 internal abstract class FieldOrMethod : IEquatable<FieldOrMethod>
39 readonly ClassFile clazz;
41 protected ushort flags;
44 protected string signature;
45 protected object[] annotations;
46 protected TypeAnnotationTable runtimeVisibleTypeAnnotations = TypeAnnotationTable.Empty;
47 protected TypeAnnotationTable runtimeInvisibleTypeAnnotations = TypeAnnotationTable.Empty;
57 internal FieldOrMethod(ClassFile clazz,
string[] utf8_cp, AccessFlag accessFlags, Utf8ConstantHandle name, Utf8ConstantHandle descriptor)
59 this.clazz = clazz ??
throw new ArgumentNullException(nameof(clazz));
60 this.accessFlags = (
Modifiers)accessFlags;
61 this.name =
string.Intern(clazz.GetConstantPoolUtf8String(utf8_cp, name));
62 this.descriptor = clazz.GetConstantPoolUtf8String(utf8_cp, descriptor);
64 ValidateSig(clazz, this.descriptor);
65 this.descriptor =
string.Intern(this.descriptor.Replace(
'/',
'.'));
71 public ClassFile
Class => clazz;
73 protected abstract void ValidateSig(ClassFile classFile,
string descriptor);
75 internal string Name => name;
77 internal string Signature => descriptor;
79 internal object[] Annotations => annotations;
81 internal string GenericSignature => signature;
85 internal bool IsAbstract => (accessFlags &
Modifiers.Abstract) != 0;
87 internal bool IsFinal => (accessFlags &
Modifiers.Final) != 0;
89 internal bool IsPublic => (accessFlags &
Modifiers.Public) != 0;
91 internal bool IsPrivate => (accessFlags &
Modifiers.Private) != 0;
93 internal bool IsProtected => (accessFlags &
Modifiers.Protected) != 0;
95 internal bool IsStatic => (accessFlags &
Modifiers.Static) != 0;
97 internal bool IsSynchronized => (accessFlags &
Modifiers.Synchronized) != 0;
99 internal bool IsVolatile => (accessFlags &
Modifiers.Volatile) != 0;
101 internal bool IsTransient => (accessFlags &
Modifiers.Transient) != 0;
103 internal bool IsNative => (accessFlags &
Modifiers.Native) != 0;
105 internal bool IsEnum => (accessFlags &
Modifiers.Enum) != 0;
107 internal bool DeprecatedAttribute => (flags & FLAG_MASK_DEPRECATED) != 0;
109 internal bool IsInternal => (flags & FLAG_MASK_INTERNAL) != 0;
111 internal bool IsModuleInitializer => (flags & FLAG_MODULE_INITIALIZER) != 0;
113 internal ref readonly TypeAnnotationTable RuntimeVisibleTypeAnnotations =>
ref runtimeVisibleTypeAnnotations;
115 public sealed override int GetHashCode() => name.GetHashCode() ^ descriptor.GetHashCode();
117 public bool Equals(FieldOrMethod other) => ReferenceEquals(name, other.name) && ReferenceEquals(descriptor, other.descriptor);
global::java.lang.Class Class
global::java.lang.invoke.LambdaForm.Name Name