code: protected <T> T mergeXMLValue(T oldValue,
                                    T newValue,
                                    String elementName,
                                    String key,
                                    Map<T, String> valueNames) throws InjectionConfigurationException {
          if (newValue == null) {
              return oldValue;
          }
  
          if (oldValue != null && !newValue.equals(oldValue)) {
              Object oldValueName = valueNames == null ? oldValue : valueNames.get(oldValue);
              Object newValueName = valueNames == null ? newValue : valueNames.get(newValue);
              mergeError(oldValueName, newValueName, true, elementName, false, key);
              return oldValue;
          }
  
          return newValue;
      }
docs: Merges a value specified in XML.
  
  <p>If an error occurs, {@link #mergeError} will be called, which
  requires {@link #getJNDIEnvironmentRefType} to be defined.
  
  @param oldValue the old value
  @param newValue the new value
  @param elementName the name of the XML element containing the value
  @param key the optional key to be passed to {@link #mergeError}
  @param valueNames the names of possible old and new values to be used
  for error messages, or null if the values themselves should
  be used when reporting errors
  @return the merged value
  @throws InjectionConfigurationException if an error occurs