nus-yam/ex-repair huggingface dataset:
Program: 19483
Project: 19483
Buggy source:
private FlagEntry<JsSourceType> createJsFile(String filename,String fileContent) throws IOException {
  File tempJsFile=File.createTempFile(filename,"String_Node_Str",Files.createTempDirectory("String_Node_Str").toFile());
  try (FileOutputStream fileOutputStream=new FileOutputStream(tempJsFile)){
    fileOutputStream.write(fileContent.getBytes(java.nio.charset.StandardCharsets.UTF_8));
  }
   return new FlagEntry<>(JsSourceType.JS,tempJsFile.getAbsolutePath());
}

Fixed version (ground truth):
private FlagEntry<JsSourceType> createJsFile(String filename,String fileContent) throws IOException {
  File tempJsFile=File.createTempFile(filename,"String_Node_Str",java.nio.file.Files.createTempDirectory("String_Node_Str").toFile());
  try (FileOutputStream fileOutputStream=new FileOutputStream(tempJsFile)){
    fileOutputStream.write(fileContent.getBytes(java.nio.charset.StandardCharsets.UTF_8));
  }
   return new FlagEntry<>(JsSourceType.JS,tempJsFile.getAbsolutePath());
}
Program: 19484
Project: 19484
Buggy source:
public void testGlobJs2() throws IOException, FlagUsageException {
  FlagEntry<JsSourceType> jsFile1=createJsFile("String_Node_Str","String_Node_Str");
  FlagEntry<JsSourceType> jsFile2=createJsFile("String_Node_Str","String_Node_Str");
  new File(jsFile2.value).renameTo(new File(new File(jsFile1.value).getParentFile() + File.separator + "String_Node_Str"));
  String glob=new File(jsFile1.value).getParent() + File.separator + "String_Node_Str";
  compileFiles("String_Node_Str",new FlagEntry<>(JsSourceType.JS,glob));
}

Fixed version (ground truth):
public void testGlobJs2() throws IOException {
  try {
    FlagEntry<JsSourceType> jsFile1=createJsFile("String_Node_Str","String_Node_Str");
    FlagEntry<JsSourceType> jsFile2=createJsFile("String_Node_Str","String_Node_Str");
    new File(jsFile2.value).renameTo(new File(new File(jsFile1.value).getParentFile() + File.separator + "String_Node_Str"));
    String glob=new File(jsFile1.value).getParent() + File.separator + "String_Node_Str";
    compileFiles("String_Node_Str",new FlagEntry<>(JsSourceType.JS,glob));
  }
 catch (  FlagUsageException e) {
    fail("String_Node_Str" + e);
  }
}
Program: 19485
Project: 19485
Buggy source:
private static FlagEntry<JsSourceType> createZipFile(Map<String,String> entryContentsByName) throws IOException {
  File tempZipFile=File.createTempFile("String_Node_Str","String_Node_Str",Files.createTempDirectory("String_Node_Str").toFile());
  try (ZipOutputStream zipOutputStream=new ZipOutputStream(new FileOutputStream(tempZipFile))){
    for (    Entry<String,String> entry : entryContentsByName.entrySet()) {
      zipOutputStream.putNextEntry(new ZipEntry(entry.getKey()));
      zipOutputStream.write(entry.getValue().getBytes(java.nio.charset.StandardCharsets.UTF_8));
    }
  }
   return new FlagEntry<>(JsSourceType.JS_ZIP,tempZipFile.getAbsolutePath());
}

Fixed version (ground truth):
private static FlagEntry<JsSourceType> createZipFile(Map<String,String> entryContentsByName) throws IOException {
  File tempZipFile=File.createTempFile("String_Node_Str","String_Node_Str",java.nio.file.Files.createTempDirectory("String_Node_Str").toFile());
  try (ZipOutputStream zipOutputStream=new ZipOutputStream(new FileOutputStream(tempZipFile))){
    for (    Entry<String,String> entry : entryContentsByName.entrySet()) {
      zipOutputStream.putNextEntry(new ZipEntry(entry.getKey()));
      zipOutputStream.write(entry.getValue().getBytes(java.nio.charset.StandardCharsets.UTF_8));
    }
  }
   return new FlagEntry<>(JsSourceType.JS_ZIP,tempZipFile.getAbsolutePath());
}
Program: 19486
Project: 19486
Buggy source:
public static JSType plus(JSType lhs,JSType rhs){
  if (lhs.equals(STRING) || rhs.equals(STRING)) {
    return STRING;
  }
  if (lhs.isUnknown() || lhs.isTop() || rhs.isUnknown()|| rhs.isTop()) {
    return UNKNOWN;
  }
  int newtype=(lhs.getMask() | rhs.getMask()) & STRING_MASK;
  if ((lhs.getMask() & ~STRING_MASK) != 0 && (rhs.getMask() & ~STRING_MASK) != 0) {
    newtype|=NUMBER_MASK;
  }
  return makeType(newtype);
}

Fixed version (ground truth):
public static JSType plus(JSType lhs,JSType rhs){
  if (!lhs.isUnknown() && !lhs.isBottom() && lhs.isSubtypeOf(STRING) || !rhs.isUnknown() && !rhs.isBottom() && rhs.isSubtypeOf(STRING)) {
    return STRING;
  }
  if (lhs.isUnknown() || lhs.isTop() || rhs.isUnknown()|| rhs.isTop()) {
    return UNKNOWN;
  }
  int newtype=(lhs.getMask() | rhs.getMask()) & STRING_MASK;
  if ((lhs.getMask() & ~STRING_MASK) != 0 && (rhs.getMask() & ~STRING_MASK) != 0) {
    newtype|=NUMBER_MASK;
  }
  return makeType(newtype);
}
Program: 19487
Project: 19487
Buggy source:
public void testEnumBasicTyping(){
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INEXISTENT_PROPERTY);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_OPERAND_TYPE);
}

Fixed version (ground truth):
public void testEnumBasicTyping(){
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INEXISTENT_PROPERTY);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str"));
}
Program: 19489
Project: 19489
Buggy source:
/** 
 * Creates JS source code inputs from a list of files.
 */
