nus-yam/ex-repair huggingface dataset:
Program: 36215
Project: 36215
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: 36216
Project: 36216
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: 36217
Project: 36217
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: 36218
Project: 36218
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: 36219
Project: 36219
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: 36220
Project: 36220
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: 36222
Project: 36222
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: 36223
Project: 36223
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: 36224
Project: 36224
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: 36225
Project: 36225
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: 36226
Project: 36226
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: 36227
Project: 36227
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: 36228
Project: 36228
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: 36229
Project: 36229
Buggy source:
/** 
 * Returns a new InputContext instance.
 */
public static InputContext getInstance(){
  return new sun.awt.im.InputMethodContext();
}

Fixed version (ground truth):
/** 
 * Returns a new InputContext instance.
 * @return a new InputContext instance
 */
public static InputContext getInstance(){
  return new sun.awt.im.InputMethodContext();
}
Program: 36230
Project: 36230
Buggy source:
/** 
 * Returns the rendering style attributes for the text range, or null.
 * @since 1.3
 */
public Map<TextAttribute,?> getStyle(){
  return style;
}

Fixed version (ground truth):
/** 
 * Returns the rendering style attributes for the text range, or null.
 * @return the rendering style attributes for the text range, or null
 * @since 1.3
 */
public Map<TextAttribute,?> getStyle(){
  return style;
}
Program: 36231
Project: 36231
Buggy source:
/** 
 * Returns the variation of the text range.
 */
public int getVariation(){
  return variation;
}

Fixed version (ground truth):
/** 
 * Returns the variation of the text range.
 * @return the variation of the text range
 */
public int getVariation(){
  return variation;
}
Program: 36232
Project: 36232
Buggy source:
/** 
 * Returns whether the text range is selected.
 */
public boolean isSelected(){
  return selected;
}

Fixed version (ground truth):
/** 
 * Returns whether the text range is selected.
 * @return whether the text range is selected
 */
public boolean isSelected(){
  return selected;
}
Program: 36233
Project: 36233
Buggy source:
/** 
 * Creates an input method event from the arguments given and dispatches it to the client component. For arguments, see   {@link java.awt.event.InputMethodEvent#InputMethodEvent}.
 */
public void dispatchInputMethodEvent(int id,AttributedCharacterIterator text,int committedCharacterCount,TextHitInfo caret,TextHitInfo visiblePosition);

Fixed version (ground truth):
/** 
 * Creates an input method event from the arguments given and dispatches it to the client component. For arguments, see   {@link java.awt.event.InputMethodEvent#InputMethodEvent}.
 * @param id the event type
 * @param text the combined committed and composed text
 * @param committedCharacterCount the number of committed characters in the text
 * @param caret the caret (a.k.a. insertion point); null ifthere's no caret within current composed text
 * @param visiblePosition the position that's most important to bevisible; null if there's no recommendation for a visible position within current composed text
 */
public void dispatchInputMethodEvent(int id,AttributedCharacterIterator text,int committedCharacterCount,TextHitInfo caret,TextHitInfo visiblePosition);
Program: 36234
Project: 36234
Buggy source:
/** 
 * Returns whether the list of available locales can change at runtime. This may be the case, for example, for adapters that access real input methods over the network.
 */
boolean hasDynamicLocaleList();

Fixed version (ground truth):
/** 
 * Returns whether the list of available locales can change at runtime. This may be the case, for example, for adapters that access real input methods over the network.
 * @return whether the list of available locales can change atruntime
 */
boolean hasDynamicLocaleList();
Program: 36235
Project: 36235
Buggy source:
/** 
 * Returns the user-visible name of the corresponding input method for the given input locale in the language in which the name will be displayed. <p> The inputLocale parameter specifies the locale for which text is input. This parameter can only take values obtained from this descriptor's  {@link #getAvailableLocales} method or null. If it is null, aninput locale independent name for the input method should be returned. <p> If a name for the desired display language is not available, the method may fall back to some other language.
 * @param inputLocale the locale for which text input is supported, or null
 * @param displayLanguage the language in which the name will be displayed
 */
String getInputMethodDisplayName(Locale inputLocale,Locale displayLanguage);

