private static void addConstants(HashSet<Constant> result, RegisterSpec spec) {
    if (spec == null) {
      return;
    }

    LocalItem local = spec.getLocalItem();
    CstString name = local.getName();
    CstString signature = local.getSignature();
    Type type = spec.getType();

    if (type != Type.KNOWN_NULL) {
      result.add(CstType.intern(type));
    } else {
      /* If this a "known null", let's use "Object" because that's going to be the
       * resulting type in {@link LocalList.MakeState#filterSpec} */
      result.add(CstType.intern(Type.OBJECT));
    }

    if (name != null) {
      result.add(name);
    }

    if (signature != null) {
      result.add(signature);
    }
  }
Helper for {@link #getAllConstants} which adds all the info for a single {@code RegisterSpec}.

@param result {@code non-null;} result set to add to
@param spec {@code null-ok;} register spec to add
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/code/OutputFinisher.java