java.util.Properties 객체에서 다음 메서드를 호출하는 경우를 보고합니다.

역사적인 이유로 java.util.Propertiesjava.util.Hashtable을 상속받지만 String 외의 타입을 가진 프로퍼티 값의 손상을 방지하기 위해 그러한 메서드는 사용하지 않는 것이 좋습니다.

맵 내의 키와 값 매개변수가 모두 String 타입인 경우 java.util.Properties.putAll() 호출은 보고되지 않습니다. 이러한 호출은 안전하며 더 나은 대안이 없습니다.

예:


  Object f(Properties props) {
    props.put("hello", "world");
    props.putIfAbsent("hello", "world");
    props.putAll(new HashMap<>());
    return props.get("Hello");
  }

빠른 수정을 적용한 후:


  Object f(Properties props) {
    props.setProperty("hello", "world");
    props.putIfAbsent("hello", "world");
    props.putAll(new HashMap<>());
    return props.getProperty("hello");
  }