Fixed version (ground truth):
/** 
 * Returns the user-visible name of the corresponding input method for the given input locale in the language in which the name will be displayed. <p> The inputLocale parameter specifies the locale for which text is input. This parameter can only take values obtained from this descriptor's  {@link #getAvailableLocales} method or null. If it is null, aninput locale independent name for the input method should be returned. <p> If a name for the desired display language is not available, the method may fall back to some other language.
 * @param inputLocale the locale for which text input is supported, or null
 * @param displayLanguage the language in which the name will be displayed
 * @return the user-visible name of the corresponding input methodfor the given input locale in the language in which the name will be displayed
 */
String getInputMethodDisplayName(Locale inputLocale,Locale displayLanguage);
Program: 36236
Project: 36236
Buggy source:
/** 
 * Requests a GC that best suits this Canvas. The returned GC may differ from the requested GC passed as the argument to this method. This method must return a non-null value (given the argument is non-null as well).
 * @since 1.7
 */
GraphicsConfiguration getAppropriateGraphicsConfiguration(GraphicsConfiguration gc);

Fixed version (ground truth):
/** 
 * Requests a GC that best suits this Canvas. The returned GC may differ from the requested GC passed as the argument to this method. This method must return a non-null value (given the argument is non-null as well).
 * @param gc the requested graphics configuration
 * @return a graphics configuration that best suits this Canvas
 * @since 1.7
 */
GraphicsConfiguration getAppropriateGraphicsConfiguration(GraphicsConfiguration gc);
Program: 36237
Project: 36237
Buggy source:
/** 
 * Updates internal data structures related to the component's GC.
 * @return if the peer needs to be recreated for the changes to take effect
 * @since 1.7
 */
boolean updateGraphicsData(GraphicsConfiguration gc);

Fixed version (ground truth):
/** 
 * Updates internal data structures related to the component's GC.
 * @param gc the reference graphics configuration
 * @return if the peer needs to be recreated for the changes to take effect
 * @since 1.7
 */
boolean updateGraphicsData(GraphicsConfiguration gc);
Program: 36238
Project: 36238
Buggy source:
/** 
 * Applies the shape to the native component window.
 * @since 1.7
 * @see Component#applyCompoundShape
 */
void applyShape(Region shape);

Fixed version (ground truth):
/** 
 * Applies the shape to the native component window.
 * @param shape the shape to apply
 * @since 1.7
 * @see Component#applyCompoundShape
 */
void applyShape(Region shape);
Program: 36239
Project: 36239
Buggy source:
/** 
 * Lowers this component at the bottom of the above HW peer. If the above parameter is null then the method places this component at the top of the Z-order.
 */
void setZOrder(ComponentPeer above);

Fixed version (ground truth):
/** 
 * Lowers this component at the bottom of the above HW peer. If the above parameter is null then the method places this component at the top of the Z-order.
 * @param above the peer to lower this component with respect to
 */
void setZOrder(ComponentPeer above);
Program: 36240
Project: 36240
Buggy source:
/** 
 * Returns whether or not the window is located under the mouse pointer. The window is considered to be under the mouse pointer if it is showing on the screen, and the mouse pointer is above the part of the window that is not obscured by any other windows.
 */
boolean isWindowUnderMouse(Window w);

Fixed version (ground truth):
/** 
 * Returns whether or not the window is located under the mouse pointer. The window is considered to be under the mouse pointer if it is showing on the screen, and the mouse pointer is above the part of the window that is not obscured by any other windows.
 * @param w the window to check
 * @return whether or not the window is located under the mousepointer
 */
boolean isWindowUnderMouse(Window w);
Program: 36241
Project: 36241
Buggy source:
/** 
 * This method does two things: it fills the point fields with the current coordinates of the mouse cursor and returns the number of the screen device where the pointer is located. The number of the screen device is only returned for independent devices (which are not parts of a virtual screen device). For virtual screen devices, 0 is returned. Mouse coordinates are also calculated depending on whether or not the screen device is virtual. For virtual screen devices, pointer coordinates are calculated in the virtual coordinate system. Otherwise, coordinates are calculated in the coordinate system of the screen device where the pointer is located. See java.awt.GraphicsConfiguration documentation for more details about virtual screen devices.
 */
int fillPointWithCoords(Point point);

