Program: 45409
Project: 45409
Buggy source:
public PackageDefinitionNode parsePackageDefinition(){
  if (debug) {
    System.err.println("String_Node_Str");
  }
  if (within_package)   error(kError_NestedPackage);
  within_package=true;
  PackageDefinitionNode result;
  nodeFactory.dxns=null;
  block_kind_stack.add(PACKAGE_TOKEN);
  match(PACKAGE_TOKEN);
  HashSet<String> conf_ns=new HashSet<String>(config_namespaces.last().size());
  conf_ns.addAll(config_namespaces.last());
  config_namespaces.push_back(conf_ns);
  if (lookahead(LEFTBRACE_TOKEN)) {
    result=nodeFactory.startPackage(ctx,null,null);
    Node udn=nodeFactory.useDirective(null,nodeFactory.memberExpression(null,nodeFactory.getExpression(nodeFactory.identifier("String_Node_Str"))));
    Node idn=null;
    if (ctx.statics.es4_vectors) {
      PackageIdentifiersNode pin=nodeFactory.packageIdentifiers(null,nodeFactory.identifier("String_Node_Str"),true);
      pin=nodeFactory.packageIdentifiers(pin,nodeFactory.identifier("String_Node_Str"),true);
      pin=nodeFactory.packageIdentifiers(pin,nodeFactory.identifier("String_Node_Str"),true);
      idn=nodeFactory.importDirective(null,nodeFactory.packageName(pin),null,ctx);
    }
    result=nodeFactory.finishPackage(ctx,parseBlock());
    if ((ctx.dialect(10)) && result != null) {
      result.statements.items.add(1,udn);
    }
    if (!ctx.statics.use_namespaces.isEmpty() && result != null) {
      for (      String useName : ctx.statics.use_namespaces) {
        Node udn2=nodeFactory.useDirective(null,nodeFactory.memberExpression(null,nodeFactory.getExpression(nodeFactory.identifier(useName))));
        result.statements.items.add(1,udn2);
      }
    }
    if (ctx.statics.es4_vectors && result != null) {
      result.statements.items.add(1,idn);
    }
  }
 else {
    PackageNameNode first=parsePackageName(false);
    result=nodeFactory.startPackage(ctx,null,first);
    Node udn=nodeFactory.useDirective(null,nodeFactory.memberExpression(null,nodeFactory.getExpression(nodeFactory.identifier("String_Node_Str"))));
    Node idn=null;
    if (ctx.statics.es4_vectors) {
      PackageIdentifiersNode pin=nodeFactory.packageIdentifiers(null,nodeFactory.identifier("String_Node_Str"),true);
      pin=nodeFactory.packageIdentifiers(pin,nodeFactory.identifier("String_Node_Str"),true);
      pin=nodeFactory.packageIdentifiers(pin,nodeFactory.identifier("String_Node_Str"),true);
      idn=nodeFactory.importDirective(null,nodeFactory.packageName(pin),null,ctx);
    }
    result=nodeFactory.finishPackage(ctx,parseBlock());
    if ((ctx.dialect(10)) && result != null) {
      result.statements.items.add(1,udn);
    }
    if (!ctx.statics.use_namespaces.isEmpty() && result != null) {
      for (      String useName : ctx.statics.use_namespaces) {
        Node udn2=nodeFactory.useDirective(null,nodeFactory.memberExpression(null,nodeFactory.getExpression(nodeFactory.identifier(useName))));
        result.statements.items.add(1,udn2);
      }
    }
    if (ctx.statics.es4_vectors && result != null) {
      result.statements.items.add(1,idn);
    }
  }
  block_kind_stack.removeLast();
  config_namespaces.pop_back();
  if (debug) {
    System.err.println("String_Node_Str");
  }
  within_package=false;
  return result;
}