private List<SourceFile> createSourceInputs(List<FlagEntry<JsSourceType>> files,List<JsonFileSpec> jsonFiles) throws FlagUsageException, IOException {
  if (isInTestMode()) {
    return inputsSupplierForTesting != null ? inputsSupplierForTesting.get() : null;
  }
  if (files.isEmpty() && jsonFiles == null) {
    files=Collections.singletonList(new FlagEntry<JsSourceType>(JsSourceType.JS,"String_Node_Str"));
  }
  try {
    if (jsonFiles != null) {
      return createInputs(files,jsonFiles);
    }
 else {
      return createInputs(files,true);
    }
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Creates JS source code inputs from a list of files.
 */
private List<SourceFile> createSourceInputs(List<JsModuleSpec> jsModuleSpecs,List<FlagEntry<JsSourceType>> files,List<JsonFileSpec> jsonFiles) throws FlagUsageException, IOException {
  if (isInTestMode()) {
    return inputsSupplierForTesting != null ? inputsSupplierForTesting.get() : null;
  }
  if (files.isEmpty() && jsonFiles == null) {
    files=Collections.singletonList(new FlagEntry<JsSourceType>(JsSourceType.JS,"String_Node_Str"));
  }
  try {
    if (jsonFiles != null) {
      return createInputs(files,jsonFiles,jsModuleSpecs);
    }
 else {
      return createInputs(files,true,jsModuleSpecs);
    }
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}
Program: 19490
Project: 19490
Buggy source:
/** 
 * Creates JS extern inputs from a list of files.
 */
private List<SourceFile> createExternInputs(List<String> files) throws FlagUsageException, IOException {
  if (files.isEmpty()) {
    return ImmutableList.of(SourceFile.fromCode("String_Node_Str","String_Node_Str"));
  }
  List<FlagEntry<JsSourceType>> externFiles=new ArrayList<>();
  for (  String file : files) {
    externFiles.add(new FlagEntry<JsSourceType>(JsSourceType.EXTERN,file));
  }
  try {
    return createInputs(externFiles,false);
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Creates JS extern inputs from a list of files.
 */
private List<SourceFile> createExternInputs(List<String> files) throws FlagUsageException, IOException {
  if (files.isEmpty()) {
    return ImmutableList.of(SourceFile.fromCode("String_Node_Str","String_Node_Str"));
  }
  List<FlagEntry<JsSourceType>> externFiles=new ArrayList<>();
  for (  String file : files) {
    externFiles.add(new FlagEntry<JsSourceType>(JsSourceType.EXTERN,file));
  }
  try {
    return createInputs(externFiles,false,new ArrayList<JsModuleSpec>());
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}
Program: 19494
Project: 19494
Buggy source:
@Override public boolean isSubtypeOf(TypeI other){
  JSType type2=(JSType)other;
  if (isLoose() || type2.isLoose()) {
    return autobox().isSubtypeOfHelper(true,type2.autobox());
  }
 else {
    return isSubtypeOfHelper(true,type2);
  }
}

Fixed version (ground truth):
@Override public boolean isSubtypeOf(TypeI other){
  if (this == other) {
    return true;
  }
  JSType type2=(JSType)other;
  if (isLoose() || type2.isLoose()) {
    return autobox().isSubtypeOfHelper(true,type2.autobox());
  }
 else {
    return isSubtypeOfHelper(true,type2);
  }
}
Program: 19495
Project: 19495
Buggy source:
private boolean isInvariantWith(Multimap<String,JSType> typeMultimap,NominalType other){
  Preconditions.checkState(isGeneric());
  Preconditions.checkState(this.rawType == other.rawType);
  Map<String,JSType> newTypeMap=new LinkedHashMap<>();
  for (  String typeVar : typeMultimap.keySet()) {
    Collection<JSType> c=typeMultimap.get(typeVar);
    if (c.size() != 1) {
      return false;
    }
    newTypeMap.put(typeVar,Preconditions.checkNotNull(Iterables.getOnlyElement(c)));
  }
  NominalType instantiated=instantiateGenerics(newTypeMap);
  return Objects.equals(instantiated.typeMap,other.typeMap);
}

Fixed version (ground truth):
private boolean isInvariantWith(Multimap<String,JSType> typeMultimap,NominalType other){
  Preconditions.checkState(isGeneric());
  Preconditions.checkState(this.rawType == other.rawType);
  Map<String,JSType> newTypeMap=new LinkedHashMap<>();
  for (  String typeVar : typeMultimap.keySet()) {
    Collection<JSType> c=typeMultimap.get(typeVar);
    if (c.size() != 1) {
      return false;
    }
    newTypeMap.put(typeVar,Preconditions.checkNotNull(Iterables.getOnlyElement(c)));
  }
  NominalType instantiated=instantiateGenerics(newTypeMap);
  Map<String,JSType> otherMap=other.typeMap;
  for (  Map.Entry<String,JSType> entry : instantiated.typeMap.entrySet()) {
    JSType t1=entry.getValue();
    JSType t2=otherMap.get(entry.getKey());
    if (!t1.isSubtypeOf(t2) || !t2.isSubtypeOf(t1)) {
      return false;
    }
  }
  return true;
}
Program: 19499
Project: 19499
Buggy source:
/** 
 * Creates JS source code inputs from a list of files.
 */
private List<SourceFile> createSourceInputs(List<String> files,List<String> zips,List<JsonFileSpec> jsonFiles) throws FlagUsageException, IOException {
  if (isInTestMode()) {
    return inputsSupplierForTesting != null ? inputsSupplierForTesting.get() : null;
  }
  if (files.isEmpty() && zips.isEmpty() && jsonFiles == null) {
    files=Collections.singletonList("String_Node_Str");
  }
  try {
    if (jsonFiles != null) {
      return createInputs(files,jsonFiles);
    }
 else {
      return createInputs(files,zips,true);
    }
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Creates JS source code inputs from a list of files.
 */
private List<SourceFile> createSourceInputs(List<FlagEntry<JsSourceType>> files,List<JsonFileSpec> jsonFiles) throws FlagUsageException, IOException {
  if (isInTestMode()) {
    return inputsSupplierForTesting != null ? inputsSupplierForTesting.get() : null;
  }
  if (files.isEmpty() && jsonFiles == null) {
    files=Collections.singletonList(new FlagEntry<JsSourceType>(JsSourceType.JS,"String_Node_Str"));
  }
  try {
    if (jsonFiles != null) {
      return createInputs(files,jsonFiles);
    }
 else {
      return createInputs(files,true);
    }
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}
Program: 19500
Project: 19500
Buggy source:
/** 
 * Creates JS extern inputs from a list of files.
 */
private List<SourceFile> createExternInputs(List<String> files) throws FlagUsageException, IOException {
  if (files.isEmpty()) {
    return ImmutableList.of(SourceFile.fromCode("String_Node_Str","String_Node_Str"));
  }
  try {
    return createInputs(files,false);
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Creates JS extern inputs from a list of files.
 */
private List<SourceFile> createExternInputs(List<String> files) throws FlagUsageException, IOException {
  if (files.isEmpty()) {
    return ImmutableList.of(SourceFile.fromCode("String_Node_Str","String_Node_Str"));
  }
  List<FlagEntry<JsSourceType>> externFiles=new ArrayList<>();
  for (  String file : files) {
    externFiles.add(new FlagEntry<JsSourceType>(JsSourceType.EXTERN,file));
  }
  try {
    return createInputs(externFiles,false);
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}
Program: 19502
Project: 19502
Buggy source:
/** 
 * @param name Closure namespace used as an entry point. May start"goog:" when provided as a flag from the command line. Closure entry points may also be formatted as: 'moduleName:name.space' which specifies that the module name and provided namespace are different
 */
public static ModuleIdentifier forClosure(String name){
  String normalizedName=name;
  if (normalizedName.startsWith("String_Node_Str")) {
    normalizedName=normalizedName.substring(5);
  }
  String namespace=normalizedName;
  String moduleName=normalizedName;
  int splitPoint=normalizedName.indexOf(':');
  if (splitPoint != -1) {
    moduleName=normalizedName.substring(0,splitPoint);
    namespace=normalizedName.substring(Math.min(splitPoint + 1,normalizedName.length() - 1));
  }
  return new ModuleIdentifier(normalizedName,namespace,moduleName);
}

Fixed version (ground truth):
/** 
 * @param name Closure namespace used as an entry point. May start"goog:" when provided as a flag from the command line. Closure entry points may also be formatted as: 'goog:moduleName:name.space' which specifies that the module name and provided namespace are different
 */
public static ModuleIdentifier forClosure(String name){
  String normalizedName=name;
  if (normalizedName.startsWith("String_Node_Str")) {
    normalizedName=normalizedName.substring("String_Node_Str".length());
  }
  String namespace=normalizedName;
  String moduleName=normalizedName;
  int splitPoint=normalizedName.indexOf(':');
  if (splitPoint != -1) {
    moduleName=normalizedName.substring(0,splitPoint);
    namespace=normalizedName.substring(Math.min(splitPoint + 1,normalizedName.length() - 1));
  }
  return new ModuleIdentifier(normalizedName,namespace,moduleName);
}
Program: 19503
Project: 19503
Buggy source:
/** 
 * Enables or disables the preservation of all whitespace and formatting within a JSDoc comment. By default, whitespace is collapsed for all comments except @license and
 * @preserve blocks,<p>Setting this option has no effect if  {@link #isParseJsDocDocumentation()}returns false.
 * @param preserveJsDocWhitespace True to preserve whitespace in text extracted from JSDoc comments.
 */
public void setPreserveJsDocWhitespace(boolean preserveJsDocWhitespace){
  this.preserveJsDocWhitespace=preserveJsDocWhitespace;
}

Fixed version (ground truth):
/** 
 * Enables or disables the preservation of all whitespace and formatting within a JSDoc comment. By default, whitespace is collapsed for all comments except   {@literal @license} and{@literal @preserve} blocks,<p>Setting this option has no effect if  {@link #isParseJsDocDocumentation()}returns false.
 * @param preserveJsDocWhitespace True to preserve whitespace in text extracted from JSDoc comments.
 */
public void setPreserveJsDocWhitespace(boolean preserveJsDocWhitespace){
  this.preserveJsDocWhitespace=preserveJsDocWhitespace;
}
Program: 19505
Project: 19505
Buggy source:
/** 
 * Get a region around the indicated line number. The exact definition of a region is implementation specific, but it must contain the line indicated by the line number. A region must not start or end by a carriage return.
 * @param lineNumber the line number, 1 being the first line of the file
 * @return the region around the line number indicated, or <code>null</null>if it does not exist
 */
Region getSourceRegion(String sourceName,int lineNumber);

Fixed version (ground truth):
/** 
 * Get a region around the indicated line number. The exact definition of a region is implementation specific, but it must contain the line indicated by the line number. A region must not start or end by a carriage return.
 * @param lineNumber the line number, 1 being the first line of the file
 * @return the region around the line number indicated, or {@code null}if it does not exist
 */
Region getSourceRegion(String sourceName,int lineNumber);
Program: 19506
Project: 19506
Buggy source:
/** 
 * This class depends on an input set that contains the white-list. The format of each white-list string is: <file-name>:<line-number>?  <warning-description> # <optional-comment>
 * @param whitelist The set of JS-warnings that are white-listed. This isexpected to have similar format as  {@code formatWarning(JSError)}.
 */
public WhitelistWarningsGuard(Set<String> whitelist){
  Preconditions.checkNotNull(whitelist);
  this.whitelist=normalizeWhitelist(whitelist);
}

Fixed version (ground truth):
/** 
 * This class depends on an input set that contains the white-list. The format of each white-list string is:  {@code <file-name>:<line-number>?  <warning-description>}{@code # <optional-comment>}
 * @param whitelist The set of JS-warnings that are white-listed. This isexpected to have similar format as  {@code formatWarning(JSError)}.
 */
public WhitelistWarningsGuard(Set<String> whitelist){
  Preconditions.checkNotNull(whitelist);
  this.whitelist=normalizeWhitelist(whitelist);
}
Program: 19507
Project: 19507
Buggy source:
/** 
 * Adds a <entrypoint/> entry Each entrypoint entry must have one attribute, name.
 */
public void addEntryPoint(Parameter entrypoint){
  this.entryPointParams.add(entrypoint);
}

Fixed version (ground truth):
/** 
 * Adds a   {@code <entrypoint/>} entryEach entrypoint entry must have one attribute, name.
 */
public void addEntryPoint(Parameter entrypoint){
  this.entryPointParams.add(entrypoint);
}
Program: 19508
Project: 19508
Buggy source:
/** 
 * Adds a <warning/> entry Each warning entry must have two attributes, group and level. Group must contain one of the constants from DiagnosticGroups (e.g., "ACCESS_CONTROLS"), while level must contain one of the CheckLevel constants ("ERROR", "WARNING" or "OFF").
 */
public void addWarning(Warning warning){
  this.warnings.add(warning);
}

Fixed version (ground truth):
/** 
 * Adds a   {@code <warning/>} entryEach warning entry must have two attributes, group and level. Group must contain one of the constants from DiagnosticGroups (e.g., "ACCESS_CONTROLS"), while level must contain one of the CheckLevel constants ("ERROR", "WARNING" or "OFF").
 */
public void addWarning(Warning warning){
  this.warnings.add(warning);
}
Program: 19509
Project: 19509
Buggy source:
/** 
 * Constructs a DependencyInfo object with the given list of provides & requires. This does *not* copy the given lists, but uses them directly.
 * @param srcPathRelativeToClosure The closure-relative path of the fileassociated with this DependencyInfo.
 * @param pathOfDefiningFile The path to the file from which this dependencyinformation was extracted.
 * @param provides List of provided symbols.
 * @param requires List of required symbols.
 */
public SimpleDependencyInfo(String srcPathRelativeToClosure,String pathOfDefiningFile,List<String> provides,List<String> requires,boolean isModule){
  this.srcPathRelativeToClosure=srcPathRelativeToClosure;
  this.pathOfDefiningFile=pathOfDefiningFile;
  this.provides=provides;
  this.requires=requires;
  this.isModule=isModule;
}

Fixed version (ground truth):
/** 
 * Constructs a DependencyInfo object with the given list of provides and requires. This does *not* copy the given lists, but uses them directly.
 * @param srcPathRelativeToClosure The closure-relative path of the fileassociated with this DependencyInfo.
 * @param pathOfDefiningFile The path to the file from which this dependencyinformation was extracted.
 * @param provides List of provided symbols.
 * @param requires List of required symbols.
 */
public SimpleDependencyInfo(String srcPathRelativeToClosure,String pathOfDefiningFile,List<String> provides,List<String> requires,boolean isModule){
  this.srcPathRelativeToClosure=srcPathRelativeToClosure;
  this.pathOfDefiningFile=pathOfDefiningFile;
  this.provides=provides;
  this.requires=requires;
  this.isModule=isModule;
}
Program: 19510
Project: 19510
Buggy source:
/** 
 * Unify   {@code this}, which may contain free type variables, with   {@code other}, a concrete type, modifying the supplied  {@code typeMultimap} to add any new template varaible type bindings.
 * @return Whether unification succeeded
 */
boolean unifyWithSubtype(ObjectType other,List<String> typeParameters,Multimap<String,JSType> typeMultimap){
  if (fn != null) {
    if (other.fn == null || !fn.unifyWithSubtype(other.fn,typeParameters,typeMultimap)) {
      return false;
    }
  }
  if (nominalType != null && other.nominalType != null) {
    return nominalType.unifyWithSubtype(other.nominalType,typeParameters,typeMultimap);
  }
  if (nominalType != null || other.nominalType != null) {
    return false;
  }
  for (  String propName : this.props.keySet()) {
    Property thisProp=props.get(propName);
    Property otherProp=other.props.get(propName);
    if (otherProp != null && !thisProp.unifyWithSubtype(otherProp,typeParameters,typeMultimap)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Unify   {@code this}, which may contain free type variables, with   {@code other}, a concrete type, modifying the supplied  {@code typeMultimap} to add any new template varaible type bindings.
 * @return Whether unification succeeded
 */
boolean unifyWithSubtype(ObjectType other,List<String> typeParameters,Multimap<String,JSType> typeMultimap){
  if (fn != null) {
    if (other.fn == null || !fn.unifyWithSubtype(other.fn,typeParameters,typeMultimap)) {
      return false;
    }
  }
  if (nominalType != null && other.nominalType != null) {
    return nominalType.unifyWithSubtype(other.nominalType,typeParameters,typeMultimap);
  }
  if (nominalType != null && other.nominalType == null) {
    return false;
  }
  for (  String propName : this.props.keySet()) {
    Property thisProp=props.get(propName);
    Property otherProp=other.props.get(propName);
    if (otherProp != null && !thisProp.unifyWithSubtype(otherProp,typeParameters,typeMultimap)) {
      return false;
    }
  }
  return true;
}
Program: 19512
Project: 19512
Buggy source:
/** 
 * Unify the two types symmetrically, given that we have already instantiated the type variables of interest in   {@code t1} and {@code t2}, treating JSType.UNKNOWN as a "hole" to be filled.
 * @return The unified type, or null if unification fails
 */
static ObjectType unifyUnknowns(ObjectType t1,ObjectType t2){
  if (!Objects.equals(t1.nominalType,t2.nominalType)) {
    return null;
  }
  FunctionType newFn=null;
  if (t1.fn != null || t2.fn != null) {
    newFn=FunctionType.unifyUnknowns(t1.fn,t2.fn);
    if (newFn == null) {
      return null;
    }
  }
  PersistentMap<String,Property> newProps=PersistentMap.create();
  for (  String propName : t1.props.keySet()) {
    Property prop1=t1.props.get(propName);
    Property prop2=t2.props.get(propName);
    if (prop2 == null) {
      return null;
    }
    Property p=Property.unifyUnknowns(prop1,prop2);
    if (p == null) {
      return null;
    }
    newProps=newProps.with(propName,p);
  }
  return makeObjectType(t1.nominalType,newProps,newFn,t1.isLoose || t2.isLoose,ObjectKind.join(t1.objectKind,t2.objectKind));
}

Fixed version (ground truth):
/** 
 * Unify the two types symmetrically, given that we have already instantiated the type variables of interest in   {@code t1} and {@code t2}, treating JSType.UNKNOWN as a "hole" to be filled.
 * @return The unified type, or null if unification fails
 */
static ObjectType unifyUnknowns(ObjectType t1,ObjectType t2){
  NominalType nt1=t1.nominalType;
  NominalType nt2=t2.nominalType;
  NominalType nt;
  if (nt1 == null && nt2 == null) {
    nt=null;
  }
 else   if (nt1 == null || nt2 == null) {
    return null;
  }
 else {
    nt=NominalType.unifyUnknowns(nt1,nt2);
    if (nt == null) {
      return null;
    }
  }
  FunctionType newFn=null;
  if (t1.fn != null || t2.fn != null) {
    newFn=FunctionType.unifyUnknowns(t1.fn,t2.fn);
    if (newFn == null) {
      return null;
    }
  }
  PersistentMap<String,Property> newProps=PersistentMap.create();
  for (  String propName : t1.props.keySet()) {
    Property prop1=t1.props.get(propName);
    Property prop2=t2.props.get(propName);
    if (prop2 == null) {
      return null;
    }
    Property p=Property.unifyUnknowns(prop1,prop2);
    if (p == null) {
      return null;
    }
    newProps=newProps.with(propName,p);
  }
  return makeObjectType(nt,newProps,newFn,t1.isLoose || t2.isLoose,ObjectKind.join(t1.objectKind,t2.objectKind));
}
Program: 19515
Project: 19515
Buggy source:
private void visitVar(Node nameNode,Node parent){
  String name=nameNode.getString();
  if (this.currentScope.isNamespace(name) || NodeUtil.isTypedefDecl(nameNode) || NodeUtil.isEnumDecl(nameNode)) {
    if (!this.currentScope.isDefinedLocally(name,false)) {
      this.currentScope.addLocal(name,JSType.UNKNOWN,false,nameNode.isFromExterns());
    }
    return;
  }
  Node initializer=nameNode.getFirstChild();
  if (initializer != null && initializer.isFunction()) {
    return;
  }
 else   if (this.currentScope.isDefinedLocally(name,false)) {
    return;
  }
  if (parent.isCatch()) {
    this.currentScope.addLocal(name,JSType.UNKNOWN,false,false);
  }
 else {
    boolean isConst=isConst(nameNode);
    JSType declType=getVarTypeFromAnnotation(nameNode,this.currentScope);
    if (declType == null) {
      declType=mayInferFromRhsIfConst(nameNode);
    }
    this.currentScope.addLocal(name,declType,isConst,nameNode.isFromExterns());
  }
}

Fixed version (ground truth):
private void visitVar(Node nameNode,Node parent){
  String name=nameNode.getString();
  boolean isDefinedLocally=this.currentScope.isDefinedLocally(name,false);
  if (isDefinedLocally && this.currentScope.isNamespace(name)) {
    return;
  }
  if (NodeUtil.isTypedefDecl(nameNode) || NodeUtil.isEnumDecl(nameNode)) {
    if (!isDefinedLocally) {
      this.currentScope.addLocal(name,JSType.UNKNOWN,false,nameNode.isFromExterns());
    }
    return;
  }
  Node initializer=nameNode.getFirstChild();
  if (initializer != null && initializer.isFunction()) {
    return;
  }
  if (parent.isCatch()) {
    this.currentScope.addLocal(name,JSType.UNKNOWN,false,false);
  }
 else {
    boolean isConst=isConst(nameNode);
    JSType declType=getVarTypeFromAnnotation(nameNode,this.currentScope);
    if (declType == null) {
      declType=mayInferFromRhsIfConst(nameNode);
    }
    this.currentScope.addLocal(name,declType,isConst,nameNode.isFromExterns());
  }
}
Program: 19516
Project: 19516
Buggy source:
private DeclaredFunctionType computeFnDeclaredType(JSDocInfo fnDoc,String functionName,Node declNode,RawNominalType ownerType,NTIScope parentScope){
  Preconditions.checkArgument(declNode.isFunction() || declNode.isGetProp());
  if (fnDoc == null && !NodeUtil.functionHasInlineJsdocs(declNode)) {
    DeclaredFunctionType t=getDeclaredFunctionTypeFromContext(functionName,declNode,parentScope);
    if (t != null) {
      return t;
    }
  }
  RawNominalType ctorType=declNode.isFunction() ? nominaltypesByNode.get(declNode) : null;
  FunctionAndSlotType result=typeParser.getFunctionType(fnDoc,functionName,declNode,ctorType,ownerType,parentScope);
  Node qnameNode=declNode.isGetProp() ? declNode : NodeUtil.getFunctionNameNode(declNode);
  if (result.slotType != null && qnameNode != null && qnameNode.isName()) {
    parentScope.addSimpleType(qnameNode,result.slotType);
  }
  if (ctorType != null) {
    ctorType.setCtorFunction(result.functionType.toFunctionType(),commonTypes);
  }
  if (declNode.isFunction()) {
    maybeWarnFunctionDeclaration(declNode,result.functionType);
  }
  return result.functionType;
}

Fixed version (ground truth):
private DeclaredFunctionType computeFnDeclaredType(JSDocInfo fnDoc,String functionName,Node declNode,RawNominalType ownerType,NTIScope parentScope){
  Preconditions.checkArgument(declNode.isFunction() || declNode.isGetProp());
  if (fnDoc == null && !NodeUtil.functionHasInlineJsdocs(declNode)) {
    DeclaredFunctionType t=getDeclaredFunctionTypeFromContext(functionName,declNode,parentScope);
    if (t != null) {
      return t;
    }
  }
  RawNominalType ctorType=declNode.isFunction() ? nominaltypesByNode.get(declNode) : null;
  FunctionAndSlotType result=typeParser.getFunctionType(fnDoc,functionName,declNode,ctorType,ownerType,parentScope);
  Node qnameNode=declNode.isGetProp() ? declNode : NodeUtil.getFunctionNameNode(declNode);
  if (result.slotType != null && qnameNode != null && qnameNode.isName()) {
    parentScope.addLocal(qnameNode.getString(),result.slotType,false,qnameNode.isFromExterns());
  }
  if (ctorType != null) {
    ctorType.setCtorFunction(result.functionType.toFunctionType(),commonTypes);
  }
  if (declNode.isFunction()) {
    maybeWarnFunctionDeclaration(declNode,result.functionType);
  }
  return result.functionType;
}
Program: 19517
Project: 19517
Buggy source:
void addLocal(String name,JSType declType,boolean isConstant,boolean isFromExterns){
  Preconditions.checkArgument(!name.contains("String_Node_Str"));
  Preconditions.checkArgument(!isDefinedLocally(name,false));
  if (isConstant) {
    constVars.add(name);
  }
  if (isFromExterns) {
    externs.put(name,declType);
  }
 else {
    locals.put(name,declType);
  }
}

Fixed version (ground truth):
void addLocal(String name,JSType declType,boolean isConstant,boolean isFromExterns){
  Preconditions.checkArgument(!name.contains("String_Node_Str"));
  if (isConstant) {
    constVars.add(name);
  }
  if (isFromExterns) {
    externs.put(name,declType);
  }
 else {
    locals.put(name,declType);
  }
}
Program: 19518
Project: 19518
Buggy source:
private void addNamespaceLit(Node qnameNode,NamespaceLit nslit){
  Preconditions.checkArgument(!isNamespace(qnameNode));
  if (qnameNode.isName()) {
    String varName=qnameNode.getString();
    localNamespaces.put(varName,nslit);
    if (qnameNode.isFromExterns() && !externs.containsKey(varName)) {
      externs.put(qnameNode.getString(),null);
    }
  }
 else {
    QualifiedName qname=QualifiedName.fromNode(qnameNode);
    Namespace ns=getNamespace(qname.getLeftmostName());
    ns.addSubnamespace(qname.getAllButLeftmost(),nslit);
  }
}

Fixed version (ground truth):
private void addNamespaceLit(Node qnameNode,NamespaceLit nslit){
  if (qnameNode.isName()) {
    String varName=qnameNode.getString();
    Preconditions.checkArgument(!isDefinedLocally(varName,false) || !isNamespace(qnameNode));
    localNamespaces.put(varName,nslit);
    if (qnameNode.isFromExterns() && !externs.containsKey(varName)) {
      externs.put(qnameNode.getString(),null);
    }
  }
 else {
    Preconditions.checkArgument(!isNamespace(qnameNode));
    QualifiedName qname=QualifiedName.fromNode(qnameNode);
    Namespace ns=getNamespace(qname.getLeftmostName());
    ns.addSubnamespace(qname.getAllButLeftmost(),nslit);
  }
}
Program: 19519
Project: 19519
Buggy source:
public void testVarDefinitionsInExterns(){
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str");
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str");
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str");
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str");
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str");
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str");
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str",NewTypeInference.MISTYPED_ASSIGN_RHS);
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str",Joiner.on('\n').join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_ARGUMENT_TYPE);
}

Fixed version (ground truth):
public void testVarDefinitionsInExterns(){
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str");
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str");
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str");
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str");
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str");
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str","String_Node_Str",NewTypeInference.MISTYPED_ASSIGN_RHS);
  typeCheckCustomExterns(DEFAULT_EXTERNS + "String_Node_Str",Joiner.on('\n').join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_ARGUMENT_TYPE);
}
Program: 19520
Project: 19520
Buggy source:
public static SuggestedFix getFixForJsError(JSError error,AbstractCompiler compiler){
switch (error.getType().key) {
case "String_Node_Str":
    return getFixForDebuggerStatement(error);
case "String_Node_Str":
  return getFixForInexistentProperty(error);
case "String_Node_Str":
return getFixForMissingRequire(error,compiler);
case "String_Node_Str":
case "String_Node_Str":
return getFixForExtraRequire(error,compiler);
case "String_Node_Str":
return getFixForUnnecessaryCast(error,compiler);
default :
return null;
}
}

Fixed version (ground truth):
/** 
 * Creates a SuggestedFix for the given error. Note that some errors have multiple fixes so getFixesForJsError should often be used instead of this.
 */
public static SuggestedFix getFixForJsError(JSError error,AbstractCompiler compiler){
switch (error.getType().key) {
case "String_Node_Str":
    return getFixForDebuggerStatement(error);
case "String_Node_Str":
  return getFixForInexistentProperty(error);
case "String_Node_Str":
return getFixForMissingRequire(error,compiler);
case "String_Node_Str":
case "String_Node_Str":
return getFixForExtraRequire(error,compiler);
case "String_Node_Str":
return getFixForUnnecessaryCast(error,compiler);
default :
return null;
}
}
Program: 19521
Project: 19521
Buggy source:
private static JSType pickReqObjType(Node expr){
  int exprKind=expr.getType();
switch (exprKind) {
case Token.GETPROP:
    return JSType.TOP_STRUCT;
case Token.GETELEM:
case Token.IN:
  return JSType.TOP_DICT;
case Token.FOR:
Preconditions.checkState(NodeUtil.isForIn(expr));
return JSType.TOP_DICT;
case Token.OBJECTLIT:
{
JSDocInfo jsdoc=expr.getJSDocInfo();
if (jsdoc != null && jsdoc.makesStructs()) {
return JSType.TOP_STRUCT;
}
if (jsdoc != null && jsdoc.makesDicts()) {
return JSType.TOP_DICT;
}
return JSType.TOP_OBJECT;
}
default :
throw new RuntimeException("String_Node_Str" + Token.name(exprKind));
}
}

Fixed version (ground truth):
private static JSType pickReqObjType(Node expr){
  int exprKind=expr.getType();
switch (exprKind) {
case Token.GETPROP:
    return JSType.TOP_STRUCT;
case Token.GETELEM:
  return JSType.TOP_DICT;
case Token.OBJECTLIT:
{
  JSDocInfo jsdoc=expr.getJSDocInfo();
  if (jsdoc != null && jsdoc.makesStructs()) {
    return JSType.TOP_STRUCT;
  }
  if (jsdoc != null && jsdoc.makesDicts()) {
    return JSType.TOP_DICT;
  }
  return JSType.TOP_OBJECT;
}
case Token.FOR:
Preconditions.checkState(NodeUtil.isForIn(expr));
return JSType.TOP_OBJECT;
case Token.IN:
return JSType.TOP_OBJECT;
default :
throw new RuntimeException("String_Node_Str" + Token.name(exprKind));
}
}
Program: 19522
Project: 19522
Buggy source:
/** 
 * Dump the CART tree as a dot file. <p> The dot tool is part of the graphviz distribution at <a href="http://www.graphviz.org/">http://www.graphviz.org/</a>. If installed, call it as "dot -O -Tpdf *.dot" from the console to generate pdfs. </p>
 * @param out The PrintWriter to write to.
 */
public void dumpDot(PrintWriter out){
  out.write("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  out.write("String_Node_Str");
  for (  Node n : cart) {
    out.println("String_Node_Str" + Math.abs(n.hashCode()) + "String_Node_Str"+ n.toString()+ "String_Node_Str"+ dumpDotNodeColor(n)+ "String_Node_Str"+ dumpDotNodeShape(n)+ "String_Node_Str");
    if (n instanceof DecisionNode) {
      DecisionNode dn=(DecisionNode)n;
      if (dn.qtrue < cart.length && cart[dn.qtrue] != null) {
        out.write("String_Node_Str" + Math.abs(n.hashCode()) + "String_Node_Str"+ Math.abs(cart[dn.qtrue].hashCode())+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      }
      if (dn.qfalse < cart.length && cart[dn.qfalse] != null) {
        out.write("String_Node_Str" + Math.abs(n.hashCode()) + "String_Node_Str"+ Math.abs(cart[dn.qfalse].hashCode())+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      }
    }
  }
  out.write("String_Node_Str");
  out.close();
}

Fixed version (ground truth):
/** 
 * Dump the CART tree as a dot file. <p> The dot tool is part of the graphviz distribution at <a href="http://www.graphviz.org/">http://www.graphviz.org/</a>. If installed, call it as "dot -O -Tpdf *.dot" from the console to generate pdfs. </p>
 * @param out The PrintWriter to write to.
 */
public void dumpDot(PrintWriter out){
  out.write("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  out.write("String_Node_Str");
  for (  Node n : cart) {
    out.println("String_Node_Str" + n.hashCode() + "String_Node_Str"+ n.toString()+ "String_Node_Str"+ dumpDotNodeColor(n)+ "String_Node_Str"+ dumpDotNodeShape(n)+ "String_Node_Str");
    if (n instanceof DecisionNode) {
      DecisionNode dn=(DecisionNode)n;
      if (dn.qtrue < cart.length && cart[dn.qtrue] != null) {
        out.write("String_Node_Str" + n.hashCode() + "String_Node_Str"+ cart[dn.qtrue].hashCode()+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      }
      if (dn.qfalse < cart.length && cart[dn.qfalse] != null) {
        out.write("String_Node_Str" + n.hashCode() + "String_Node_Str"+ cart[dn.qfalse].hashCode()+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      }
    }
  }
  out.write("String_Node_Str");
  out.close();
}
Program: 19524
Project: 19524
Buggy source:
@Override public String toString(){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str" + start + "String_Node_Str"+ isyms+ "String_Node_Str"+ osyms+ "String_Node_Str"+ semiring+ "String_Node_Str");
  int numStates=states.size();
  for (int i=0; i < numStates; i++) {
    State s=states.get(i);
    sb.append("String_Node_Str" + s + "String_Node_Str");
    int numArcs=s.getNumArcs();
    for (int j=0; j < numArcs; j++) {
      Arc a=s.getArc(j);
      sb.append("String_Node_Str" + a + "String_Node_Str");
    }
  }
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str" + start + "String_Node_Str"+ Arrays.toString(isyms)+ "String_Node_Str"+ Arrays.toString(osyms)+ "String_Node_Str"+ semiring+ "String_Node_Str");
  int numStates=states.size();
  for (int i=0; i < numStates; i++) {
    State s=states.get(i);
    sb.append("String_Node_Str" + s + "String_Node_Str");
    int numArcs=s.getNumArcs();
    for (int j=0; j < numArcs; j++) {
      Arc a=s.getArc(j);
      sb.append("String_Node_Str" + a + "String_Node_Str");
    }
  }
  return sb.toString();
}
Program: 19525
Project: 19525
Buggy source:
@Override public String toString(){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str" + start + "String_Node_Str"+ isyms+ "String_Node_Str"+ osyms+ "String_Node_Str"+ semiring+ "String_Node_Str");
  int numStates=states.length;
  for (int i=0; i < numStates; i++) {
    State s=states[i];
    sb.append("String_Node_Str" + s + "String_Node_Str");
    int numArcs=s.getNumArcs();
    for (int j=0; j < numArcs; j++) {
      Arc a=s.getArc(j);
      sb.append("String_Node_Str" + a + "String_Node_Str");
    }
  }
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str" + start + "String_Node_Str"+ Arrays.toString(isyms)+ "String_Node_Str"+ Arrays.toString(osyms)+ "String_Node_Str"+ semiring+ "String_Node_Str");
  int numStates=states.length;
  for (int i=0; i < numStates; i++) {
    State s=states[i];
    sb.append("String_Node_Str" + s + "String_Node_Str");
    int numArcs=s.getNumArcs();
    for (int j=0; j < numArcs; j++) {
      Arc a=s.getArc(j);
      sb.append("String_Node_Str" + a + "String_Node_Str");
    }
  }
  return sb.toString();
}
Program: 19527
Project: 19527
Buggy source:
/** 
 * Calculates the shortest distances from each state to the final
 * @param fst the fst to calculate the shortest distances
 * @return the array containing the shortest distances
 */
public static float[] shortestDistance(Fst fst){
  Fst reversed=Reverse.get(fst);
  float[] d=new float[reversed.getNumStates()];
  float[] r=new float[reversed.getNumStates()];
  Semiring semiring=reversed.getSemiring();
  Arrays.fill(d,semiring.zero());
  Arrays.fill(r,semiring.zero());
  LinkedHashSet<State> queue=new LinkedHashSet<State>();
  queue.add(reversed.getStart());
  d[reversed.getStart().getId()]=semiring.one();
  r[reversed.getStart().getId()]=semiring.one();
  while (!queue.isEmpty()) {
    State q=queue.iterator().next();
    queue.remove(q);
    float rnew=r[q.getId()];
    r[q.getId()]=semiring.zero();
    for (int i=0; i < q.getNumArcs(); i++) {
      Arc a=q.getArc(i);
      State nextState=a.getNextState();
      float dnext=d[a.getNextState().getId()];
      float dnextnew=semiring.plus(dnext,semiring.times(rnew,a.getWeight()));
      if (dnext != dnextnew) {
        d[a.getNextState().getId()]=dnextnew;
        r[a.getNextState().getId()]=semiring.plus(r[a.getNextState().getId()],semiring.times(rnew,a.getWeight()));
        if (!queue.contains(nextState.getId())) {
          queue.add(nextState);
        }
      }
    }
  }
  return d;
}

Fixed version (ground truth):
/** 
 * Calculates the shortest distances from each state to the final
 * @param fst the fst to calculate the shortest distances
 * @return the array containing the shortest distances
 */
public static float[] shortestDistance(Fst fst){
  Fst reversed=Reverse.get(fst);
  float[] d=new float[reversed.getNumStates()];
  float[] r=new float[reversed.getNumStates()];
  Semiring semiring=reversed.getSemiring();
  Arrays.fill(d,semiring.zero());
  Arrays.fill(r,semiring.zero());
  LinkedHashSet<State> queue=new LinkedHashSet<State>();
  queue.add(reversed.getStart());
  d[reversed.getStart().getId()]=semiring.one();
  r[reversed.getStart().getId()]=semiring.one();
  while (!queue.isEmpty()) {
    State q=queue.iterator().next();
    queue.remove(q);
    float rnew=r[q.getId()];
    r[q.getId()]=semiring.zero();
    for (int i=0; i < q.getNumArcs(); i++) {
      Arc a=q.getArc(i);
      State nextState=a.getNextState();
      float dnext=d[a.getNextState().getId()];
      float dnextnew=semiring.plus(dnext,semiring.times(rnew,a.getWeight()));
      if (dnext != dnextnew) {
        d[a.getNextState().getId()]=dnextnew;
        r[a.getNextState().getId()]=semiring.plus(r[a.getNextState().getId()],semiring.times(rnew,a.getWeight()));
        if (!queue.contains(nextState)) {
          queue.add(nextState);
        }
      }
    }
  }
  return d;
}
Program: 19528
Project: 19528
Buggy source:
/** 
 * Calculate the score for this mixture against the given feature. We model the output distributions using a mixture of Gaussians, therefore the current implementation is simply the computation of a multi-dimensional Gaussian. <p> <b>Normal(x) = exp{-0.5 * (x-m)'  inv(Var) * (x-m)} / {sqrt((2 * PI) ^ N) * det(Var))}</b></p> <p> where <b>x</b> and <b>m</b> are the incoming cepstra and mean vector respectively, <b>Var</b> is the Covariance matrix, <b>det()</b> is the determinant of a matrix, <b>inv()</b> is its inverse, <b>exp</b> is the exponential operator, <b>x'</b> is the transposed vector of <b>x</b> and <b>N</b> is the dimension of the vectors <b>x</b> and <b>m</b>.
 * @param feature the feature to score
 * @return the score, in log, for the given feature
 */
public float getScore(float[] feature){
  float logDval=logPreComputedGaussianFactor;
  for (int i=0; i < feature.length; i++) {
    float logDiff=feature[i] - meanTransformed[i];
    logDval+=logDiff * logDiff * precisionTransformed[i];
  }
  logDval=logMath.lnToLog(logDval);
  if (Float.isNaN(logDval)) {
    System.out.println("String_Node_Str");
    logDval=LogMath.LOG_ZERO;
  }
  if (logDval < distFloor) {
    logDval=distFloor;
  }
  return logDval;
}

Fixed version (ground truth):
/** 
 * Calculate the score for this mixture against the given feature. We model the output distributions using a mixture of Gaussians, therefore the current implementation is simply the computation of a multi-dimensional Gaussian. <p> <b>Normal(x) = exp{-0.5 * (x-m)'  inv(Var) * (x-m)} / {sqrt((2 * PI) ^ N) * det(Var))}</b></p> <p> where <b>x</b> and <b>m</b> are the incoming cepstra and mean vector respectively, <b>Var</b> is the Covariance matrix, <b>det()</b> is the determinant of a matrix, <b>inv()</b> is its inverse, <b>exp</b> is the exponential operator, <b>x'</b> is the transposed vector of <b>x</b> and <b>N</b> is the dimension of the vectors <b>x</b> and <b>m</b>.
 * @param feature the feature to score
 * @return the score, in log, for the given feature
 */
public float getScore(float[] feature){
  float logDval=logPreComputedGaussianFactor;
  for (int i=0; i < feature.length; i++) {
    float logDiff=feature[i] - meanTransformed[i];
    logDval+=logDiff * logDiff * precisionTransformed[i];
  }
  logDval=LogMath.getLogMath().lnToLog(logDval);
  if (Float.isNaN(logDval)) {
    System.out.println("String_Node_Str");
    logDval=LogMath.LOG_ZERO;
  }
  if (logDval < distFloor) {
    logDval=distFloor;
  }
  return logDval;
}