nus-yam/ex-repair huggingface dataset:
Program: 36191
Project: 36191
Buggy source:
/** 
 * Returns a copy of this duration with the specified duration subtracted. <p> The duration amount is measured in terms of the specified unit. Only a subset of units are accepted by this method. The unit must either have an   {@linkplain TemporalUnit#isDurationEstimated() exact duration} orbe  {@link ChronoUnit#DAYS} which is treated as 24 hours. Other units throw an exception.<p> This instance is immutable and unaffected by this method call.
 * @param amountToSubtract  the amount of the period, measured in terms of the unit, positive or negative
 * @param unit  the unit that the period is measured in, must have an exact duration, not null
 * @return a {@code Duration} based on this duration with the specified duration subtracted, not null
 * @throws ArithmeticException if numeric overflow occurs
 */
public Duration minus(long amountToSubtract,TemporalUnit unit){
  return (amountToSubtract == Long.MIN_VALUE ? plus(Long.MAX_VALUE,unit).plus(1,unit) : plus(-amountToSubtract,unit));
}

Fixed version (ground truth):
/** 
 * Returns a copy of this duration with the specified duration subtracted. <p> The duration amount is measured in terms of the specified unit. Only a subset of units are accepted by this method. The unit must either have an   {@linkplain TemporalUnit#isDurationEstimated() exact duration} orbe  {@link ChronoUnit#DAYS} which is treated as 24 hours. Other units throw an exception.<p> This instance is immutable and unaffected by this method call.
 * @param amountToSubtract  the amount to subtract, measured in terms of the unit, positive or negative
 * @param unit  the unit that the amount is measured in, must have an exact duration, not null
 * @return a {@code Duration} based on this duration with the specified duration subtracted, not null
 * @throws ArithmeticException if numeric overflow occurs
 */
public Duration minus(long amountToSubtract,TemporalUnit unit){
  return (amountToSubtract == Long.MIN_VALUE ? plus(Long.MAX_VALUE,unit).plus(1,unit) : plus(-amountToSubtract,unit));
}
Program: 36192
Project: 36192
Buggy source:
/** 
 * Gets the set of units supported by this duration. <p> The supported units are   {@link ChronoUnit#SECONDS SECONDS}, and   {@link ChronoUnit#NANOS NANOS}. They are returned in the order seconds, nanos. <p> This set can be used in conjunction with   {@link #get(TemporalUnit)}to access the entire state of the period.
 * @return a list containing the seconds and nanos units, not null
 */
@Override public List<TemporalUnit> getUnits(){
  return DurationUnits.UNITS;
}

Fixed version (ground truth):
/** 
 * Gets the set of units supported by this duration. <p> The supported units are   {@link ChronoUnit#SECONDS SECONDS}, and   {@link ChronoUnit#NANOS NANOS}. They are returned in the order seconds, nanos. <p> This set can be used in conjunction with   {@link #get(TemporalUnit)}to access the entire state of the duration.
 * @return a list containing the seconds and nanos units, not null
 */
@Override public List<TemporalUnit> getUnits(){
  return DurationUnits.UNITS;
}
Program: 36193
Project: 36193
Buggy source:
/** 
 * Gets the value of the specified field from this instant as an   {@code int}. <p> This queries this instant for the value for the specified field. The returned value will always be within the valid range of values for the field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date-time, except  {@code INSTANT_SECONDS} which is toolarge to fit in an  {@code int} and throws a {@code DateTimeException}. All other   {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained orthe value is outside the range of valid values for the field
 * @throws UnsupportedTemporalTypeException if the field is not supported orthe range of values exceeds an  {@code int}
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public int get(TemporalField field){
}

Fixed version (ground truth):
/** 
 * Gets the value of the specified field from this instant as an   {@code int}. <p> This queries this instant for the value of the specified field. The returned value will always be within the valid range of values for the field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date-time, except  {@code INSTANT_SECONDS} which is toolarge to fit in an  {@code int} and throws a {@code DateTimeException}. All other   {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained orthe value is outside the range of valid values for the field
 * @throws UnsupportedTemporalTypeException if the field is not supported orthe range of values exceeds an  {@code int}
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public int get(TemporalField field){
}
Program: 36194
Project: 36194
Buggy source:
/** 
 * Gets the value of the specified field from this instant as a   {@code long}. <p> This queries this instant for the value for the specified field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date-time. All other  {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained
 * @throws UnsupportedTemporalTypeException if the field is not supported
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public long getLong(TemporalField field){
}

Fixed version (ground truth):
/** 
 * Gets the value of the specified field from this instant as a   {@code long}. <p> This queries this instant for the value of the specified field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date-time. All other  {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained
 * @throws UnsupportedTemporalTypeException if the field is not supported
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public long getLong(TemporalField field){
}
Program: 36195
Project: 36195
Buggy source:
/** 
 * Obtains an instance of   {@code LocalDate} from a year and day-of-year.<p> This returns a  {@code LocalDate} with the specified year and day-of-year.The day-of-year must be valid for the year, otherwise an exception will be thrown.
 * @param year  the year to represent, from MIN_YEAR to MAX_YEAR
 * @param dayOfYear  the day-of-year to represent, from 1 to 366
 * @return the local date, not null
 * @throws DateTimeException if the value of any field is out of range,or if the day-of-year is invalid for the month-year
 */
