nus-yam/ex-repair huggingface dataset:
Program: 81862
Project: 81862
Buggy source:
@Override public Method resolveDomainMethod(Method requestContextMethod){
  Class<?> enclosing=requestContextMethod.getDeclaringClass();
  Class<?> searchIn=null;
  Service s=enclosing.getAnnotation(Service.class);
  if (s != null) {
    searchIn=s.value();
  }
  ServiceName sn=enclosing.getAnnotation(ServiceName.class);
  if (sn != null) {
    searchIn=forName(sn.value());
  }
  if (searchIn == null) {
    die(null,"String_Node_Str",RequestContext.class.getSimpleName(),enclosing.getCanonicalName());
  }
  Class<?>[] parameterTypes=requestContextMethod.getParameterTypes();
  Class<?>[] domainArgs=new Class<?>[parameterTypes.length];
  for (int i=0, j=domainArgs.length; i < j; i++) {
    if (BaseProxy.class.isAssignableFrom(parameterTypes[i])) {
      domainArgs[i]=getTop().resolveDomainClass(parameterTypes[i].asSubclass(BaseProxy.class));
    }
 else     if (EntityProxyId.class.isAssignableFrom(parameterTypes[i])) {
      domainArgs[i]=TypeUtils.ensureBaseType(TypeUtils.getSingleParameterization(EntityProxyId.class,requestContextMethod.getGenericParameterTypes()[i]));
    }
 else {
      domainArgs[i]=parameterTypes[i];
    }
  }
  Throwable ex;
  try {
    return searchIn.getMethod(requestContextMethod.getName(),domainArgs);
  }
 catch (  SecurityException e) {
    ex=e;
  }
catch (  NoSuchMethodException e) {
    return report("String_Node_Str",requestContextMethod.getName());
  }
  return die(ex,"String_Node_Str",requestContextMethod.getName(),searchIn.getCanonicalName());
}

