30 sealed partial class ClassFile
36 internal class ConstantPoolItemMI : ConstantPoolItemFMI
39 RuntimeJavaType[] argTypeWrappers;
40 RuntimeJavaType retTypeWrapper;
41 protected RuntimeJavaMethod method;
42 protected RuntimeJavaMethod invokespecialMethod;
50 public ConstantPoolItemMI(RuntimeContext context, ClassConstantHandle clazz, NameAndTypeConstantHandle nameAndTypeIndex) :
51 base(context, clazz, nameAndTypeIndex)
57 protected override void Validate(
string name,
string descriptor,
int majorVersion)
60 throw new ClassFormatError(
"Method {0} has invalid signature {1}", name, descriptor);
64 if (!ReferenceEquals(name, StringConstants.INIT))
67 if (!descriptor.EndsWith(
"V"))
68 throw new ClassFormatError(
"Method {0} has invalid signature {1}", name, descriptor);
73 public override void Link(RuntimeJavaType thisType,
LoadMode mode)
75 base.Link(thisType, mode);
78 if (argTypeWrappers != null)
81 var classLoader = thisType.ClassLoader;
82 var args = classLoader.ArgJavaTypeListFromSig(this.Signature, mode);
83 var ret = classLoader.RetTypeWrapperFromSig(this.Signature, mode);
86 if (argTypeWrappers ==
null)
88 argTypeWrappers = args;
94 public RuntimeJavaType[] GetArgTypes()
96 return argTypeWrappers;
99 public RuntimeJavaType GetRetType()
101 return retTypeWrapper;
104 public RuntimeJavaMethod GetMethod()
109 public RuntimeJavaMethod GetMethodForInvokespecial()
111 return invokespecialMethod ?? method;
115 public override RuntimeJavaMember GetMember()
static bool IsValidMethodDescriptor(string descriptor)
Returns true if the specified descriptor is a valid method descriptor.
static bool IsValidMethodName(string name, ClassFormatVersion version)
Returns true if the given string is a valid method name given the specified class format version.