code: public static ImmutableMap<String, PrimitiveData> convertCompileTimeGlobalsMap(
        Map<String, ?> compileTimeGlobalsMap) {
  
      ImmutableMap.Builder<String, PrimitiveData> resultMapBuilder = ImmutableMap.builder();
  
      for (Map.Entry<String, ?> entry : compileTimeGlobalsMap.entrySet()) {
  
        Object valueObj = entry.getValue();
        PrimitiveData value;
        boolean isValidValue = true;
        try {
          SoyValue value0 = SoyValueConverter.INSTANCE.convert(valueObj).resolve();
          if (!(value0 instanceof PrimitiveData)) {
            isValidValue = false;
          }
          value = (PrimitiveData) value0;
        } catch (SoyDataException sde) {
          isValidValue = false;
          value = null; // make compiler happy
        }
        if (!isValidValue) {
          throw new IllegalArgumentException(
              "Compile-time globals map contains invalid value: "
                  + valueObj
                  + " for key: "
                  + entry.getKey());
        }
  
        resultMapBuilder.put(entry.getKey(), value);
      }
  
      return resultMapBuilder.build();
    }
docs: Converts a compile-time globals map in user-provided format into one in the internal format.
  
  <p>The returned map will have the same iteration order as the provided map.
  
  @param compileTimeGlobalsMap Map from compile-time global name to value. The values can be any
  of the Soy primitive types: null, boolean, integer, float (Java double), or string.
  @return An equivalent map in the internal format.
  @throws IllegalArgumentException If the map contains an invalid value.