Program: 81630
Project: 81630
Buggy source:
/** 
 * Performs a precompilation, returning a unified AST.
 * @param logger the logger to use
 * @param module the module to compile
 * @param rpo the RebindPermutationOracle
 * @param declEntryPts the set of entry classes declared in a GWT module;these will be automatically rebound
 * @param additionalRootTypes additional classes that should serve as coderoots; will not be rebound; may be <code>null</code>
 * @param options the compiler options
 * @param singlePermutation if true, do not pre-optimize the resulting AST orallow serialization of the result
 * @param precompilationMetrics if not null, gather diagnostic informationfrom this build for a report.
 * @return the unified AST used to drive permutation compiles
 * @throws UnableToCompleteException if an error other than{@link OutOfMemoryError} occurs
 */
public static UnifiedAst precompile(TreeLogger logger,ModuleDef module,RebindPermutationOracle rpo,String[] declEntryPts,String[] additionalRootTypes,JJSOptions options,boolean singlePermutation,PrecompilationMetricsArtifact precompilationMetrics) throws UnableToCompleteException {
  InternalCompilerException.preload();
  if (additionalRootTypes == null) {
    additionalRootTypes=Empty.STRINGS;
  }
  if (declEntryPts.length + additionalRootTypes.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Set<String> allRootTypes=new TreeSet<String>();
  for (  String element : declEntryPts) {
    String[] all=rpo.getAllPossibleRebindAnswers(logger,element);
    Collections.addAll(allRootTypes,all);
  }
  rpo.getGeneratorContext().finish(logger);
  Collections.addAll(allRootTypes,additionalRootTypes);
  allRootTypes.addAll(JProgram.CODEGEN_TYPES_SET);
  allRootTypes.addAll(JProgram.INDEX_TYPES_SET);
  TypeOracle typeOracle=rpo.getCompilationState().getTypeOracle();
  for (  com.google.gwt.core.ext.typeinfo.JClassType singleJsoIntf : typeOracle.getSingleJsoImplInterfaces()) {
    allRootTypes.add(typeOracle.getSingleJsoImpl(singleJsoIntf).getQualifiedSourceName());
  }
  Memory.maybeDumpMemory("String_Node_Str");
  JProgram jprogram=new JProgram();
  JsProgram jsProgram=new JsProgram();
  try {
    UnifyAst unifyAst=new UnifyAst(jprogram,jsProgram,options,rpo);
    unifyAst.addRootTypes(allRootTypes);
    findEntryPoints(logger,rpo,declEntryPts,jprogram);
    unifyAst.exec(logger);
    List<String> finalTypeOracleTypes=Lists.create();
    if (precompilationMetrics != null) {
      for (      com.google.gwt.core.ext.typeinfo.JClassType type : typeOracle.getTypes()) {
        finalTypeOracleTypes=Lists.add(finalTypeOracleTypes,type.getPackage().getName() + "String_Node_Str" + type.getName());
      }
      precompilationMetrics.setFinalTypeOracleTypes(finalTypeOracleTypes);
    }
    rpo.clear();
    if (options.isSoycEnabled()) {
      SourceInfoCorrelator.exec(jprogram);
    }
    jprogram.typeOracle.computeBeforeAST();
    Memory.maybeDumpMemory("String_Node_Str");
    AstDumper.maybeDumpAST(jprogram);
    if (module != null) {
      ConfigurationProperty enumNameObfuscationProp=(ConfigurationProperty)module.getProperties().find(ENUM_NAME_OBFUSCATION_PROPERTY);
      if (enumNameObfuscationProp != null && Boolean.parseBoolean(enumNameObfuscationProp.getValue())) {
        EnumNameObfuscator.exec(jprogram,logger);
      }
    }
    FixAssignmentToUnbox.exec(jprogram);
    if (options.isEnableAssertions()) {
      AssertionNormalizer.exec(jprogram);
    }
 else {
      AssertionRemover.exec(jprogram);
    }
    if (module != null && options.isRunAsyncEnabled()) {
      ReplaceRunAsyncs.exec(logger,jprogram);
      CodeSplitter2.pickInitialLoadSequence(logger,jprogram,module.getProperties());
    }
    ImplementClassLiteralsAsFields.exec(jprogram);
    if (options.getOptimizationLevel() > OptionOptimize.OPTIMIZE_LEVEL_DRAFT && !singlePermutation) {
      if (options.isOptimizePrecompile()) {
        optimize(options,jprogram);
      }
 else {
        optimizeLoop("String_Node_Str",jprogram,false);
      }
    }
    Set<String> rebindRequests=new HashSet<String>();
    RecordRebinds.exec(jprogram,rebindRequests);
    if (options.isCompilerMetricsEnabled()) {
      precompilationMetrics.setAstTypes(getReferencedJavaClasses(jprogram));
    }
    logTrackingStats(logger);
    Event createUnifiedAstEvent=SpeedTracerLogger.start(CompilerEventType.CREATE_UNIFIED_AST);
    UnifiedAst result=new UnifiedAst(options,new AST(jprogram,jsProgram),singlePermutation,rebindRequests);
    createUnifiedAstEvent.end();
    return result;
  }
 catch (  Throwable e) {
    throw CompilationProblemReporter.logAndTranslateException(logger,e);
  }
 finally {
  }
}

Fixed version (ground truth):
/** 
 * Performs a precompilation, returning a unified AST.
 * @param logger the logger to use
 * @param module the module to compile
 * @param rpo the RebindPermutationOracle
 * @param declEntryPts the set of entry classes declared in a GWT module;these will be automatically rebound
 * @param additionalRootTypes additional classes that should serve as coderoots; will not be rebound; may be <code>null</code>
 * @param options the compiler options
 * @param singlePermutation if true, do not pre-optimize the resulting AST orallow serialization of the result
 * @param precompilationMetrics if not null, gather diagnostic informationfrom this build for a report.
 * @return the unified AST used to drive permutation compiles
 * @throws UnableToCompleteException if an error other than{@link OutOfMemoryError} occurs
 */
public static UnifiedAst precompile(TreeLogger logger,ModuleDef module,RebindPermutationOracle rpo,String[] declEntryPts,String[] additionalRootTypes,JJSOptions options,boolean singlePermutation,PrecompilationMetricsArtifact precompilationMetrics) throws UnableToCompleteException {
  InternalCompilerException.preload();
  if (additionalRootTypes == null) {
    additionalRootTypes=Empty.STRINGS;
  }
  if (declEntryPts.length + additionalRootTypes.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Set<String> allRootTypes=new TreeSet<String>();
  for (  String element : declEntryPts) {
    String[] all=rpo.getAllPossibleRebindAnswers(logger,element);
    Collections.addAll(allRootTypes,all);
  }
  rpo.getGeneratorContext().finish(logger);
  Collections.addAll(allRootTypes,additionalRootTypes);
  allRootTypes.addAll(JProgram.CODEGEN_TYPES_SET);
  allRootTypes.addAll(JProgram.INDEX_TYPES_SET);
  TypeOracle typeOracle=rpo.getCompilationState().getTypeOracle();
  for (  com.google.gwt.core.ext.typeinfo.JClassType singleJsoIntf : typeOracle.getSingleJsoImplInterfaces()) {
    allRootTypes.add(typeOracle.getSingleJsoImpl(singleJsoIntf).getQualifiedSourceName());
  }
  Memory.maybeDumpMemory("String_Node_Str");
  JProgram jprogram=new JProgram();
  JsProgram jsProgram=new JsProgram();
  try {
    UnifyAst unifyAst=new UnifyAst(logger,jprogram,jsProgram,options,rpo);
    unifyAst.addRootTypes(allRootTypes);
    findEntryPoints(logger,rpo,declEntryPts,jprogram);
    unifyAst.exec();
    List<String> finalTypeOracleTypes=Lists.create();
    if (precompilationMetrics != null) {
      for (      com.google.gwt.core.ext.typeinfo.JClassType type : typeOracle.getTypes()) {
        finalTypeOracleTypes=Lists.add(finalTypeOracleTypes,type.getPackage().getName() + "String_Node_Str" + type.getName());
      }
      precompilationMetrics.setFinalTypeOracleTypes(finalTypeOracleTypes);
    }
    rpo.clear();
    if (options.isSoycEnabled()) {
      SourceInfoCorrelator.exec(jprogram);
    }
    jprogram.typeOracle.computeBeforeAST();
    Memory.maybeDumpMemory("String_Node_Str");
    AstDumper.maybeDumpAST(jprogram);
    if (module != null) {
      ConfigurationProperty enumNameObfuscationProp=(ConfigurationProperty)module.getProperties().find(ENUM_NAME_OBFUSCATION_PROPERTY);
      if (enumNameObfuscationProp != null && Boolean.parseBoolean(enumNameObfuscationProp.getValue())) {
        EnumNameObfuscator.exec(jprogram,logger);
      }
    }
    FixAssignmentToUnbox.exec(jprogram);
    if (options.isEnableAssertions()) {
      AssertionNormalizer.exec(jprogram);
    }
 else {
      AssertionRemover.exec(jprogram);
    }
    if (module != null && options.isRunAsyncEnabled()) {
      ReplaceRunAsyncs.exec(logger,jprogram);
      CodeSplitter2.pickInitialLoadSequence(logger,jprogram,module.getProperties());
    }
    ImplementClassLiteralsAsFields.exec(jprogram);
    if (options.getOptimizationLevel() > OptionOptimize.OPTIMIZE_LEVEL_DRAFT && !singlePermutation) {
      if (options.isOptimizePrecompile()) {
        optimize(options,jprogram);
      }
 else {
        optimizeLoop("String_Node_Str",jprogram,false);
      }
    }
    Set<String> rebindRequests=new HashSet<String>();
    RecordRebinds.exec(jprogram,rebindRequests);
    if (options.isCompilerMetricsEnabled()) {
      precompilationMetrics.setAstTypes(getReferencedJavaClasses(jprogram));
    }
    logTrackingStats(logger);
    Event createUnifiedAstEvent=SpeedTracerLogger.start(CompilerEventType.CREATE_UNIFIED_AST);
    UnifiedAst result=new UnifiedAst(options,new AST(jprogram,jsProgram),singlePermutation,rebindRequests);
    createUnifiedAstEvent.end();
    return result;
  }
 catch (  Throwable e) {
    throw CompilationProblemReporter.logAndTranslateException(logger,e);
  }
 finally {
  }
}