internal override void Resolve(ClassFile classFile, string[] utf8_cp, ClassFileParseOptions options)
			{
				switch ((RefKind)ref_kind)
				{
					case RefKind.getField:
					case RefKind.getStatic:
					case RefKind.putField:
					case RefKind.putStatic:
						cpi = classFile.GetConstantPoolItem(method_index) as ConstantPoolItemFieldref;
						break;
					case RefKind.invokeSpecial:
					case RefKind.invokeVirtual:
					case RefKind.invokeStatic:
					case RefKind.newInvokeSpecial:
						cpi = classFile.GetConstantPoolItem(method_index) as ConstantPoolItemMethodref;
						break;
					case RefKind.invokeInterface:
						cpi = classFile.GetConstantPoolItem(method_index) as ConstantPoolItemInterfaceMethodref;
						break;
				}
				if (cpi == null)
				{
					throw new ClassFormatError("Invalid constant pool item MethodHandle");
				}
				if (ReferenceEquals(cpi.Name, StringConstants.INIT) && Kind != RefKind.newInvokeSpecial)
				{
					throw new ClassFormatError("Bad method name");
				}
			}
			internal override void Resolve(ClassFile classFile, string[] utf8_cp, ClassFileParseOptions options)
			{
				ConstantPoolItemNameAndType name_and_type = (ConstantPoolItemNameAndType)classFile.GetConstantPoolItem(name_and_type_index);
				// if the constant pool items referred to were strings, GetConstantPoolItem returns null
				if (name_and_type == null)
				{
					throw new ClassFormatError("Bad index in constant pool");
				}
				name = String.Intern(classFile.GetConstantPoolUtf8String(utf8_cp, name_and_type.name_index));
				descriptor = String.Intern(classFile.GetConstantPoolUtf8String(utf8_cp, name_and_type.descriptor_index).Replace('/', '.'));
			}
Beispiel #3
0
		internal override void Resolve(ClassFile classFile)
		{
			ConstantPoolItemNameAndType name_and_type = (ConstantPoolItemNameAndType) classFile.GetConstantPoolItem(name_and_type_index);
			clazz = (ConstantPoolItemClass) classFile.GetConstantPoolItem(class_index);
			// if the constant pool items referred to were strings, GetConstantPoolItem returns null
			if (name_and_type == null || clazz == null)
			{
				throw new ClassFormatError("Bad index in constant pool");
			}
			name = String.Intern(classFile.GetConstantPoolUtf8String(name_and_type.name_index));
			descriptor = classFile.GetConstantPoolUtf8String(name_and_type.descriptor_index);
			Validate(name, descriptor);
			descriptor = String.Intern(descriptor.Replace('/', '.'));
		}