private static Value convertToWrapper(
      EvaluationContextImpl context, PrimitiveValue value, String wrapperTypeName)
      throws EvaluateException {
    final DebugProcessImpl process = context.getDebugProcess();
    final ClassType wrapperClass = (ClassType) process.findClass(context, wrapperTypeName, null);
    final String methodSignature =
        "("
            + JVMNameUtil.getPrimitiveSignature(value.type().name())
            + ")L"
            + wrapperTypeName.replace('.', '/')
            + ";";

    List<Method> methods = wrapperClass.methodsByName("valueOf", methodSignature);
    if (methods.size() == 0) { // older JDK version
      methods = wrapperClass.methodsByName(JVMNameUtil.CONSTRUCTOR_NAME, methodSignature);
    }
    if (methods.size() == 0) {
      throw new EvaluateException(
          "Cannot construct wrapper object for value of type "
              + value.type()
              + ": Unable to find either valueOf() or constructor method");
    }

    return process.invokeMethod(
        context, wrapperClass, methods.get(0), Collections.singletonList(value));
  }
  public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
    final Object result = myOperand.evaluate(context);
    if (result == null || result instanceof ObjectReference) {
      return result;
    }

    if (result instanceof PrimitiveValue) {
      PrimitiveValue primitiveValue = (PrimitiveValue) result;
      PsiPrimitiveType primitiveType =
          PsiJavaParserFacadeImpl.getPrimitiveType(primitiveValue.type().name());
      if (primitiveType != null) {
        return convertToWrapper(context, primitiveValue, primitiveType.getBoxedTypeName());
      }
    }
    throw new EvaluateException(
        "Cannot perform boxing conversion for a value of type " + ((Value) result).type().name());
  }