Fixed version (ground truth):
@Override public Method resolveDomainMethod(Method requestContextMethod){
  Class<?> declaringClass=requestContextMethod.getDeclaringClass();
  Class<?> searchIn=getTop().resolveServiceClass(declaringClass.asSubclass(RequestContext.class));
  Class<?>[] parameterTypes=requestContextMethod.getParameterTypes();
  Class<?>[] domainArgs=new Class<?>[parameterTypes.length];
  for (int i=0, j=domainArgs.length; i < j; i++) {
    if (BaseProxy.class.isAssignableFrom(parameterTypes[i])) {
      domainArgs[i]=getTop().resolveDomainClass(parameterTypes[i].asSubclass(BaseProxy.class));
    }
 else     if (EntityProxyId.class.isAssignableFrom(parameterTypes[i])) {
      domainArgs[i]=TypeUtils.ensureBaseType(TypeUtils.getSingleParameterization(EntityProxyId.class,requestContextMethod.getGenericParameterTypes()[i]));
    }
 else {
      domainArgs[i]=parameterTypes[i];
    }
  }
  Throwable ex;
  try {
    return searchIn.getMethod(requestContextMethod.getName(),domainArgs);
  }
 catch (  SecurityException e) {
    ex=e;
  }
catch (  NoSuchMethodException e) {
    return report("String_Node_Str",requestContextMethod.getName());
  }
  return die(ex,"String_Node_Str",requestContextMethod.getName(),searchIn.getCanonicalName());
}
Program: 81863
Project: 81863
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(BoxesAndPrimitivesJreTest.class);
  suite.addTestSuite(ComplexKeysJreTest.class);
  suite.addTestSuite(FindServiceJreTest.class);
  suite.addTestSuite(LocatorJreTest.class);
  suite.addTestSuite(RequestFactoryExceptionPropagationJreTest.class);
  suite.addTestSuite(RequestFactoryInterfaceValidatorTest.class);
  suite.addTestSuite(RequestFactoryJreTest.class);
  suite.addTestSuite(RequestFactoryModelTest.class);
  suite.addTestSuite(RequestFactoryUnicodeEscapingJreTest.class);
  suite.addTestSuite(SimpleEntityProxyIdTest.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(BoxesAndPrimitivesJreTest.class);
  suite.addTestSuite(ComplexKeysJreTest.class);
  suite.addTestSuite(FindServiceJreTest.class);
  suite.addTestSuite(LocatorJreTest.class);
  suite.addTestSuite(RequestFactoryExceptionPropagationJreTest.class);
  suite.addTestSuite(RequestFactoryInterfaceValidatorTest.class);
  suite.addTestSuite(RequestFactoryJreTest.class);
  suite.addTestSuite(RequestFactoryModelTest.class);
  suite.addTestSuite(RequestFactoryUnicodeEscapingJreTest.class);
  suite.addTestSuite(ServiceInheritanceJreTest.class);
  suite.addTestSuite(SimpleEntityProxyIdTest.class);
  return suite;
}
Program: 81864
Project: 81864
Buggy source:
public static Test suite(){
  GWTTestSuite suite=new GWTTestSuite("String_Node_Str");
  suite.addTestSuite(BoxesAndPrimitivesTest.class);
  suite.addTestSuite(ComplexKeysTest.class);
  suite.addTestSuite(EditorTest.class);
  suite.addTestSuite(FindServiceTest.class);
  suite.addTestSuite(LocatorTest.class);
  suite.addTestSuite(RequestFactoryTest.class);
  suite.addTestSuite(RequestFactoryExceptionHandlerTest.class);
  suite.addTestSuite(RequestFactoryExceptionPropagationTest.class);
  suite.addTestSuite(RequestFactoryPolymorphicTest.class);
  suite.addTestSuite(RequestFactoryUnicodeEscapingTest.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  GWTTestSuite suite=new GWTTestSuite("String_Node_Str");
  suite.addTestSuite(BoxesAndPrimitivesTest.class);
  suite.addTestSuite(ComplexKeysTest.class);
  suite.addTestSuite(EditorTest.class);
  suite.addTestSuite(FindServiceTest.class);
  suite.addTestSuite(LocatorTest.class);
  suite.addTestSuite(RequestFactoryTest.class);
  suite.addTestSuite(RequestFactoryExceptionHandlerTest.class);
  suite.addTestSuite(RequestFactoryExceptionPropagationTest.class);
  suite.addTestSuite(RequestFactoryPolymorphicTest.class);
  suite.addTestSuite(RequestFactoryUnicodeEscapingTest.class);
  suite.addTestSuite(ServiceInheritanceTest.class);
  return suite;
}
Program: 81865
Project: 81865
Buggy source:
@SuppressWarnings("String_Node_Str") public V next(){
  if (!hasNext()) {
    throw new NoSuchElementException();
  }
  last=index;
  Object toReturn=values[index++];
  advanceToItem();
  return (V)toReturn;
}

Fixed version (ground truth):
public E next(){
  if (!hasNext()) {
    throw new NoSuchElementException();
  }
  last=index;
  return iteratorItem(index++);
}
Program: 81866
Project: 81866
Buggy source:
public HashMap(Map<? extends K,? extends V> m){
  int newCapacity=INITIAL_TABLE_SIZE;
  int expectedSize=m.size();
  while (newCapacity * 3 < expectedSize * 4) {
    newCapacity<<=1;
  }
  initTable(newCapacity);
  internalPutAll(m);
}

Fixed version (ground truth):
public HashMap(Map<? extends K,? extends V> m){
  int newCapacity=INITIAL_TABLE_SIZE;
  int expectedSize=m.size();
  while (newCapacity * 3 < expectedSize * 4) {
    newCapacity<<=1;
  }
  initTable(newCapacity);
  putAll(m);
}
Program: 81867
Project: 81867
Buggy source:
@SuppressWarnings("String_Node_Str") public V put(K key,V value){
  ensureSizeFor(size + 1);
  int index=findKeyOrEmpty(key);
  if (keys[index] == null) {
    ++size;
    keys[index]=maskNullKey(key);
    values[index]=value;
    return null;
  }
 else {
    Object previousValue=values[index];
    values[index]=value;
    return (V)previousValue;
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public V put(K key,V value){
  int index=findKeyOrEmpty(key);
  if (keys[index] == null) {
    if (ensureSizeFor(++size)) {
      index=findKeyOrEmpty(key);
    }
    keys[index]=maskNullKey(key);
    values[index]=value;
    return null;
  }
 else {
    Object previousValue=values[index];
    values[index]=value;
    return (V)previousValue;
  }
}
Program: 81868
Project: 81868
Buggy source:
public void putAll(Map<? extends K,? extends V> m){
  ensureSizeFor(size + m.size());
  internalPutAll(m);
}

Fixed version (ground truth):
public void putAll(Map<? extends K,? extends V> m){
  resizeForJoin(m.size());
  for (  Entry<? extends K,? extends V> entry : m.entrySet()) {
    put(entry.getKey(),entry.getValue());
  }
}
Program: 81869
Project: 81869
Buggy source:
public boolean hasNext(){
  return index < keys.length;
}

Fixed version (ground truth):
public boolean hasNext(){
  if (coModCheckKeys != keys) {
    throw new ConcurrentModificationException();
  }
  advanceToItem();
  return index < keys.length;
}
Program: 81870
Project: 81870
Buggy source:
@Override public boolean addAll(Collection<? extends Entry<K,V>> c){
  HashMap.this.ensureSizeFor(size() + c.size());
  return super.addAll(c);
}

Fixed version (ground truth):
@Override public boolean addAll(Collection<? extends Entry<K,V>> c){
  HashMap.this.resizeForJoin(c.size());
  return super.addAll(c);
}
Program: 81871
Project: 81871
Buggy source:
/** 
 * Ensures the map is large enough to contain the specified number of entries. Default access to avoid synthetic accessors from inner classes.
 */
void ensureSizeFor(int expectedSize){
  if (keys.length * 3 >= expectedSize * 4) {
    return;
  }
  int newCapacity=keys.length << 1;
  while (newCapacity * 3 < expectedSize * 4) {
    newCapacity<<=1;
  }
  Object[] oldKeys=keys;
  Object[] oldValues=values;
  initTable(newCapacity);
  for (int i=0; i < oldKeys.length; ++i) {
    Object k=oldKeys[i];
    if (k != null) {
      int newIndex=getKeyIndex(unmaskNullKey(k));
      while (keys[newIndex] != null) {
        if (++newIndex == keys.length) {
          newIndex=0;
        }
      }
      keys[newIndex]=k;
      values[newIndex]=oldValues[i];
    }
  }
}

Fixed version (ground truth):
/** 
 * Ensures the map is large enough to contain the specified number of entries. Default access to avoid synthetic accessors from inner classes.
 */
boolean ensureSizeFor(int expectedSize){
  if (keys.length * 3 >= expectedSize * 4) {
    return false;
  }
  int newCapacity=keys.length << 1;
  while (newCapacity * 3 < expectedSize * 4) {
    newCapacity<<=1;
  }
  Object[] oldKeys=keys;
  Object[] oldValues=values;
  initTable(newCapacity);
  for (int i=0; i < oldKeys.length; ++i) {
    Object k=oldKeys[i];
    if (k != null) {
      int newIndex=getKeyIndex(unmaskNullKey(k));
      while (keys[newIndex] != null) {
        if (++newIndex == keys.length) {
          newIndex=0;
        }
      }
      keys[newIndex]=k;
      values[newIndex]=oldValues[i];
    }
  }
  return true;
}
Program: 81872
Project: 81872
Buggy source:
@Override public Object createServiceInstance(Method contextMethod,Method domainMethod){
  Class<? extends ServiceLocator> locatorType=getTop().resolveServiceLocator(contextMethod,domainMethod);
  ServiceLocator locator=newInstance(locatorType,ServiceLocator.class);
  return locator.getInstance(domainMethod.getDeclaringClass());
}

Fixed version (ground truth):
@Override public Object createServiceInstance(Method contextMethod,Method domainMethod){
  Class<? extends ServiceLocator> locatorType=getTop().resolveServiceLocator(contextMethod,domainMethod);
  ServiceLocator locator=newInstance(locatorType,ServiceLocator.class);
  Class<?> declaringClass=contextMethod.getDeclaringClass();
  Class<?> serviceClass=getTop().resolveServiceClass((Class<? extends RequestContext>)declaringClass);
  return locator.getInstance(serviceClass);
}
Program: 81873
Project: 81873
Buggy source:
@Override public Method resolveDomainMethod(Method requestContextMethod){
  Class<?> enclosing=requestContextMethod.getDeclaringClass();
  Class<?> searchIn=null;
  Service s=enclosing.getAnnotation(Service.class);
  if (s != null) {
    searchIn=s.value();
  }
  ServiceName sn=enclosing.getAnnotation(ServiceName.class);
  if (sn != null) {
    searchIn=forName(sn.value());
  }
  if (searchIn == null) {
    die(null,"String_Node_Str",RequestContext.class.getSimpleName(),enclosing.getCanonicalName());
  }
  Class<?>[] parameterTypes=requestContextMethod.getParameterTypes();
  Class<?>[] domainArgs=new Class<?>[parameterTypes.length];
  for (int i=0, j=domainArgs.length; i < j; i++) {
    if (BaseProxy.class.isAssignableFrom(parameterTypes[i])) {
      domainArgs[i]=getTop().resolveDomainClass(parameterTypes[i].asSubclass(BaseProxy.class));
    }
 else     if (EntityProxyId.class.isAssignableFrom(parameterTypes[i])) {
      domainArgs[i]=TypeUtils.ensureBaseType(TypeUtils.getSingleParameterization(EntityProxyId.class,requestContextMethod.getGenericParameterTypes()[i]));
    }
 else {
      domainArgs[i]=parameterTypes[i];
    }
  }
  Throwable ex;
  try {
    return searchIn.getMethod(requestContextMethod.getName(),domainArgs);
  }
 catch (  SecurityException e) {
    ex=e;
  }
catch (  NoSuchMethodException e) {
    return report("String_Node_Str",requestContextMethod.getName());
  }
  return die(ex,"String_Node_Str",requestContextMethod.getName(),searchIn.getCanonicalName());
}

Fixed version (ground truth):
@Override public Method resolveDomainMethod(Method requestContextMethod){
  Class<?> declaringClass=requestContextMethod.getDeclaringClass();
  Class<?> searchIn=getTop().resolveServiceClass((Class<? extends RequestContext>)declaringClass);
  Class<?>[] parameterTypes=requestContextMethod.getParameterTypes();
  Class<?>[] domainArgs=new Class<?>[parameterTypes.length];
  for (int i=0, j=domainArgs.length; i < j; i++) {
    if (BaseProxy.class.isAssignableFrom(parameterTypes[i])) {
      domainArgs[i]=getTop().resolveDomainClass(parameterTypes[i].asSubclass(BaseProxy.class));
    }
 else     if (EntityProxyId.class.isAssignableFrom(parameterTypes[i])) {
      domainArgs[i]=TypeUtils.ensureBaseType(TypeUtils.getSingleParameterization(EntityProxyId.class,requestContextMethod.getGenericParameterTypes()[i]));
    }
 else {
      domainArgs[i]=parameterTypes[i];
    }
  }
  Throwable ex;
  try {
    return searchIn.getMethod(requestContextMethod.getName(),domainArgs);
  }
 catch (  SecurityException e) {
    ex=e;
  }
catch (  NoSuchMethodException e) {
    return report("String_Node_Str",requestContextMethod.getName());
  }
  return die(ex,"String_Node_Str",requestContextMethod.getName(),searchIn.getCanonicalName());
}
Program: 81874
Project: 81874
Buggy source:
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(BoxesAndPrimitivesJreTest.class);
  suite.addTestSuite(ComplexKeysJreTest.class);
  suite.addTestSuite(FindServiceJreTest.class);
  suite.addTestSuite(LocatorJreTest.class);
  suite.addTestSuite(RequestFactoryExceptionPropagationJreTest.class);
  suite.addTestSuite(RequestFactoryInterfaceValidatorTest.class);
  suite.addTestSuite(RequestFactoryJreTest.class);
  suite.addTestSuite(RequestFactoryModelTest.class);
  suite.addTestSuite(RequestFactoryUnicodeEscapingJreTest.class);
  suite.addTestSuite(SimpleEntityProxyIdTest.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  TestSuite suite=new TestSuite("String_Node_Str");
  suite.addTestSuite(BoxesAndPrimitivesJreTest.class);
  suite.addTestSuite(ComplexKeysJreTest.class);
  suite.addTestSuite(FindServiceJreTest.class);
  suite.addTestSuite(LocatorJreTest.class);
  suite.addTestSuite(RequestFactoryExceptionPropagationJreTest.class);
  suite.addTestSuite(RequestFactoryInterfaceValidatorTest.class);
  suite.addTestSuite(RequestFactoryJreTest.class);
  suite.addTestSuite(RequestFactoryModelTest.class);
  suite.addTestSuite(RequestFactoryUnicodeEscapingJreTest.class);
  suite.addTestSuite(ServiceInheritanceJreTest.class);
  suite.addTestSuite(SimpleEntityProxyIdTest.class);
  return suite;
}
Program: 81875
Project: 81875
Buggy source:
@Override public void generateSelectMatchStart(SourceWriter out,TreeLogger logger,String value) throws UnableToCompleteException {
  missingPluralForms.remove(value);
  if (value.startsWith("String_Node_Str")) {
    try {
      long val=Long.parseLong(value.substring(1));
      out.println("String_Node_Str" + val + "String_Node_Str"+ value);
    }
 catch (    NumberFormatException e) {
      throw error(logger,"String_Node_Str" + value + "String_Node_Str",e);
    }
    out.indent();
    return;
  }
  if (inExactMatches) {
    inExactMatches=false;
    out.println("String_Node_Str");
    out.indent();
    out.println("String_Node_Str" + argNumber + "String_Node_Str");
    out.indent();
  }
  if ("String_Node_Str".equals(value)) {
    out.println("String_Node_Str");
    out.indent();
    return;
  }
  PluralForm[] pluralForms=pluralRule.pluralForms();
  for (int i=0; i < pluralForms.length; ++i) {
    if (pluralForms[i].getName().equals(value)) {
      out.println("String_Node_Str" + i + "String_Node_Str"+ value);
      out.indent();
      return;
    }
  }
  logger.log(TreeLogger.WARN,"String_Node_Str" + value + "String_Node_Str"+ pluralRule.getClass().getCanonicalName()+ "String_Node_Str");
  out.println("String_Node_Str" + (bogusCaseValue++) + "String_Node_Str"+ value+ "String_Node_Str");
  out.indent();
}

Fixed version (ground truth):
@Override public void generateSelectMatchStart(SourceWriter out,TreeLogger logger,String value) throws UnableToCompleteException {
  missingPluralForms.remove(value);
  if (value.startsWith("String_Node_Str")) {
    try {
      long val=Long.parseLong(value.substring(1));
      out.println("String_Node_Str" + val + "String_Node_Str"+ value);
    }
 catch (    NumberFormatException e) {
      throw error(logger,"String_Node_Str" + value + "String_Node_Str",e);
    }
    out.indent();
    return;
  }
  if (inExactMatches) {
    inExactMatches=false;
    out.println("String_Node_Str");
    out.indent();
    out.println("String_Node_Str" + argNumber + "String_Node_Str");
    out.indent();
  }
  if (AlternateMessageSelector.OTHER_FORM_NAME.equals(value)) {
    out.println("String_Node_Str");
    out.indent();
    return;
  }
  PluralForm[] pluralForms=pluralRule.pluralForms();
  for (int i=0; i < pluralForms.length; ++i) {
    if (pluralForms[i].getName().equals(value)) {
      out.println("String_Node_Str" + i + "String_Node_Str"+ value);
      out.indent();
      return;
    }
  }
  logger.log(TreeLogger.WARN,"String_Node_Str" + value + "String_Node_Str"+ pluralRule.getClass().getCanonicalName()+ "String_Node_Str");
  out.println("String_Node_Str" + (bogusCaseValue++) + "String_Node_Str"+ value+ "String_Node_Str");
  out.indent();
}
Program: 81880
Project: 81880
Buggy source:
protected void addMapping(List<AlternateFormMapping> mapping,int numSelectors,String joinedForms,String msg){
  String[] formNames=joinedForms.split("String_Node_Str");
  if (formNames.length != numSelectors) {
    return;
  }
  List<AlternateForm> forms=new ArrayList<AlternateForm>();
  boolean nonOther=false;
  for (int selIdx=0; selIdx < numSelectors; ++selIdx) {
    String formName=formNames[selIdx];
    if (!selectors[selIdx].isFormAcceptable(formName)) {
      nonOther=false;
      break;
    }
    if (isStringMap || !"String_Node_Str".equals(formName)) {
      nonOther=true;
    }
    forms.add(new AlternateForm(formName,formName));
  }
  if (!nonOther) {
  }
 else {
    mapping.add(new AlternateFormMapping(forms,msg));
  }
}

Fixed version (ground truth):
protected void addMapping(List<AlternateFormMapping> mapping,int numSelectors,String joinedForms,String msg){
  String[] formNames=joinedForms.split("String_Node_Str");
  if (formNames.length != numSelectors) {
    return;
  }
  List<AlternateForm> forms=new ArrayList<AlternateForm>();
  boolean nonOther=false;
  for (int selIdx=0; selIdx < numSelectors; ++selIdx) {
    String formName=formNames[selIdx];
    if (!selectors[selIdx].isFormAcceptable(formName)) {
      nonOther=false;
      break;
    }
    if (isStringMap || !AlternateMessageSelector.OTHER_FORM_NAME.equals(formName)) {
      nonOther=true;
    }
    forms.add(new AlternateForm(formName,formName));
  }
  if (!nonOther) {
  }
 else {
    mapping.add(new AlternateFormMapping(forms,msg));
  }
}
Program: 81882
Project: 81882
Buggy source:
public void accept(MessageVisitor mv,GwtLocale locale) throws MessageProcessingException {
  ensureSelectorParams();
  List<Parameter> params=getParameters();
  int numSelectors=selectorParams.length;
  String[] lastForm=new String[numSelectors];
  MessageTranslation trans=null;
  if (locale != null) {
    for (    GwtLocale search : locale.getCompleteSearchList()) {
      trans=getTranslation(search);
      if (trans != null) {
        break;
      }
    }
  }
  if (trans == null) {
    trans=this;
  }
  for (  AlternateFormMapping mapping : trans.getAllMessageForms()) {
    List<AlternateForm> forms=mapping.getForms();
    boolean allOther=true;
    for (int i=0; i < forms.size(); ++i) {
      lastForm[i]=forms.get(i).getName();
      if (!"String_Node_Str".equals(lastForm[i])) {
        allOther=false;
      }
    }
    mv.visitTranslation(lastForm,allOther,messageStyle,mapping.getMessage());
  }
  mv.endMessage(this,trans);
}

Fixed version (ground truth):
public void accept(MessageVisitor mv,GwtLocale locale) throws MessageProcessingException {
  ensureSelectorParams();
  List<Parameter> params=getParameters();
  int numSelectors=selectorParams.length;
  String[] lastForm=new String[numSelectors];
  MessageTranslation trans=null;
  if (locale != null) {
    for (    GwtLocale search : locale.getCompleteSearchList()) {
      trans=getTranslation(search);
      if (trans != null) {
        break;
      }
    }
  }
  if (trans == null) {
    trans=this;
  }
  for (  AlternateFormMapping mapping : trans.getAllMessageForms()) {
    List<AlternateForm> forms=mapping.getForms();
    boolean allOther=true;
    for (int i=0; i < forms.size(); ++i) {
      lastForm[i]=forms.get(i).getName();
      if (!AlternateMessageSelector.OTHER_FORM_NAME.equals(lastForm[i])) {
        allOther=false;
      }
    }
    mv.visitTranslation(lastForm,allOther,messageStyle,mapping.getMessage());
  }
  mv.endMessage(this,trans);
}
Program: 81883
Project: 81883
Buggy source:
private AlternateMessageSelector computeAlternateMessageSelector(){
  PluralCount pluralAnnot=getAnnotation(PluralCount.class);
  if (pluralAnnot != null) {
    Class<? extends PluralRule> pluralClass=pluralAnnot.value();
    DefaultLocale defLocaleAnnot=getAnnotation(DefaultLocale.class);
    String defaultLocale=null;
    if (defLocaleAnnot != null) {
      defaultLocale=defLocaleAnnot.value();
    }
 else {
      defaultLocale=DefaultLocale.DEFAULT_LOCALE;
    }
    PluralRule pluralRule=getLocalizedPluralRule(pluralClass,localeFactory.fromString(defaultLocale));
    return new PluralRuleAdapter(pluralRule);
  }
  Select selectAnnot=getAnnotation(Select.class);
  if (selectAnnot != null) {
    final String[] validValues=type.getEnumValues();
    return new AlternateMessageSelector(){
      public boolean isFormAcceptable(      String form){
        if (validValues == null) {
          return true;
        }
        for (        String value : validValues) {
          if (value.equals(form)) {
            return true;
          }
        }
        return false;
      }
    }
;
  }
  return null;
}

Fixed version (ground truth):
private AlternateMessageSelector computeAlternateMessageSelector(){
  PluralCount pluralAnnot=getAnnotation(PluralCount.class);
  if (pluralAnnot != null) {
    Class<? extends PluralRule> pluralClass=pluralAnnot.value();
    DefaultLocale defLocaleAnnot=getAnnotation(DefaultLocale.class);
    String defaultLocale=null;
    if (defLocaleAnnot != null) {
      defaultLocale=defLocaleAnnot.value();
    }
 else {
      defaultLocale=DefaultLocale.DEFAULT_LOCALE;
    }
    PluralRule pluralRule=getLocalizedPluralRule(pluralClass,localeFactory.fromString(defaultLocale));
    return new PluralRuleAdapter(pluralRule);
  }
  Select selectAnnot=getAnnotation(Select.class);
  if (selectAnnot != null) {
    final String[] validValues=type.getEnumValues();
    return new AlternateMessageSelector(){
      public boolean isFormAcceptable(      String form){
        if (validValues == null || AlternateMessageSelector.OTHER_FORM_NAME.equals(form)) {
          return true;
        }
        for (        String value : validValues) {
          if (value.equals(form)) {
            return true;
          }
        }
        return false;
      }
    }
;
  }
  return null;
}
Program: 81884
Project: 81884
Buggy source:
public boolean isFormAcceptable(String form){
  if (validValues == null) {
    return true;
  }
  for (  String value : validValues) {
    if (value.equals(form)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean isFormAcceptable(String form){
  if (validValues == null || AlternateMessageSelector.OTHER_FORM_NAME.equals(form)) {
    return true;
  }
  for (  String value : validValues) {
    if (value.equals(form)) {
      return true;
    }
  }
  return false;
}
Program: 81885
Project: 81885
Buggy source:
public static Test suite(){
  GWTTestSuite suite=new GWTTestSuite("String_Node_Str");
  suite.addTestSuite(DocumentTest.class);
  suite.addTestSuite(NodeTest.class);
  suite.addTestSuite(ElementTest.class);
  suite.addTestSuite(FormTests.class);
  suite.addTestSuite(MapTests.class);
  suite.addTestSuite(SelectTests.class);
  suite.addTestSuite(StyleInjectorTest.class);
  suite.addTestSuite(TableTests.class);
  suite.addTestSuite(TextTest.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  GWTTestSuite suite=new GWTTestSuite("String_Node_Str");
  suite.addTestSuite(DocumentTest.class);
  suite.addTestSuite(NodeTest.class);
  suite.addTestSuite(ElementTest.class);
  suite.addTestSuite(FormTests.class);
  suite.addTestSuite(FrameTests.class);
  suite.addTestSuite(MapTests.class);
  suite.addTestSuite(SelectTests.class);
  suite.addTestSuite(StyleInjectorTest.class);
  suite.addTestSuite(TableTests.class);
  suite.addTestSuite(TextTest.class);
  return suite;
}
Program: 81886
Project: 81886
Buggy source:
/** 
 * Determines whether the given   {@link JavaScriptObject} is a DOM node. A<code>null</code> object will cause this method to return <code>false</code>.
 */
public static native boolean is(JavaScriptObject o);

Fixed version (ground truth):
/** 
 * Determines whether the given   {@link JavaScriptObject} is a DOM node. A<code>null</code> object will cause this method to return <code>false</code>. The try catch is needed for the firefox permission error: "Permission denied to access property 'nodeType'"
 */
public static native boolean is(JavaScriptObject o);
Program: 81887
Project: 81887
Buggy source:
public boolean isChanged(){
  for (  AutoBean<?> bean : editedProxies.values()) {
    AutoBean<?> previous=bean.getTag(Constants.PARENT_OBJECT);
    if (previous == null) {
      Class<?> proxyClass=((EntityProxy)bean.as()).stableId().getProxyClass();
      previous=getRequestFactory().getAutoBeanFactory().create(proxyClass);
    }
    if (!AutoBeanUtils.diff(previous,bean).isEmpty()) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean isChanged(){
  for (  AutoBean<? extends BaseProxy> bean : editedProxies.values()) {
    AutoBean<?> previous=bean.getTag(Constants.PARENT_OBJECT);
    if (previous == null) {
      Class<?> proxyClass=stableId(bean).getProxyClass();
      previous=getRequestFactory().getAutoBeanFactory().create(proxyClass);
    }
    if (!AutoBeanUtils.diff(previous,bean).isEmpty()) {
      return true;
    }
  }
  return false;
}
Program: 81888
Project: 81888
Buggy source:
/** 
 * Returns a hash code on the byte code of the class. TODO(zundel): should be a hash on only the public API for this class. 
 */
public String getSignatureHash(){
  if (signatureHash == null) {
    signatureHash=Util.computeStrongName(getBytes());
  }
  return signatureHash;
}

Fixed version (ground truth):
/** 
 * Returns a hash code on the byte code of the class.
 */
public String getSignatureHash(){
  if (signatureHash == null) {
    signatureHash=BytecodeSignatureMaker.getCompileDependencySignature(getBytes());
  }
  return signatureHash;
}
Program: 81889
Project: 81889
Buggy source:
private Object writeReplace(){
  return new SerializedRef(target.getInternalName(),getSignatureHash());
}

Fixed version (ground truth):
protected Object writeReplace(){
  return new SerializedRef(target.getInternalName(),getSignatureHash());
}
Program: 81890
Project: 81890
Buggy source:
Splittable encode(Object obj){
  Splittable value;
  if (obj == null) {
    return LazySplittable.NULL;
  }
 else   if (obj.getClass().isEnum() && getRequestFactory() instanceof EnumMap) {
    value=ValueCodex.encode(((EnumMap)getRequestFactory()).getToken((Enum<?>)obj));
  }
 else   if (ValueCodex.canDecode(obj.getClass())) {
    value=ValueCodex.encode(obj);
  }
 else {
    value=AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(obj));
  }
  return value;
}

Fixed version (ground truth):
Splittable encode(Object obj){
  Splittable value;
  if (obj == null) {
    return LazySplittable.NULL;
  }
 else   if (obj.getClass().isEnum() && getRequestFactory().getAutoBeanFactory() instanceof EnumMap) {
    value=ValueCodex.encode(((EnumMap)getRequestFactory().getAutoBeanFactory()).getToken((Enum<?>)obj));
  }
 else   if (ValueCodex.canDecode(obj.getClass())) {
    value=ValueCodex.encode(obj);
  }
 else {
    value=AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(obj));
  }
  return value;
}
Program: 81891
Project: 81891
Buggy source:
public static Test suite(){
  GWTTestSuite suite=new GWTTestSuite("String_Node_Str");
  suite.addTestSuite(DocumentTest.class);
  suite.addTestSuite(NodeTest.class);
  suite.addTestSuite(ElementTest.class);
  suite.addTestSuite(FormTests.class);
  suite.addTestSuite(FrameTests.class);
  suite.addTestSuite(MapTests.class);
  suite.addTestSuite(SelectTests.class);
  suite.addTestSuite(StyleInjectorTest.class);
  suite.addTestSuite(TableTests.class);
  suite.addTestSuite(TextTest.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  GWTTestSuite suite=new GWTTestSuite("String_Node_Str");
  suite.addTestSuite(DocumentTest.class);
  suite.addTestSuite(NodeTest.class);
  suite.addTestSuite(ElementTest.class);
  suite.addTestSuite(FormTests.class);
  suite.addTestSuite(MapTests.class);
  suite.addTestSuite(SelectTests.class);
  suite.addTestSuite(StyleInjectorTest.class);
  suite.addTestSuite(TableTests.class);
  suite.addTestSuite(TextTest.class);
  return suite;
}
Program: 81892
Project: 81892
Buggy source:
/** 
 * Determines whether the given class fully implements an interface (either directly or via inherited methods).
 */
private boolean classFullyImplements(JClassType cls,JClassType intf){
  if (!intf.isAssignableFrom(cls)) {
    return false;
  }
  for (  JMethod meth : intf.getInheritableMethods()) {
    if (!classImplementsMethod(cls,meth)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Determines whether the given class fully implements an interface (either directly or via inherited methods).
 */
private boolean classFullyImplements(JClassType cls,JClassType intf){
  if ((intf.getMethods().length > 0) && !intf.isAssignableFrom(cls)) {
    return false;
  }
  for (  JMethod meth : intf.getInheritableMethods()) {
    if (!classImplementsMethod(cls,meth)) {
      return false;
    }
  }
  return true;
}
Program: 81893
Project: 81893
Buggy source:
/** 
 * This constructor may be used by subclasses to explicitly use an existing element. This element must be an &lt;img&gt; element.
 * @param element the element to be used
 */
protected Image(Element element){
  ImageElement.as(element);
  setElement(element);
}

Fixed version (ground truth):
/** 
 * This constructor may be used by subclasses to explicitly use an existing element. This element must be an &lt;img&gt; element.
 * @param element the element to be used
 */
protected Image(Element element){
  ImageElement.as(element);
  setElement(element);
  changeState(new UnclippedState(element));
}
Program: 81894
Project: 81894
Buggy source:
public static Test suite(){
  GWTTestSuite suite=new GWTTestSuite("String_Node_Str");
  suite.addTestSuite(DocumentTest.class);
  suite.addTestSuite(NodeTest.class);
  suite.addTestSuite(ElementTest.class);
  suite.addTestSuite(FormTests.class);
  suite.addTestSuite(MapTests.class);
  suite.addTestSuite(SelectTests.class);
  suite.addTestSuite(StyleInjectorTest.class);
  suite.addTestSuite(TableTests.class);
  suite.addTestSuite(TextTest.class);
  return suite;
}

Fixed version (ground truth):
public static Test suite(){
  GWTTestSuite suite=new GWTTestSuite("String_Node_Str");
  suite.addTestSuite(DocumentTest.class);
  suite.addTestSuite(NodeTest.class);
  suite.addTestSuite(ElementTest.class);
  suite.addTestSuite(FormTests.class);
  suite.addTestSuite(FrameTests.class);
  suite.addTestSuite(MapTests.class);
  suite.addTestSuite(SelectTests.class);
  suite.addTestSuite(StyleInjectorTest.class);
  suite.addTestSuite(TableTests.class);
  suite.addTestSuite(TextTest.class);
  return suite;
}
Program: 81895
Project: 81895
Buggy source:
private void animate(int duration){
  if (layoutData.size() == 0) {
    return;
  }
  double top=0, bottom=0;
  int i=0;
  for (; i < layoutData.size(); ++i) {
    LayoutData data=layoutData.get(i);
    layoutPanel.setWidgetTopHeight(data.header,top,unit,data.headerSize,unit);
    top+=data.headerSize;
    layoutPanel.setWidgetTopHeight(data.widget,top,unit,0,unit);
    if (i == selectedIndex) {
      break;
    }
  }
  for (int j=layoutData.size() - 1; j > i; --j) {
    LayoutData data=layoutData.get(j);
    layoutPanel.setWidgetBottomHeight(data.header,bottom,unit,data.headerSize,unit);
    layoutPanel.setWidgetBottomHeight(data.widget,bottom,unit,0,unit);
    bottom+=data.headerSize;
  }
  LayoutData data=layoutData.get(selectedIndex);
  layoutPanel.setWidgetTopBottom(data.widget,top,unit,bottom,unit);
  layoutPanel.animate(duration);
}

Fixed version (ground truth):
public void animate(int duration,AnimationCallback callback){
  if (layoutData.size() == 0) {
    if (callback != null) {
      callback.onAnimationComplete();
    }
    return;
  }
  double top=0, bottom=0;
  int i=0;
  for (; i < layoutData.size(); ++i) {
    LayoutData data=layoutData.get(i);
    layoutPanel.setWidgetTopHeight(data.header,top,unit,data.headerSize,unit);
    top+=data.headerSize;
    layoutPanel.setWidgetTopHeight(data.widget,top,unit,0,unit);
    if (i == selectedIndex) {
      break;
    }
  }
  for (int j=layoutData.size() - 1; j > i; --j) {
    LayoutData data=layoutData.get(j);
    layoutPanel.setWidgetBottomHeight(data.header,bottom,unit,data.headerSize,unit);
    layoutPanel.setWidgetBottomHeight(data.widget,bottom,unit,0,unit);
    bottom+=data.headerSize;
  }
  LayoutData data=layoutData.get(selectedIndex);
  layoutPanel.setWidgetTopBottom(data.widget,top,unit,bottom,unit);
  layoutPanel.animate(duration,callback);
}
Program: 81896
Project: 81896
Buggy source:
public boolean remove(Widget child){
  if (child.getParent() != layoutPanel) {
    return false;
  }
  for (int i=0; i < layoutData.size(); ++i) {
    LayoutData data=layoutData.get(i);
    if (data.widget == child) {
      layoutPanel.remove(data.header);
      layoutPanel.remove(data.widget);
      data.header.removeStyleName(HEADER_STYLE);
      data.widget.removeStyleName(CONTENT_STYLE);
      layoutData.remove(i);
      if (selectedIndex == i) {
        selectedIndex=-1;
        if (layoutData.size() > 0) {
          showWidget(layoutData.get(0).widget);
        }
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean remove(Widget child){
  if (child.getParent() != layoutPanel) {
    return false;
  }
  for (int i=0; i < layoutData.size(); ++i) {
    LayoutData data=layoutData.get(i);
    if (data.widget == child) {
      layoutPanel.remove(data.header);
      layoutPanel.remove(data.widget);
      data.header.removeStyleName(HEADER_STYLE);
      data.widget.removeStyleName(CONTENT_STYLE);
      layoutData.remove(i);
      if (selectedIndex == i) {
        selectedIndex=-1;
        if (layoutData.size() > 0) {
          showWidget(layoutData.get(0).widget);
        }
      }
 else {
        if (i <= selectedIndex) {
          selectedIndex--;
        }
        animate(animationDuration);
      }
      return true;
    }
  }
  return false;
}
Program: 81897
Project: 81897
Buggy source:
/** 
 * Tests to ensure that arbitrary widgets can be added/inserted effectively.
 */
public void testInsertWithWidgets(){
  StackLayoutPanel p=new StackLayoutPanel(Unit.EM);
  TextBox wa=new TextBox();
  CheckBox wb=new CheckBox();
  VerticalPanel wc=new VerticalPanel();
  wc.add(new Label("String_Node_Str"));
  wc.add(new Label("String_Node_Str"));
  p.add(new Label("String_Node_Str"),wc,1);
  p.insert(new Label("String_Node_Str"),wb,1,0);
  p.insert(new Label("String_Node_Str"),wa,1,0);
  assertNotNull(p.getHeaderWidget(0));
  assertNotNull(p.getHeaderWidget(1));
  assertNotNull(p.getHeaderWidget(2));
  assertEquals(3,p.getWidgetCount());
}

Fixed version (ground truth):
/** 
 * Tests to ensure that arbitrary widgets can be added/inserted effectively.
 */
public void testInsertWithWidgets(){
  StackLayoutPanel p=new StackLayoutPanel(Unit.EM);
  TextBox wa=new TextBox();
  CheckBox wb=new CheckBox();
  VerticalPanel wc=new VerticalPanel();
  wc.add(new Label("String_Node_Str"));
  wc.add(new Label("String_Node_Str"));
  Label contentA=new Label("String_Node_Str");
  Label contentB=new Label("String_Node_Str");
  Label contentC=new Label("String_Node_Str");
  p.add(contentC,wc,1);
  p.insert(contentB,wb,1,0);
  p.showWidget(1);
  p.insert(contentA,wa,1,0);
  assertEquals(2,p.getVisibleIndex());
  assertEquals(wa,p.getHeaderWidget(0));
  assertEquals(wb,p.getHeaderWidget(1));
  assertEquals(wc,p.getHeaderWidget(2));
  assertEquals(contentA,p.getWidget(0));
  assertEquals(contentB,p.getWidget(1));
  assertEquals(contentC,p.getWidget(2));
  assertEquals(3,p.getWidgetCount());
}
Program: 81900
Project: 81900
Buggy source:
/** 
 * Sometimes a variable reference can be to a local or parameter in an an enclosing method. This is a tricky situation to detect. There's no obvious way to tell, but the clue we can get from JDT is that the local's containing method won't be the same as the method we're currently processing. Once we have this clue, we can use getEmulationPath to compute the current class's binding for that field.
 */
private JVariable possiblyReferenceOuterLocal(JVariable variable,Binding binding){
  if (variable instanceof JLocal || variable instanceof JParameter) {
    LocalVariableBinding localBinding=(LocalVariableBinding)binding;
    if (localBinding.declaringScope.methodScope() != currentMethodScope) {
      variable=null;
      VariableBinding[] vars=currentMethodScope.getEmulationPath(localBinding);
      if (vars == null) {
        return null;
      }
      assert(vars.length == 1);
      VariableBinding varBinding=vars[0];
      if (varBinding instanceof SyntheticArgumentBinding) {
        JType type=(JType)typeMap.get(varBinding.type);
        String name=String.valueOf(varBinding.name);
        for (int i=0; i < currentMethod.getParams().size(); ++i) {
          JParameter param=currentMethod.getParams().get(i);
          if (type == param.getType() && name.equals(param.getName())) {
            variable=param;
            break;
          }
        }
      }
      if (variable == null) {
        variable=(JField)typeMap.get(varBinding);
      }
    }
  }
  return variable;
}

Fixed version (ground truth):
/** 
 * Sometimes a variable reference can be to a local or parameter in an an enclosing method. This is a tricky situation to detect. There's no obvious way to tell, but the clue we can get from JDT is that the local's containing method won't be the same as the method we're currently processing. Once we have this clue, we can use getEmulationPath to compute the current class's binding for that field.
 */
private JVariable possiblyReferenceOuterLocal(JVariable variable,Binding binding){
}
Program: 81902
Project: 81902
Buggy source:
private void fetch(final int start){
  lastFetch=start;
  requestFactory.schoolCalendarRequest().getPeople(start,numRows,filter).fire(new Receiver<List<PersonProxy>>(){
    @Override public void onSuccess(    List<PersonProxy> response){
      int responses=response.size();
      table.setRowData(start,response);
      pager.setPageStart(start);
      if (start == 0 || !table.isRowCountExact()) {
        table.setRowCount(start + responses,responses < numRows);
      }
    }
  }
);
}

Fixed version (ground truth):
private void fetch(final int start){
  lastFetch=start;
  requestFactory.schoolCalendarRequest().getPeople(start,numRows,filter).fire(new Receiver<List<PersonProxy>>(){
    @Override public void onSuccess(    List<PersonProxy> response){
      if (lastFetch != start) {
        return;
      }
      int responses=response.size();
      table.setRowData(start,response);
      pager.setPageStart(start);
      if (start == 0 || !table.isRowCountExact()) {
        table.setRowCount(start + responses,responses < numRows);
      }
    }
  }
);
}
Program: 81903
Project: 81903
Buggy source:
@Override public void onSuccess(List<PersonProxy> response){
  int responses=response.size();
  table.setRowData(start,response);
  pager.setPageStart(start);
  if (start == 0 || !table.isRowCountExact()) {
    table.setRowCount(start + responses,responses < numRows);
  }
}

Fixed version (ground truth):
@Override public void onSuccess(List<PersonProxy> response){
  if (lastFetch != start) {
    return;
  }
  int responses=response.size();
  table.setRowData(start,response);
  pager.setPageStart(start);
  if (start == 0 || !table.isRowCountExact()) {
    table.setRowCount(start + responses,responses < numRows);
  }
}
Program: 81904
Project: 81904
Buggy source:
/** 
 * Enable or disable the previous page buttons.
 * @param disabled true to disable, false to enable
 */
private void setPrevPageButtonsDisabled(boolean disabled){
  if (disabled == prevDisabled) {
    return;
  }
  prevDisabled=disabled;
  if (disabled) {
    firstPage.setResource(resources.simplePagerFirstPageDisabled());
    firstPage.getElement().getParentElement().addClassName(style.disabledButton());
    prevPage.setResource(resources.simplePagerPreviousPageDisabled());
    prevPage.getElement().getParentElement().addClassName(style.disabledButton());
  }
 else {
    firstPage.setResource(resources.simplePagerFirstPage());
    firstPage.getElement().getParentElement().removeClassName(style.disabledButton());
    prevPage.setResource(resources.simplePagerPreviousPage());
    prevPage.getElement().getParentElement().removeClassName(style.disabledButton());
  }
}

Fixed version (ground truth):
/** 
 * Enable or disable the previous page buttons.
 * @param disabled true to disable, false to enable
 */
private void setPrevPageButtonsDisabled(boolean disabled){
  firstPage.setDisabled(disabled);
  prevPage.setDisabled(disabled);
}
Program: 81905
Project: 81905
Buggy source:
/** 
 * Enable or disable the next page buttons.
 * @param disabled true to disable, false to enable
 */
private void setNextPageButtonsDisabled(boolean disabled){
  if (disabled == nextDisabled) {
    return;
  }
  nextDisabled=disabled;
  if (disabled) {
    nextPage.setResource(resources.simplePagerNextPageDisabled());
    nextPage.getElement().getParentElement().addClassName(style.disabledButton());
    if (lastPage != null) {
      lastPage.setResource(resources.simplePagerLastPageDisabled());
      lastPage.getElement().getParentElement().addClassName(style.disabledButton());
    }
  }
 else {
    nextPage.setResource(resources.simplePagerNextPage());
    nextPage.getElement().getParentElement().removeClassName(style.disabledButton());
    if (lastPage != null) {
      lastPage.setResource(resources.simplePagerLastPage());
      lastPage.getElement().getParentElement().removeClassName(style.disabledButton());
    }
  }
}

Fixed version (ground truth):
/** 
 * Enable or disable the next page buttons.
 * @param disabled true to disable, false to enable
 */
private void setNextPageButtonsDisabled(boolean disabled){
  nextPage.setDisabled(disabled);
  if (lastPage != null) {
    lastPage.setDisabled(disabled);
  }
}
Program: 81907
Project: 81907
Buggy source:
/** 
 * Check if the previous button is disabled. Visible for testing.
 */
boolean isPreviousButtonDisabled(){
  return prevDisabled;
}

Fixed version (ground truth):
/** 
 * Check if the previous button is disabled. Visible for testing.
 */
boolean isPreviousButtonDisabled(){
  return prevPage.isDisabled();
}
Program: 81908
Project: 81908
Buggy source:
/** 
 * Check if the next button is disabled. Visible for testing.
 */
boolean isNextButtonDisabled(){
  return nextDisabled;
}

Fixed version (ground truth):
/** 
 * Check if the next button is disabled. Visible for testing.
 */
boolean isNextButtonDisabled(){
  return nextPage.isDisabled();
}
Program: 81909
Project: 81909
Buggy source:
/** 
 * Reset the positions of the scrollable elements.
 * @return true if the size changed, false if not
 */
private boolean resetScrollables(){
  int offsetHeight=parent.getOffsetHeight();
  int offsetWidth=parent.getOffsetWidth();
  int height=offsetHeight + 100;
  int width=offsetWidth + 100;
  expandableInner.getStyle().setHeight(height,Unit.PX);
  expandableInner.getStyle().setWidth(width,Unit.PX);
  expandable.setScrollTop(height);
  expandable.setScrollLeft(width);
  collapsible.setScrollTop(collapsible.getScrollHeight() + 100);
  collapsible.setScrollLeft(collapsible.getScrollWidth() + 100);
  if (lastOffsetHeight != offsetHeight || lastOffsetWidth != offsetWidth) {
    lastOffsetHeight=offsetHeight;
    lastOffsetWidth=offsetWidth;
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Reset the positions of the scrollable elements.
 * @return true if the size changed, false if not
 */
private boolean resetScrollables(){
  if (resettingScrollables) {
    return false;
  }
  resettingScrollables=true;
  int offsetHeight=parent.getOffsetHeight();
  int offsetWidth=parent.getOffsetWidth();
  int height=offsetHeight + 100;
  int width=offsetWidth + 100;
  expandableInner.getStyle().setHeight(height,Unit.PX);
  expandableInner.getStyle().setWidth(width,Unit.PX);
  expandable.setScrollTop(height);
  expandable.setScrollLeft(width);
  collapsible.setScrollTop(collapsible.getScrollHeight() + 100);
  collapsible.setScrollLeft(collapsible.getScrollWidth() + 100);
  if (lastOffsetHeight != offsetHeight || lastOffsetWidth != offsetWidth) {
    lastOffsetHeight=offsetHeight;
    lastOffsetWidth=offsetWidth;
    resettingScrollables=false;
    return true;
  }
  resettingScrollables=false;
  return false;
}
Program: 81910
Project: 81910
Buggy source:
public void onBrowserEvent(Event event){
  if (Event.ONSCROLL == event.getTypeInt()) {
    EventTarget eventTarget=event.getEventTarget();
    if (!Element.is(eventTarget)) {
      return;
    }
    Element target=eventTarget.cast();
    if (target == collapsible || target == expandable) {
      handleResize();
    }
  }
}

Fixed version (ground truth):
public void onBrowserEvent(Event event){
  if (!resettingScrollables && Event.ONSCROLL == event.getTypeInt()) {
    EventTarget eventTarget=event.getEventTarget();
    if (!Element.is(eventTarget)) {
      return;
    }
    Element target=eventTarget.cast();
    if (target == collapsible || target == expandable) {
      handleResize();
    }
  }
}