public static LocalDate ofYearDay(int year,int dayOfYear){
  YEAR.checkValidValue(year);
  DAY_OF_YEAR.checkValidValue(dayOfYear);
  boolean leap=IsoChronology.INSTANCE.isLeapYear(year);
  if (dayOfYear == 366 && leap == false) {
    throw new DateTimeException("String_Node_Str" + year + "String_Node_Str");
  }
  Month moy=Month.of((dayOfYear - 1) / 31 + 1);
  int monthEnd=moy.firstDayOfYear(leap) + moy.length(leap) - 1;
  if (dayOfYear > monthEnd) {
    moy=moy.plus(1);
  }
  int dom=dayOfYear - moy.firstDayOfYear(leap) + 1;
  return new LocalDate(year,moy.getValue(),dom);
}

Fixed version (ground truth):
/** 
 * Obtains an instance of   {@code LocalDate} from a year and day-of-year.<p> This returns a  {@code LocalDate} with the specified year and day-of-year.The day-of-year must be valid for the year, otherwise an exception will be thrown.
 * @param year  the year to represent, from MIN_YEAR to MAX_YEAR
 * @param dayOfYear  the day-of-year to represent, from 1 to 366
 * @return the local date, not null
 * @throws DateTimeException if the value of any field is out of range,or if the day-of-year is invalid for the year
 */