Fixed version (ground truth):
/** 
 * This method does two things: it fills the point fields with the current coordinates of the mouse cursor and returns the number of the screen device where the pointer is located. The number of the screen device is only returned for independent devices (which are not parts of a virtual screen device). For virtual screen devices, 0 is returned. Mouse coordinates are also calculated depending on whether or not the screen device is virtual. For virtual screen devices, pointer coordinates are calculated in the virtual coordinate system. Otherwise, coordinates are calculated in the coordinate system of the screen device where the pointer is located. See java.awt.GraphicsConfiguration documentation for more details about virtual screen devices.
 * @param point holder for the current coordinates of the mousecursor
 * @return the number of the screen device where the pointer islocated
 */
int fillPointWithCoords(Point point);
Program: 36242
Project: 36242
Buggy source:
/** 
 * Enables the per-pixel alpha support for the window.
 * @see Window#setBackground(Color)
 */
void setOpaque(boolean isOpaque);

Fixed version (ground truth):
/** 
 * Enables the per-pixel alpha support for the window.
 * @param isOpaque whether or not per-pixel alpha support isenabled
 * @see Window#setBackground(Color)
 */
void setOpaque(boolean isOpaque);
Program: 36243
Project: 36243
Buggy source:
/** 
 * Sets the level of opacity for the window.
 * @see Window#setOpacity(float)
 */
void setOpacity(float opacity);

Fixed version (ground truth):
/** 
 * Sets the level of opacity for the window.
 * @param opacity the level of opacity
 * @see Window#setOpacity(float)
 */
void setOpacity(float opacity);
Program: 36244
Project: 36244
Buggy source:
/** 
 * Returns a new InputContext instance.
 */
public static InputContext getInstance(){
  return new sun.awt.im.InputMethodContext();
}

Fixed version (ground truth):
/** 
 * Returns a new InputContext instance.
 * @return a new InputContext instance
 */
public static InputContext getInstance(){
  return new sun.awt.im.InputMethodContext();
}
Program: 36245
Project: 36245
Buggy source:
/** 
 * Returns the rendering style attributes for the text range, or null.
 * @since 1.3
 */
public Map<TextAttribute,?> getStyle(){
  return style;
}

Fixed version (ground truth):
/** 
 * Returns the rendering style attributes for the text range, or null.
 * @return the rendering style attributes for the text range, or null
 * @since 1.3
 */
public Map<TextAttribute,?> getStyle(){
  return style;
}
Program: 36246
Project: 36246
Buggy source:
/** 
 * Returns the variation of the text range.
 */
public int getVariation(){
  return variation;
}

Fixed version (ground truth):
/** 
 * Returns the variation of the text range.
 * @return the variation of the text range
 */
public int getVariation(){
  return variation;
}
Program: 36247
Project: 36247
Buggy source:
/** 
 * Returns whether the text range is selected.
 */
public boolean isSelected(){
  return selected;
}

Fixed version (ground truth):
/** 
 * Returns whether the text range is selected.
 * @return whether the text range is selected
 */
public boolean isSelected(){
  return selected;
}
Program: 36248
Project: 36248
Buggy source:
/** 
 * Creates an input method event from the arguments given and dispatches it to the client component. For arguments, see   {@link java.awt.event.InputMethodEvent#InputMethodEvent}.
 */
public void dispatchInputMethodEvent(int id,AttributedCharacterIterator text,int committedCharacterCount,TextHitInfo caret,TextHitInfo visiblePosition);

Fixed version (ground truth):
/** 
 * Creates an input method event from the arguments given and dispatches it to the client component. For arguments, see   {@link java.awt.event.InputMethodEvent#InputMethodEvent}.
 * @param id the event type
 * @param text the combined committed and composed text
 * @param committedCharacterCount the number of committed characters in the text
 * @param caret the caret (a.k.a. insertion point); null ifthere's no caret within current composed text
 * @param visiblePosition the position that's most important to bevisible; null if there's no recommendation for a visible position within current composed text
 */
public void dispatchInputMethodEvent(int id,AttributedCharacterIterator text,int committedCharacterCount,TextHitInfo caret,TextHitInfo visiblePosition);
Program: 36249
Project: 36249
Buggy source:
/** 
 * Returns whether the list of available locales can change at runtime. This may be the case, for example, for adapters that access real input methods over the network.
 */
