报告对 java.util.Properties 对象上的以下方法的调用:

由于历史原因,java.util.Properties 继承 java.util.Hashtable,但为防止破坏 String 以外类型的属性值,不建议使用这些方法。

尽管 java.util.Properties#putAll 会重写 java.util.Hashtable#putAll,但当映射中的键值形参都为 String 类型时,就不会对它报告。

示例:


  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");
  }