Fixed version (ground truth):
public PackageDefinitionNode parsePackageDefinition(){
  if (debug) {
    System.err.println("String_Node_Str");
  }
  if (within_package)   error(kError_NestedPackage);
  within_package=true;
  PackageDefinitionNode result;
  nodeFactory.dxns=null;
  block_kind_stack.add(PACKAGE_TOKEN);
  match(PACKAGE_TOKEN);
  HashSet<String> conf_ns=new HashSet<String>(config_namespaces.last().size());
  conf_ns.addAll(config_namespaces.last());
  config_namespaces.push_back(conf_ns);
  if (lookahead(LEFTBRACE_TOKEN)) {
    result=nodeFactory.startPackage(ctx,null,null);
    Node udn=nodeFactory.useDirective(null,nodeFactory.memberExpression(null,nodeFactory.getExpression(nodeFactory.identifier("String_Node_Str"))));
    ObjectList<UseDirectiveNode> udns=null;
    if (!ctx.statics.use_namespaces.isEmpty()) {
      udns=new ObjectList<UseDirectiveNode>();
      for (      String useName : ctx.statics.use_namespaces) {
        udns.add(nodeFactory.useDirective(null,nodeFactory.memberExpression(null,nodeFactory.getExpression(nodeFactory.identifier(useName)))));
      }
    }
    Node idn=null;
    if (ctx.statics.es4_vectors) {
      PackageIdentifiersNode pin=nodeFactory.packageIdentifiers(null,nodeFactory.identifier("String_Node_Str"),true);
      pin=nodeFactory.packageIdentifiers(pin,nodeFactory.identifier("String_Node_Str"),true);
      pin=nodeFactory.packageIdentifiers(pin,nodeFactory.identifier("String_Node_Str"),true);
      idn=nodeFactory.importDirective(null,nodeFactory.packageName(pin),null,ctx);
    }
    result=nodeFactory.finishPackage(ctx,parseBlock());
    if ((ctx.dialect(10)) && result != null) {
      result.statements.items.add(1,udn);
    }
    if (ctx.statics.es4_vectors && result != null) {
      result.statements.items.add(1,idn);
    }
    if (udns != null && result != null) {
      for (      UseDirectiveNode usenode : udns) {
        result.statements.items.add(1,usenode);
      }
    }
  }
 else {
    PackageNameNode first=parsePackageName(false);
    result=nodeFactory.startPackage(ctx,null,first);
    Node udn=nodeFactory.useDirective(null,nodeFactory.memberExpression(null,nodeFactory.getExpression(nodeFactory.identifier("String_Node_Str"))));
    ObjectList<UseDirectiveNode> udns=null;
    if (!ctx.statics.use_namespaces.isEmpty()) {
      udns=new ObjectList<UseDirectiveNode>();
      for (      String useName : ctx.statics.use_namespaces) {
        udns.add(nodeFactory.useDirective(null,nodeFactory.memberExpression(null,nodeFactory.getExpression(nodeFactory.identifier(useName)))));
      }
    }
    Node idn=null;
    if (ctx.statics.es4_vectors) {
      PackageIdentifiersNode pin=nodeFactory.packageIdentifiers(null,nodeFactory.identifier("String_Node_Str"),true);
      pin=nodeFactory.packageIdentifiers(pin,nodeFactory.identifier("String_Node_Str"),true);
      pin=nodeFactory.packageIdentifiers(pin,nodeFactory.identifier("String_Node_Str"),true);
      idn=nodeFactory.importDirective(null,nodeFactory.packageName(pin),null,ctx);
    }
    result=nodeFactory.finishPackage(ctx,parseBlock());
    if ((ctx.dialect(10)) && result != null) {
      result.statements.items.add(1,udn);
    }
    if (udns != null && result != null) {
      for (      UseDirectiveNode usenode : udns) {
        result.statements.items.add(1,usenode);
      }
    }
    if (ctx.statics.es4_vectors && result != null) {
      result.statements.items.add(1,idn);
    }
  }
  block_kind_stack.removeLast();
  config_namespaces.pop_back();
  if (debug) {
    System.err.println("String_Node_Str");
  }
  within_package=false;
  return result;
}