public static LocalDate ofYearDay(int year,int dayOfYear){
  YEAR.checkValidValue(year);
  DAY_OF_YEAR.checkValidValue(dayOfYear);
  boolean leap=IsoChronology.INSTANCE.isLeapYear(year);
  if (dayOfYear == 366 && leap == false) {
    throw new DateTimeException("String_Node_Str" + year + "String_Node_Str");
  }
  Month moy=Month.of((dayOfYear - 1) / 31 + 1);
  int monthEnd=moy.firstDayOfYear(leap) + moy.length(leap) - 1;
  if (dayOfYear > monthEnd) {
    moy=moy.plus(1);
  }
  int dom=dayOfYear - moy.firstDayOfYear(leap) + 1;
  return new LocalDate(year,moy.getValue(),dom);
}
Program: 36196
Project: 36196
Buggy source:
/** 
 * Returns a copy of this   {@code LocalDate} with the specified period in months added.<p> This method adds the specified amount to the months field in three steps: <ol> <li>Add the input months to the month-of-year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2007-03-31 plus one month would result in the invalid date 2007-04-31. Instead of returning an invalid result, the last valid day of the month, 2007-04-30, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param monthsToAdd  the months to add, may be negative
 * @return a {@code LocalDate} based on this date with the months added, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate plusMonths(long monthsToAdd){
  if (monthsToAdd == 0) {
    return this;
  }
  long monthCount=year * 12L + (month - 1);
  long calcMonths=monthCount + monthsToAdd;
  int newYear=YEAR.checkValidIntValue(Math.floorDiv(calcMonths,12));
  int newMonth=(int)Math.floorMod(calcMonths,12) + 1;
  return resolvePreviousValid(newYear,newMonth,day);
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the specified number of months added.<p> This method adds the specified amount to the months field in three steps: <ol> <li>Add the input months to the month-of-year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2007-03-31 plus one month would result in the invalid date 2007-04-31. Instead of returning an invalid result, the last valid day of the month, 2007-04-30, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param monthsToAdd  the months to add, may be negative
 * @return a {@code LocalDate} based on this date with the months added, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate plusMonths(long monthsToAdd){
  if (monthsToAdd == 0) {
    return this;
  }
  long monthCount=year * 12L + (month - 1);
  long calcMonths=monthCount + monthsToAdd;
  int newYear=YEAR.checkValidIntValue(Math.floorDiv(calcMonths,12));
  int newMonth=(int)Math.floorMod(calcMonths,12) + 1;
  return resolvePreviousValid(newYear,newMonth,day);
}
Program: 36197
Project: 36197
Buggy source:
/** 
 * Returns a copy of this   {@code LocalDate} with the specified period in years added.<p> This method adds the specified amount to the years field in three steps: <ol> <li>Add the input years to the year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2008-02-29 (leap year) plus one year would result in the invalid date 2009-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2009-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param yearsToAdd  the years to add, may be negative
 * @return a {@code LocalDate} based on this date with the years added, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate plusYears(long yearsToAdd){
  if (yearsToAdd == 0) {
    return this;
  }
  int newYear=YEAR.checkValidIntValue(year + yearsToAdd);
  return resolvePreviousValid(newYear,month,day);
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the specified number of years added.<p> This method adds the specified amount to the years field in three steps: <ol> <li>Add the input years to the year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2008-02-29 (leap year) plus one year would result in the invalid date 2009-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2009-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param yearsToAdd  the years to add, may be negative
 * @return a {@code LocalDate} based on this date with the years added, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate plusYears(long yearsToAdd){
  if (yearsToAdd == 0) {
    return this;
  }
  int newYear=YEAR.checkValidIntValue(year + yearsToAdd);
  return resolvePreviousValid(newYear,month,day);
}
Program: 36198
Project: 36198
Buggy source:
/** 
 * Checks if the specified unit is supported. <p> This checks if the specified unit can be added to, or subtracted from, this date-time. If false, then calling the   {@link #plus(long,TemporalUnit)} and{@link #minus(long,TemporalUnit) minus} methods will throw an exception.<p> If the unit is a  {@link ChronoUnit} then the query is implemented here.The supported units are: <ul> <li> {@code DAYS}<li>  {@code WEEKS}<li>  {@code MONTHS}<li>  {@code YEARS}<li>  {@code DECADES}<li>  {@code CENTURIES}<li>  {@code MILLENNIA}<li>  {@code ERAS}</ul> All other   {@code ChronoUnit} instances will return false.<p> If the unit is not a  {@code ChronoUnit}, then the result of this method is obtained by invoking   {@code TemporalUnit.isSupportedBy(Temporal)}passing   {@code this} as the argument.Whether the unit is supported is determined by the unit.
 * @param unit  the unit to check, null returns false
 * @return true if the unit can be added/subtracted, false if not
 */
@Override public boolean isSupported(TemporalUnit unit){
  return ChronoLocalDate.super.isSupported(unit);
}

Fixed version (ground truth):
/** 
 * Checks if the specified unit is supported. <p> This checks if the specified unit can be added to, or subtracted from, this date. If false, then calling the   {@link #plus(long,TemporalUnit)} and{@link #minus(long,TemporalUnit) minus} methods will throw an exception.<p> If the unit is a  {@link ChronoUnit} then the query is implemented here.The supported units are: <ul> <li> {@code DAYS}<li>  {@code WEEKS}<li>  {@code MONTHS}<li>  {@code YEARS}<li>  {@code DECADES}<li>  {@code CENTURIES}<li>  {@code MILLENNIA}<li>  {@code ERAS}</ul> All other   {@code ChronoUnit} instances will return false.<p> If the unit is not a  {@code ChronoUnit}, then the result of this method is obtained by invoking   {@code TemporalUnit.isSupportedBy(Temporal)}passing   {@code this} as the argument.Whether the unit is supported is determined by the unit.
 * @param unit  the unit to check, null returns false
 * @return true if the unit can be added/subtracted, false if not
 */
@Override public boolean isSupported(TemporalUnit unit){
  return ChronoLocalDate.super.isSupported(unit);
}
Program: 36199
Project: 36199
Buggy source:
/** 
 * Returns a copy of this date with the day-of-month altered. If the resulting date is invalid, an exception is thrown. <p> This instance is immutable and unaffected by this method call.
 * @param dayOfMonth  the day-of-month to set in the result, from 1 to 28-31
 * @return a {@code LocalDate} based on this date with the requested day, not null
 * @throws DateTimeException if the day-of-month value is invalid,or if the day-of-month is invalid for the month-year
 */
