/*
 * Class LiteralEvaluator
 * @author Jeka
 */
package com.intellij.debugger.engine.evaluation.expression;

import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
import com.intellij.debugger.impl.DebuggerUtilsEx;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil;
import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
import com.intellij.debugger.DebuggerBundle;

class LiteralEvaluator implements Evaluator {
  private Object myValue;
  private String myExpectedType;

  public LiteralEvaluator(Object value, String expectedType) {
    myValue = value;
    myExpectedType = expectedType;
  }

  public Modifier getModifier() {
    return null;
  }

  public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
    if (myValue == null) {
      return null;
    }
    VirtualMachineProxyImpl vm = context.getDebugProcess().getVirtualMachineProxy();
    if (myValue instanceof Boolean) {
      return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Boolean)myValue).booleanValue());
    }
    if (myValue instanceof Character) {
      return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Character)myValue).charValue());
    }
    if (myValue instanceof Number) {
      return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Number)myValue).doubleValue());
    }
    if (myValue instanceof String) {
      return vm.mirrorOf((String)myValue);
    }
    throw EvaluateExceptionUtil
      .createEvaluateException(DebuggerBundle.message("evaluation.error.unknown.expression.type", myExpectedType));
  }
}

@@ -136,98 +136,22 @@
 ger.
-engine.evaluation.EvaluationContextImpl;%0Aimport com.intellij.debugger.impl.DebuggerUtilsEx
+DebuggerBundle
 ;%0Aim
@@ -317,31 +317,43 @@
 ger.
-jdi.VirtualMachineProxy
+engine.evaluation.EvaluationContext
 Impl
@@ -379,32 +379,37 @@
 ij.debugger.
+impl.
 Debugger
 Bundle;%0A%0Acla
@@ -396,22 +396,81 @@
 Debugger
-Bundle
+UtilsEx;%0Aimport com.intellij.debugger.jdi.VirtualMachineProxyImpl
 ;%0A%0Aclass
@@ -1284,103 +1284,375 @@
 eof 
-Number) %7B%0A      return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Number)myValue).double
+Double) %7B%0A      return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Number)myValue).doubleValue());%0A    %7D%0A    if (myValue instanceof Float) %7B%0A      return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Number)myValue).floatValue());%0A    %7D%0A    if (myValue instanceof Number) %7B%0A      return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Number)myValue).long
 Valu

correct evaluation of large long literal values