boolean hasDynamicLocaleList();

Fixed version (ground truth):
/** 
 * Returns whether the list of available locales can change at runtime. This may be the case, for example, for adapters that access real input methods over the network.
 * @return whether the list of available locales can change atruntime
 */
boolean hasDynamicLocaleList();
Program: 36250
Project: 36250
Buggy source:
/** 
 * Returns the user-visible name of the corresponding input method for the given input locale in the language in which the name will be displayed. <p> The inputLocale parameter specifies the locale for which text is input. This parameter can only take values obtained from this descriptor's  {@link #getAvailableLocales} method or null. If it is null, aninput locale independent name for the input method should be returned. <p> If a name for the desired display language is not available, the method may fall back to some other language.
 * @param inputLocale the locale for which text input is supported, or null
 * @param displayLanguage the language in which the name will be displayed
 */
String getInputMethodDisplayName(Locale inputLocale,Locale displayLanguage);

Fixed version (ground truth):
/** 
 * Returns the user-visible name of the corresponding input method for the given input locale in the language in which the name will be displayed. <p> The inputLocale parameter specifies the locale for which text is input. This parameter can only take values obtained from this descriptor's  {@link #getAvailableLocales} method or null. If it is null, aninput locale independent name for the input method should be returned. <p> If a name for the desired display language is not available, the method may fall back to some other language.
 * @param inputLocale the locale for which text input is supported, or null
 * @param displayLanguage the language in which the name will be displayed
 * @return the user-visible name of the corresponding input methodfor the given input locale in the language in which the name will be displayed
 */
String getInputMethodDisplayName(Locale inputLocale,Locale displayLanguage);
Program: 36251
Project: 36251
Buggy source:
/** 
 * Requests a GC that best suits this Canvas. The returned GC may differ from the requested GC passed as the argument to this method. This method must return a non-null value (given the argument is non-null as well).
 * @since 1.7
 */
GraphicsConfiguration getAppropriateGraphicsConfiguration(GraphicsConfiguration gc);

Fixed version (ground truth):
/** 
 * Requests a GC that best suits this Canvas. The returned GC may differ from the requested GC passed as the argument to this method. This method must return a non-null value (given the argument is non-null as well).
 * @param gc the requested graphics configuration
 * @return a graphics configuration that best suits this Canvas
 * @since 1.7
 */
GraphicsConfiguration getAppropriateGraphicsConfiguration(GraphicsConfiguration gc);
Program: 36252
Project: 36252
Buggy source:
/** 
 * Returns whether or not the window is located under the mouse pointer. The window is considered to be under the mouse pointer if it is showing on the screen, and the mouse pointer is above the part of the window that is not obscured by any other windows.
 */
boolean isWindowUnderMouse(Window w);

Fixed version (ground truth):
/** 
 * Returns whether or not the window is located under the mouse pointer. The window is considered to be under the mouse pointer if it is showing on the screen, and the mouse pointer is above the part of the window that is not obscured by any other windows.
 * @param w the window to check
 * @return whether or not the window is located under the mousepointer
 */
boolean isWindowUnderMouse(Window w);
Program: 36253
Project: 36253
Buggy source:
/** 
 * This method does two things: it fills the point fields with the current coordinates of the mouse cursor and returns the number of the screen device where the pointer is located. The number of the screen device is only returned for independent devices (which are not parts of a virtual screen device). For virtual screen devices, 0 is returned. Mouse coordinates are also calculated depending on whether or not the screen device is virtual. For virtual screen devices, pointer coordinates are calculated in the virtual coordinate system. Otherwise, coordinates are calculated in the coordinate system of the screen device where the pointer is located. See java.awt.GraphicsConfiguration documentation for more details about virtual screen devices.
 */
int fillPointWithCoords(Point point);

Fixed version (ground truth):
/** 
 * This method does two things: it fills the point fields with the current coordinates of the mouse cursor and returns the number of the screen device where the pointer is located. The number of the screen device is only returned for independent devices (which are not parts of a virtual screen device). For virtual screen devices, 0 is returned. Mouse coordinates are also calculated depending on whether or not the screen device is virtual. For virtual screen devices, pointer coordinates are calculated in the virtual coordinate system. Otherwise, coordinates are calculated in the coordinate system of the screen device where the pointer is located. See java.awt.GraphicsConfiguration documentation for more details about virtual screen devices.
 * @param point holder for the current coordinates of the mousecursor
 * @return the number of the screen device where the pointer islocated
 */
