private static SourcePosition calcPosition(final ValueDescriptor descriptor, final DebugProcessImpl debugProcess)
      throws ClassNotLoadedException {
      Type type = descriptor.getType();
      if (type == null) {
        return null;
      }

      try {
        if (type instanceof ArrayType arrayType) {
          type = arrayType.componentType();
        }
        if (type instanceof ClassType clsType) {

          Method lambdaMethod =
            MethodBytecodeUtil.getLambdaMethod(clsType, debugProcess.getVirtualMachineProxy().getClassesByNameProvider());
          Location location = lambdaMethod != null ? ContainerUtil.getFirstItem(DebuggerUtilsEx.allLineLocations(lambdaMethod)) : null;

          if (location == null) {
            location = ContainerUtil.getFirstItem(clsType.allLineLocations());
          }

          if (location != null) {
            SourcePosition position = debugProcess.getPositionManager().getSourcePosition(location);
            return ReadAction.compute(() -> {
              // adjust position for non-anonymous classes
              if (clsType.name().indexOf('$') < 0) {
                PsiClass classAt = JVMNameUtil.getClassAt(position);
                if (classAt != null) {
                  SourcePosition classPosition = SourcePosition.createFromElement(classAt);
                  if (classPosition != null) {
                    return classPosition;
                  }
                }
              }
              return position;
            });
          }
        }
      }
      catch (ClassNotPreparedException | AbsentInformationException e) {
        LOG.debug(e);
      }
      return null;
    }
private static SourcePosition calcPosition(final ValueDescriptor descriptor, final DebugProcessImpl debugProcess)