public LocalDate withDayOfMonth(int dayOfMonth){
  if (this.day == dayOfMonth) {
    return this;
  }
  return of(year,month,dayOfMonth);
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the day-of-month altered.<p> If the resulting date is invalid, an exception is thrown. <p> This instance is immutable and unaffected by this method call.
 * @param dayOfMonth  the day-of-month to set in the result, from 1 to 28-31
 * @return a {@code LocalDate} based on this date with the requested day, not null
 * @throws DateTimeException if the day-of-month value is invalid,or if the day-of-month is invalid for the month-year
 */
public LocalDate withDayOfMonth(int dayOfMonth){
  if (this.day == dayOfMonth) {
    return this;
  }
  return of(year,month,dayOfMonth);
}
Program: 36200
Project: 36200
Buggy source:
/** 
 * Returns a copy of this date with the month-of-year altered. If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. <p> This instance is immutable and unaffected by this method call.
 * @param month  the month-of-year to set in the result, from 1 (January) to 12 (December)
 * @return a {@code LocalDate} based on this date with the requested month, not null
 * @throws DateTimeException if the month-of-year value is invalid
 */
public LocalDate withMonth(int month){
  if (this.month == month) {
    return this;
  }
  MONTH_OF_YEAR.checkValidValue(month);
  return resolvePreviousValid(year,month,day);
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the month-of-year altered.<p> If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. <p> This instance is immutable and unaffected by this method call.
 * @param month  the month-of-year to set in the result, from 1 (January) to 12 (December)
 * @return a {@code LocalDate} based on this date with the requested month, not null
 * @throws DateTimeException if the month-of-year value is invalid
 */
public LocalDate withMonth(int month){
  if (this.month == month) {
    return this;
  }
  MONTH_OF_YEAR.checkValidValue(month);
  return resolvePreviousValid(year,month,day);
}
Program: 36201
Project: 36201
Buggy source:
/** 
 * Returns a copy of this date with the year altered. If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. <p> This instance is immutable and unaffected by this method call.
 * @param year  the year to set in the result, from MIN_YEAR to MAX_YEAR
 * @return a {@code LocalDate} based on this date with the requested year, not null
 * @throws DateTimeException if the year value is invalid
 */
public LocalDate withYear(int year){
  if (this.year == year) {
    return this;
  }
  YEAR.checkValidValue(year);
  return resolvePreviousValid(year,month,day);
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the year altered.<p> If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. <p> This instance is immutable and unaffected by this method call.
 * @param year  the year to set in the result, from MIN_YEAR to MAX_YEAR
 * @return a {@code LocalDate} based on this date with the requested year, not null
 * @throws DateTimeException if the year value is invalid
 */
public LocalDate withYear(int year){
  if (this.year == year) {
    return this;
  }
  YEAR.checkValidValue(year);
  return resolvePreviousValid(year,month,day);
}
Program: 36203
Project: 36203
Buggy source:
/** 
 * Returns a copy of this   {@code LocalDate} with the specified period in weeks added.<p> This method adds the specified amount in weeks to the days field incrementing the month and year fields as necessary to ensure the result remains valid. The result is only invalid if the maximum/minimum year is exceeded. <p> For example, 2008-12-31 plus one week would result in 2009-01-07. <p> This instance is immutable and unaffected by this method call.
 * @param weeksToAdd  the weeks to add, may be negative
 * @return a {@code LocalDate} based on this date with the weeks added, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate plusWeeks(long weeksToAdd){
  return plusDays(Math.multiplyExact(weeksToAdd,7));
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the specified number of weeks added.<p> This method adds the specified amount in weeks to the days field incrementing the month and year fields as necessary to ensure the result remains valid. The result is only invalid if the maximum/minimum year is exceeded. <p> For example, 2008-12-31 plus one week would result in 2009-01-07. <p> This instance is immutable and unaffected by this method call.
 * @param weeksToAdd  the weeks to add, may be negative
 * @return a {@code LocalDate} based on this date with the weeks added, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate plusWeeks(long weeksToAdd){
  return plusDays(Math.multiplyExact(weeksToAdd,7));
}
Program: 36204
Project: 36204
Buggy source:
/** 
 * Obtains an instance of   {@code LocalDate} from the epoch day count.<p> This returns a  {@code LocalDate} with the specified epoch-day.The  {@link ChronoField#EPOCH_DAY EPOCH_DAY} is a simple incrementing countof days where day 0 is 1970-01-01. Negative numbers represent earlier days.
 * @param epochDay  the Epoch Day to convert, based on the epoch 1970-01-01
 * @return the local date, not null
 * @throws DateTimeException if the epoch days exceeds the supported date range
 */
public static LocalDate ofEpochDay(long epochDay){
  long zeroDay=epochDay + DAYS_0000_TO_1970;
  zeroDay-=60;
  long adjust=0;
  if (zeroDay < 0) {
    long adjustCycles=(zeroDay + 1) / DAYS_PER_CYCLE - 1;
    adjust=adjustCycles * 400;
    zeroDay+=-adjustCycles * DAYS_PER_CYCLE;
  }
  long yearEst=(400 * zeroDay + 591) / DAYS_PER_CYCLE;
  long doyEst=zeroDay - (365 * yearEst + yearEst / 4 - yearEst / 100 + yearEst / 400);
  if (doyEst < 0) {
    yearEst--;
    doyEst=zeroDay - (365 * yearEst + yearEst / 4 - yearEst / 100 + yearEst / 400);
  }
  yearEst+=adjust;
  int marchDoy0=(int)doyEst;
  int marchMonth0=(marchDoy0 * 5 + 2) / 153;
  int month=(marchMonth0 + 2) % 12 + 1;
  int dom=marchDoy0 - (marchMonth0 * 306 + 5) / 10 + 1;
  yearEst+=marchMonth0 / 10;
  int year=YEAR.checkValidIntValue(yearEst);
  return new LocalDate(year,month,dom);
}

Fixed version (ground truth):
/** 
 * Obtains an instance of   {@code LocalDate} from the epoch day count.<p> This returns a  {@code LocalDate} with the specified epoch-day.The  {@link ChronoField#EPOCH_DAY EPOCH_DAY} is a simple incrementing countof days where day 0 is 1970-01-01. Negative numbers represent earlier days.
 * @param epochDay  the Epoch Day to convert, based on the epoch 1970-01-01
 * @return the local date, not null
 * @throws DateTimeException if the epoch day exceeds the supported date range
 */
public static LocalDate ofEpochDay(long epochDay){
  long zeroDay=epochDay + DAYS_0000_TO_1970;
  zeroDay-=60;
  long adjust=0;
  if (zeroDay < 0) {
    long adjustCycles=(zeroDay + 1) / DAYS_PER_CYCLE - 1;
    adjust=adjustCycles * 400;
    zeroDay+=-adjustCycles * DAYS_PER_CYCLE;
  }
  long yearEst=(400 * zeroDay + 591) / DAYS_PER_CYCLE;
  long doyEst=zeroDay - (365 * yearEst + yearEst / 4 - yearEst / 100 + yearEst / 400);
  if (doyEst < 0) {
    yearEst--;
    doyEst=zeroDay - (365 * yearEst + yearEst / 4 - yearEst / 100 + yearEst / 400);
  }
  yearEst+=adjust;
  int marchDoy0=(int)doyEst;
  int marchMonth0=(marchDoy0 * 5 + 2) / 153;
  int month=(marchMonth0 + 2) % 12 + 1;
  int dom=marchDoy0 - (marchMonth0 * 306 + 5) / 10 + 1;
  yearEst+=marchMonth0 / 10;
  int year=YEAR.checkValidIntValue(yearEst);
  return new LocalDate(year,month,dom);
}
Program: 36205
Project: 36205
Buggy source:
/** 
 * Returns a copy of this   {@code LocalDate} with the specified period in years subtracted.<p> This method subtracts the specified amount from the years field in three steps: <ol> <li>Subtract the input years to the year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2008-02-29 (leap year) minus one year would result in the invalid date 2007-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2007-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param yearsToSubtract  the years to subtract, may be negative
 * @return a {@code LocalDate} based on this date with the years subtracted, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate minusYears(long yearsToSubtract){
  return (yearsToSubtract == Long.MIN_VALUE ? plusYears(Long.MAX_VALUE).plusYears(1) : plusYears(-yearsToSubtract));
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the specified number of years subtracted.<p> This method subtracts the specified amount from the years field in three steps: <ol> <li>Subtract the input years from the year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2008-02-29 (leap year) minus one year would result in the invalid date 2007-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2007-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param yearsToSubtract  the years to subtract, may be negative
 * @return a {@code LocalDate} based on this date with the years subtracted, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate minusYears(long yearsToSubtract){
  return (yearsToSubtract == Long.MIN_VALUE ? plusYears(Long.MAX_VALUE).plusYears(1) : plusYears(-yearsToSubtract));
}
Program: 36206
Project: 36206
Buggy source:
/** 
 * Returns a copy of this   {@code LocalDate} with the specified period in weeks subtracted.<p> This method subtracts the specified amount in weeks from the days field decrementing the month and year fields as necessary to ensure the result remains valid. The result is only invalid if the maximum/minimum year is exceeded. <p> For example, 2009-01-07 minus one week would result in 2008-12-31. <p> This instance is immutable and unaffected by this method call.
 * @param weeksToSubtract  the weeks to subtract, may be negative
 * @return a {@code LocalDate} based on this date with the weeks subtracted, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate minusWeeks(long weeksToSubtract){
  return (weeksToSubtract == Long.MIN_VALUE ? plusWeeks(Long.MAX_VALUE).plusWeeks(1) : plusWeeks(-weeksToSubtract));
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the specified number of weeks subtracted.<p> This method subtracts the specified amount in weeks from the days field decrementing the month and year fields as necessary to ensure the result remains valid. The result is only invalid if the maximum/minimum year is exceeded. <p> For example, 2009-01-07 minus one week would result in 2008-12-31. <p> This instance is immutable and unaffected by this method call.
 * @param weeksToSubtract  the weeks to subtract, may be negative
 * @return a {@code LocalDate} based on this date with the weeks subtracted, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate minusWeeks(long weeksToSubtract){
  return (weeksToSubtract == Long.MIN_VALUE ? plusWeeks(Long.MAX_VALUE).plusWeeks(1) : plusWeeks(-weeksToSubtract));
}
Program: 36207
Project: 36207
Buggy source:
/** 
 * Returns a copy of this date with the day-of-year altered. If the resulting date is invalid, an exception is thrown. <p> This instance is immutable and unaffected by this method call.
 * @param dayOfYear  the day-of-year to set in the result, from 1 to 365-366
 * @return a {@code LocalDate} based on this date with the requested day, not null
 * @throws DateTimeException if the day-of-year value is invalid,or if the day-of-year is invalid for the year
 */
public LocalDate withDayOfYear(int dayOfYear){
  if (this.getDayOfYear() == dayOfYear) {
    return this;
  }
  return ofYearDay(year,dayOfYear);
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the day-of-year altered.<p> If the resulting date is invalid, an exception is thrown. <p> This instance is immutable and unaffected by this method call.
 * @param dayOfYear  the day-of-year to set in the result, from 1 to 365-366
 * @return a {@code LocalDate} based on this date with the requested day, not null
 * @throws DateTimeException if the day-of-year value is invalid,or if the day-of-year is invalid for the year
 */
public LocalDate withDayOfYear(int dayOfYear){
  if (this.getDayOfYear() == dayOfYear) {
    return this;
  }
  return ofYearDay(year,dayOfYear);
}
Program: 36208
Project: 36208
Buggy source:
/** 
 * Gets the value of the specified field from this date as a   {@code long}. <p> This queries this date for the value for the specified field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date. All other  {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained
 * @throws UnsupportedTemporalTypeException if the field is not supported
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public long getLong(TemporalField field){
  if (field instanceof ChronoField) {
    if (field == EPOCH_DAY) {
      return toEpochDay();
    }
    if (field == PROLEPTIC_MONTH) {
      return getProlepticMonth();
    }
    return get0(field);
  }
  return field.getFrom(this);
}

Fixed version (ground truth):
/** 
 * Gets the value of the specified field from this date as a   {@code long}. <p> This queries this date for the value of the specified field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date. All other  {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained
 * @throws UnsupportedTemporalTypeException if the field is not supported
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public long getLong(TemporalField field){
  if (field instanceof ChronoField) {
    if (field == EPOCH_DAY) {
      return toEpochDay();
    }
    if (field == PROLEPTIC_MONTH) {
      return getProlepticMonth();
    }
    return get0(field);
  }
  return field.getFrom(this);
}
Program: 36209
Project: 36209
Buggy source:
/** 
 * Returns a copy of this   {@code LocalDate} with the specified period in months subtracted.<p> This method subtracts the specified amount from the months field in three steps: <ol> <li>Subtract the input months to the month-of-year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2007-03-31 minus one month would result in the invalid date 2007-02-31. Instead of returning an invalid result, the last valid day of the month, 2007-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param monthsToSubtract  the months to subtract, may be negative
 * @return a {@code LocalDate} based on this date with the months subtracted, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate minusMonths(long monthsToSubtract){
  return (monthsToSubtract == Long.MIN_VALUE ? plusMonths(Long.MAX_VALUE).plusMonths(1) : plusMonths(-monthsToSubtract));
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the specified number of months subtracted.<p> This method subtracts the specified amount from the months field in three steps: <ol> <li>Subtract the input months from the month-of-year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2007-03-31 minus one month would result in the invalid date 2007-02-31. Instead of returning an invalid result, the last valid day of the month, 2007-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param monthsToSubtract  the months to subtract, may be negative
 * @return a {@code LocalDate} based on this date with the months subtracted, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate minusMonths(long monthsToSubtract){
  return (monthsToSubtract == Long.MIN_VALUE ? plusMonths(Long.MAX_VALUE).plusMonths(1) : plusMonths(-monthsToSubtract));
}
Program: 36210
Project: 36210
Buggy source:
/** 
 * Returns a copy of this duration with the specified duration subtracted. <p> The duration amount is measured in terms of the specified unit. Only a subset of units are accepted by this method. The unit must either have an   {@linkplain TemporalUnit#isDurationEstimated() exact duration} orbe  {@link ChronoUnit#DAYS} which is treated as 24 hours. Other units throw an exception.<p> This instance is immutable and unaffected by this method call.
 * @param amountToSubtract  the amount of the period, measured in terms of the unit, positive or negative
 * @param unit  the unit that the period is measured in, must have an exact duration, not null
 * @return a {@code Duration} based on this duration with the specified duration subtracted, not null
 * @throws ArithmeticException if numeric overflow occurs
 */
public Duration minus(long amountToSubtract,TemporalUnit unit){
  return (amountToSubtract == Long.MIN_VALUE ? plus(Long.MAX_VALUE,unit).plus(1,unit) : plus(-amountToSubtract,unit));
}

Fixed version (ground truth):
/** 
 * Returns a copy of this duration with the specified duration subtracted. <p> The duration amount is measured in terms of the specified unit. Only a subset of units are accepted by this method. The unit must either have an   {@linkplain TemporalUnit#isDurationEstimated() exact duration} orbe  {@link ChronoUnit#DAYS} which is treated as 24 hours. Other units throw an exception.<p> This instance is immutable and unaffected by this method call.
 * @param amountToSubtract  the amount to subtract, measured in terms of the unit, positive or negative
 * @param unit  the unit that the amount is measured in, must have an exact duration, not null
 * @return a {@code Duration} based on this duration with the specified duration subtracted, not null
 * @throws ArithmeticException if numeric overflow occurs
 */
public Duration minus(long amountToSubtract,TemporalUnit unit){
  return (amountToSubtract == Long.MIN_VALUE ? plus(Long.MAX_VALUE,unit).plus(1,unit) : plus(-amountToSubtract,unit));
}
Program: 36211
Project: 36211
Buggy source:
/** 
 * Gets the set of units supported by this duration. <p> The supported units are   {@link ChronoUnit#SECONDS SECONDS}, and   {@link ChronoUnit#NANOS NANOS}. They are returned in the order seconds, nanos. <p> This set can be used in conjunction with   {@link #get(TemporalUnit)}to access the entire state of the period.
 * @return a list containing the seconds and nanos units, not null
 */
@Override public List<TemporalUnit> getUnits(){
  return DurationUnits.UNITS;
}

Fixed version (ground truth):
/** 
 * Gets the set of units supported by this duration. <p> The supported units are   {@link ChronoUnit#SECONDS SECONDS}, and   {@link ChronoUnit#NANOS NANOS}. They are returned in the order seconds, nanos. <p> This set can be used in conjunction with   {@link #get(TemporalUnit)}to access the entire state of the duration.
 * @return a list containing the seconds and nanos units, not null
 */
@Override public List<TemporalUnit> getUnits(){
  return DurationUnits.UNITS;
}
Program: 36212
Project: 36212
Buggy source:
/** 
 * Gets the value of the specified field from this instant as an   {@code int}. <p> This queries this instant for the value for the specified field. The returned value will always be within the valid range of values for the field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date-time, except  {@code INSTANT_SECONDS} which is toolarge to fit in an  {@code int} and throws a {@code DateTimeException}. All other   {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained orthe value is outside the range of valid values for the field
 * @throws UnsupportedTemporalTypeException if the field is not supported orthe range of values exceeds an  {@code int}
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public int get(TemporalField field){
}

Fixed version (ground truth):
/** 
 * Gets the value of the specified field from this instant as an   {@code int}. <p> This queries this instant for the value of the specified field. The returned value will always be within the valid range of values for the field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date-time, except  {@code INSTANT_SECONDS} which is toolarge to fit in an  {@code int} and throws a {@code DateTimeException}. All other   {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained orthe value is outside the range of valid values for the field
 * @throws UnsupportedTemporalTypeException if the field is not supported orthe range of values exceeds an  {@code int}
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public int get(TemporalField field){
}
Program: 36213
Project: 36213
Buggy source:
/** 
 * Gets the value of the specified field from this instant as a   {@code long}. <p> This queries this instant for the value for the specified field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date-time. All other  {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained
 * @throws UnsupportedTemporalTypeException if the field is not supported
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public long getLong(TemporalField field){
}

Fixed version (ground truth):
/** 
 * Gets the value of the specified field from this instant as a   {@code long}. <p> This queries this instant for the value of the specified field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date-time. All other  {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained
 * @throws UnsupportedTemporalTypeException if the field is not supported
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public long getLong(TemporalField field){
}
Program: 36214
Project: 36214
Buggy source:
/** 
 * Obtains an instance of   {@code LocalDate} from a year and day-of-year.<p> This returns a  {@code LocalDate} with the specified year and day-of-year.The day-of-year must be valid for the year, otherwise an exception will be thrown.
 * @param year  the year to represent, from MIN_YEAR to MAX_YEAR
 * @param dayOfYear  the day-of-year to represent, from 1 to 366
 * @return the local date, not null
 * @throws DateTimeException if the value of any field is out of range,or if the day-of-year is invalid for the month-year
 */
public static LocalDate ofYearDay(int year,int dayOfYear){
  YEAR.checkValidValue(year);
  DAY_OF_YEAR.checkValidValue(dayOfYear);
  boolean leap=IsoChronology.INSTANCE.isLeapYear(year);
  if (dayOfYear == 366 && leap == false) {
    throw new DateTimeException("String_Node_Str" + year + "String_Node_Str");
  }
  Month moy=Month.of((dayOfYear - 1) / 31 + 1);
  int monthEnd=moy.firstDayOfYear(leap) + moy.length(leap) - 1;
  if (dayOfYear > monthEnd) {
    moy=moy.plus(1);
  }
  int dom=dayOfYear - moy.firstDayOfYear(leap) + 1;
  return new LocalDate(year,moy.getValue(),dom);
}

Fixed version (ground truth):
/** 
 * Obtains an instance of   {@code LocalDate} from a year and day-of-year.<p> This returns a  {@code LocalDate} with the specified year and day-of-year.The day-of-year must be valid for the year, otherwise an exception will be thrown.
 * @param year  the year to represent, from MIN_YEAR to MAX_YEAR
 * @param dayOfYear  the day-of-year to represent, from 1 to 366
 * @return the local date, not null
 * @throws DateTimeException if the value of any field is out of range,or if the day-of-year is invalid for the year
 */
public static LocalDate ofYearDay(int year,int dayOfYear){
  YEAR.checkValidValue(year);
  DAY_OF_YEAR.checkValidValue(dayOfYear);
  boolean leap=IsoChronology.INSTANCE.isLeapYear(year);
  if (dayOfYear == 366 && leap == false) {
    throw new DateTimeException("String_Node_Str" + year + "String_Node_Str");
  }
  Month moy=Month.of((dayOfYear - 1) / 31 + 1);
  int monthEnd=moy.firstDayOfYear(leap) + moy.length(leap) - 1;
  if (dayOfYear > monthEnd) {
    moy=moy.plus(1);
  }
  int dom=dayOfYear - moy.firstDayOfYear(leap) + 1;
  return new LocalDate(year,moy.getValue(),dom);
}