int fillPointWithCoords(Point point);
Program: 36254
Project: 36254
Buggy source:
/** 
 * Enables the per-pixel alpha support for the window.
 * @see Window#setBackground(Color)
 */
void setOpaque(boolean isOpaque);

Fixed version (ground truth):
/** 
 * Enables the per-pixel alpha support for the window.
 * @param isOpaque whether or not per-pixel alpha support isenabled
 * @see Window#setBackground(Color)
 */
void setOpaque(boolean isOpaque);
Program: 36255
Project: 36255
Buggy source:
/** 
 * Sets the level of opacity for the window.
 * @see Window#setOpacity(float)
 */
void setOpacity(float opacity);

Fixed version (ground truth):
/** 
 * Sets the level of opacity for the window.
 * @param opacity the level of opacity
 * @see Window#setOpacity(float)
 */
void setOpacity(float opacity);
Program: 36256
Project: 36256
Buggy source:
public native void declareTypes(long[] formats,SunClipboard newOwner);

Fixed version (ground truth):
private native void declareTypes(long[] formats,SunClipboard newOwner);
Program: 36257
Project: 36257
Buggy source:
protected void unregisterClipboardViewerChecked(){
}

Fixed version (ground truth):
@Override protected void unregisterClipboardViewerChecked(){
}
Program: 36258
Project: 36258
Buggy source:
private void notifyLostOwnership(){
  lostOwnershipImpl();
}

Fixed version (ground truth):
/** 
 * Native Callbacks 
 */
private void notifyLostOwnership(){
  lostOwnershipImpl();
}
Program: 36259
Project: 36259
Buggy source:
protected void registerClipboardViewerChecked(){
}

Fixed version (ground truth):
@Override protected void registerClipboardViewerChecked(){
}
Program: 36260
Project: 36260
Buggy source:
protected void setContentsNative(Transferable contents){
  DataTransferer dataTransferer=DataTransferer.getInstance();
  long[] formatArray=dataTransferer.getFormatsForTransferableAsArray(contents,flavorMap);
  declareTypes(formatArray,this);
  Map<Long,DataFlavor> formatMap=dataTransferer.getFormatsForTransferable(contents,flavorMap);
  for (  Map.Entry<Long,DataFlavor> entry : formatMap.entrySet()) {
    long format=entry.getKey();
    DataFlavor flavor=entry.getValue();
    try {
      byte[] bytes=DataTransferer.getInstance().translateTransferable(contents,flavor,format);
      setData(bytes,format);
    }
 catch (    IOException e) {
      if (!(flavor.isMimeTypeEqual(DataFlavor.javaJVMLocalObjectMimeType) && e instanceof NotSerializableException)) {
        e.printStackTrace();
      }
    }
  }
  notifyChanged();
}

Fixed version (ground truth):
@Override protected void setContentsNative(Transferable contents){
  DataTransferer dataTransferer=DataTransferer.getInstance();
  long[] formatArray=dataTransferer.getFormatsForTransferableAsArray(contents,flavorMap);
  declareTypes(formatArray,this);
  Map<Long,DataFlavor> formatMap=dataTransferer.getFormatsForTransferable(contents,flavorMap);
  for (  Map.Entry<Long,DataFlavor> entry : formatMap.entrySet()) {
    long format=entry.getKey();
    DataFlavor flavor=entry.getValue();
    try {
      byte[] bytes=DataTransferer.getInstance().translateTransferable(contents,flavor,format);
      setData(bytes,format);
    }
 catch (    IOException e) {
      if (!(flavor.isMimeTypeEqual(DataFlavor.javaJVMLocalObjectMimeType) && e instanceof NotSerializableException)) {
        e.printStackTrace();
      }
    }
  }
  notifyChanged();
}
Program: 36261
Project: 36261
Buggy source:
public native void setData(byte[] data,long format);

Fixed version (ground truth):
private native void setData(byte[] data,long format);