Program: 29363
Project: 29363
Buggy source:
private Statement handleRepeatedNotNull(final SoyExpression listArg,FieldDescriptor field){
  Preconditions.checkArgument(listArg.isNonNullable());
  SoyExpression unboxed=listArg.unboxAs(List.class);
  Expression resolved=detacher.get().resolveSoyValueProviderList(unboxed);
  Scope scope=varManager.enterScope();
  final Statement scopeExit=scope.exitScope();
  final Variable list=scope.createTemporary(field.getName() + "String_Node_Str",resolved);
  final Variable index=scope.createTemporary(field.getName() + "String_Node_Str",constant(0));
  final Variable listSize=scope.createTemporary(field.getName() + "String_Node_Str",MethodRef.LIST_SIZE.invoke(list.local()));
  SoyType elementSoyType=((ListType)unboxed.soyType()).getElementType();
  SoyRuntimeType elementType=SoyRuntimeType.getBoxedType(elementSoyType);
  Expression getAndResolve=list.local().invoke(MethodRef.LIST_GET,index.local()).checkedCast(SOY_VALUE_PROVIDER_TYPE).invoke(MethodRef.SOY_VALUE_PROVIDER_RESOLVE).checkedCast(elementType.runtimeType());
  SoyExpression soyValue=SoyExpression.forSoyValue(elementType.soyType(),getAndResolve).asNonNullable();
  final Statement getAndAddOne=field.isExtension() ? handleExtension(soyValue,field) : handleNormalSetter(soyValue,field);
  return new Statement(){
    @Override void doGen(    CodeBuilder cb){
      list.initializer().gen(cb);
      listSize.initializer().gen(cb);
      listSize.local().gen(cb);
      Label listIsEmpty=new Label();
      cb.ifZCmp(Opcodes.IFEQ,listIsEmpty);
      index.initializer().gen(cb);
      Label loopStart=cb.mark();
      getAndAddOne.gen(cb);
      cb.iinc(index.local().index(),1);
      index.local().gen(cb);
      listSize.local().gen(cb);
      cb.ifICmp(Opcodes.IFLT,loopStart);
      cb.mark(listIsEmpty);
      scopeExit.gen(cb);
    }
  }
;
}

Fixed version (ground truth):
private Statement handleRepeatedNotNull(final SoyExpression listArg,FieldDescriptor field){
  Preconditions.checkArgument(listArg.isNonNullable());
  SoyExpression unboxed=listArg.unboxAs(List.class);
  Expression resolved=detacher.get().resolveSoyValueProviderList(unboxed);
  Scope scope=varManager.enterScope();
  final Variable list=scope.createTemporary(field.getName() + "String_Node_Str",resolved);
  final Variable index=scope.createTemporary(field.getName() + "String_Node_Str",constant(0));
  final Variable listSize=scope.createTemporary(field.getName() + "String_Node_Str",MethodRef.LIST_SIZE.invoke(list.local()));
  final Statement scopeExit=scope.exitScope();
  SoyType elementSoyType=((ListType)unboxed.soyType()).getElementType();
  SoyRuntimeType elementType=SoyRuntimeType.getBoxedType(elementSoyType);
  Expression getAndResolve=list.local().invoke(MethodRef.LIST_GET,index.local()).checkedCast(SOY_VALUE_PROVIDER_TYPE).invoke(MethodRef.SOY_VALUE_PROVIDER_RESOLVE).checkedCast(elementType.runtimeType());
  SoyExpression soyValue=SoyExpression.forSoyValue(elementType.soyType(),getAndResolve).asNonNullable();
  final Statement getAndAddOne=field.isExtension() ? handleExtension(soyValue,field) : handleNormalSetter(soyValue,field);
  return new Statement(){
    @Override void doGen(    CodeBuilder cb){
      list.initializer().gen(cb);
      listSize.initializer().gen(cb);
      listSize.local().gen(cb);
      Label listIsEmpty=new Label();
      cb.ifZCmp(Opcodes.IFEQ,listIsEmpty);
      index.initializer().gen(cb);
      Label loopStart=cb.mark();
      getAndAddOne.gen(cb);
      cb.iinc(index.local().index(),1);
      index.local().gen(cb);
      listSize.local().gen(cb);
      cb.ifICmp(Opcodes.IFLT,loopStart);
      cb.mark(listIsEmpty);
      scopeExit.gen(cb);
    }
  }
;
}