blob: a11dbffad43e213ce337419e32a662323215d17b [file] [log] [blame]
/*
* (c) Copyright IBM Corp. 2000, 2001, 2002.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.debug.eval.ast.instructions;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.debug.core.IJavaObject;
import org.eclipse.jdt.debug.core.IJavaType;
import org.eclipse.jdt.debug.core.IJavaValue;
public class InstanceOfOperator extends CompoundInstruction {
public static final String IS_INSTANCE= "isInstance"; //$NON-NLS-1$
public static final String IS_INSTANCE_SIGNATURE= "(Ljava/lang/Object;)Z"; //$NON-NLS-1$
public InstanceOfOperator(int start) {
super(start);
}
/*
* @see Instruction#execute()
*/
public void execute() throws CoreException {
IJavaType type= (IJavaType)pop();
IJavaObject object= (IJavaObject)popValue();
IJavaObject classObject= getClassObject(type);
if (classObject == null) {
throw new CoreException(null);
} else {
push(classObject.sendMessage(IS_INSTANCE, IS_INSTANCE_SIGNATURE, new IJavaValue[] {object}, getContext().getThread(), false));
}
}
public String toString() {
return InstructionsEvaluationMessages.getString("InstanceOfOperator._instanceof___operator_3"); //$NON-NLS-1$
}
}