1 11 package org.eclipse.jdt.internal.debug.eval.ast.instructions; 12 13 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.jdt.debug.core.IJavaClassType; 16 import org.eclipse.jdt.debug.core.IJavaValue; 17 18 23 public class Constructor extends CompoundInstruction { 24 25 private int fArgCount; 26 private String fSignature; 27 28 public Constructor(String signature, int argCount, int start) { 29 super(start); 30 fArgCount = argCount; 31 fSignature = signature; 32 } 33 34 public void execute() throws CoreException { 35 IJavaValue[] args = new IJavaValue[fArgCount]; 36 for (int i= fArgCount - 1; i >= 0; i--) { 38 args[i] = popValue(); 39 } 40 IJavaClassType clazz = (IJavaClassType)pop(); 41 IJavaValue result = clazz.newInstance(fSignature, args, getContext().getThread()); 42 push(result); 43 } 44 45 public String toString() { 46 return InstructionsEvaluationMessages.Constructor_constructor__1 + fSignature; 47 } 48 49 } 50 51 | Popular Tags |