core/src/main/java/com/orientechnologies/orient/core/command/script/OCommandExecutorUtility.java
public static Object transformResult(Object result) {
    if (java8MethodIsArray == null || !(result instanceof Map)) {
      return result;
    }
    // PATCH BY MAT ABOUT NASHORN RETURNING VALUE FOR ARRAYS.
    try {
      if ((Boolean) java8MethodIsArray.invoke(result)) {
        List<?> partial = new ArrayList(((Map) result).values());
        List<Object> finalResult = new ArrayList<Object>();
        for (Object o : partial) {
          finalResult.add(transformResult(o));
        }
        return finalResult;
      } else {
        Map<Object, Object> mapResult = (Map) result;
        List<Object> keys = new ArrayList<Object>(mapResult.keySet());
        for (Object key : keys) {
          mapResult.put(key, transformResult(mapResult.get(key)));
        }
        return mapResult;
      }
    } catch (Exception e) {
      OLogManager.instance().error(OCommandExecutorUtility.class, "", e);
    }

    return result;
  }
public static Object transformResult(Object result) {
    if (java8MethodIsArray == null || !(result instanceof Map)) {
      return result;
    }
    // PATCH BY MAT ABOUT NASHORN RETURNING VALUE FOR ARRAYS.
    try {
      if ((Boolean) java8MethodIsArray.invoke(result)) {
        List<?> partial = new ArrayList(((Map) result).values());
        List<Object> finalResult = new ArrayList<Object>();
        for (Object o : partial) {
          finalResult.add(transformResult(o));
        }
        return finalResult;
      } else {
        Map<Object, Object> mapResult = (Map) result;
        List<Object> keys = new ArrayList<Object>(mapResult.keySet());
        for (Object key : keys) {
          mapResult.put(key, transformResult(mapResult.get(key)));
        }
        return mapResult;
      }
    } catch (Exception e) {
      OLogManager.instance().error(OCommandExecutorUtility.class, "", e);
    }

    return result;
  }
public static Object transformResult ( Object result ) { if ( java8MethodIsArray == null || ! ( result instanceof Map ) ) { return result ; } // PATCH BY MAT ABOUT NASHORN RETURNING VALUE FOR ARRAYS. try { if ( ( Boolean ) java8MethodIsArray . invoke ( result ) ) { List < ? > partial = new ArrayList ( ( ( Map ) result ) . values ( ) ) ; List < Object > finalResult = new ArrayList < Object > ( ) ; for ( Object o : partial ) { finalResult . add ( transformResult ( o ) ) ; } return finalResult ; } else { Map < Object , Object > mapResult = ( Map ) result ; List < Object > keys = new ArrayList < Object > ( mapResult . keySet ( ) ) ; for ( Object key : keys ) { mapResult . put ( key , transformResult ( mapResult . get ( key ) ) ) ; } return mapResult ; } } catch ( Exception e ) { OLogManager . instance ( ) . error ( OCommandExecutorUtility . class , "" , e ) ; } return result ; }
Manages cross compiler compatibility issues.

@param result Result to transform
Manages cross compiler compatibility issues .