vmconstimethodref.java

来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 52 行

JAVA
52
字号
/**
 * $Id: VmConstIMethodRef.java,v 1.4 2004/02/24 08:04:15 epr Exp $
 */
package org.jnode.vm.classmgr;

/**
 * Entry of a constantpool describing an interface method reference.
 * 
 * @author epr
 */
public class VmConstIMethodRef extends VmConstMethodRef {

	/** The selector of this methods name&type */
	private int selector = -1;

	/**
	 * Constructor for VmIMethodRef.
	 * @param cp
	 * @param classIndex
	 * @param nameTypeIndex
	 */
	public VmConstIMethodRef(VmCP cp, int classIndex, int nameTypeIndex) {
		super(cp, classIndex, nameTypeIndex);
	}

	/**
	 * Resolve the references of this constant to loaded VmXxx objects.
	 * @param clc
	 */
	protected void doResolveMember(VmClassLoader clc) {
		final VmType vmClass = getConstClass().getResolvedVmClass();
		if (!vmClass.isInterface()) {
			throw new IncompatibleClassChangeError(getClassName() + " must be an interface");
		}
		final VmMethod vmMethod;
		vmMethod = vmClass.getMethod(getName(), getSignature());	
		if (vmMethod == null) {
			throw new NoSuchMethodError(toString() + " in class " + getClassName());
		}
		this.selector = vmMethod.getSelector();
		setResolvedVmMethod(vmMethod);
	}
	
	/** 
	 * Gets the selector of this methods name&type
	 * @return int
	 */
	public int getSelector() {
		return selector;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?