nus-yam/ex-repair huggingface dataset:
Program: 77647
Project: 77647
Buggy source:
/** 
 * Return the list of visible constant fields for the given classdoc.
 * @param cd the classdoc to examine.
 * @return the list of visible constant fields for the given classdoc.
 */
protected List<FieldDoc> members(){
  List<ProgramElementDoc> l=visibleMemberMapFields.getLeafClassMembers(configuration);
  l.addAll(visibleMemberMapEnumConst.getLeafClassMembers(configuration));
  Iterator<ProgramElementDoc> iter;
  if (l != null) {
    iter=l.iterator();
  }
 else {
    return null;
  }
  List<FieldDoc> inclList=new LinkedList<FieldDoc>();
  FieldDoc member;
  while (iter.hasNext()) {
    member=(FieldDoc)iter.next();
    if (member.constantValue() != null) {
      inclList.add(member);
    }
  }
  return inclList;
}

Fixed version (ground truth):
/** 
 * Return the list of visible constant fields for the given classdoc.
 * @return the list of visible constant fields for the given classdoc.
 */
protected List<FieldDoc> members(){
  List<ProgramElementDoc> l=visibleMemberMapFields.getLeafClassMembers(configuration);
  l.addAll(visibleMemberMapEnumConst.getLeafClassMembers(configuration));
  Iterator<ProgramElementDoc> iter;
  if (l != null) {
    iter=l.iterator();
  }
 else {
    return null;
  }
  List<FieldDoc> inclList=new LinkedList<FieldDoc>();
  FieldDoc member;
  while (iter.hasNext()) {
    member=(FieldDoc)iter.next();
    if (member.constantValue() != null) {
      inclList.add(member);
    }
  }
  return inclList;
}
Program: 77648
Project: 77648
Buggy source:
/** 
 * Returns a list of methods that will be documented for the given class. This information can be used for doclet specific documentation generation.
 * @param classDoc the {@link ClassDoc} we want to check.
 * @param type the type of members to return.
 * @return a list of methods that will be documented.
 * @see VisibleMemberMap
 */
public List<ProgramElementDoc> members(int type){
  return visibleMemberMaps[type].getLeafClassMembers(configuration);
}

Fixed version (ground truth):
/** 
 * Returns a list of methods that will be documented for the given class. This information can be used for doclet specific documentation generation.
 * @param type the type of members to return.
 * @return a list of methods that will be documented.
 * @see VisibleMemberMap
 */
public List<ProgramElementDoc> members(int type){
  return visibleMemberMaps[type].getLeafClassMembers(configuration);
}
Program: 77650
Project: 77650
Buggy source:
/** 
 * Given an array of <code>ParamTag</code>s,return its string representation. Try to inherit the param tags that are missing.
 * @param doc               the doc that holds the param tags.
 * @param writer            the TagletWriter that will write this tag.
 * @param formalParameters  The array of parmeters (from type or executablemember) to check.
 * @return the TagletOutput representation of these <code>ParamTag</code>s.
 */
private TagletOutput getTagletOutput(boolean isNonTypeParams,Doc holder,TagletWriter writer,Object[] formalParameters,ParamTag[] paramTags){
  TagletOutput result=writer.getOutputInstance();
  Set<String> alreadyDocumented=new HashSet<String>();
  if (paramTags.length > 0) {
    result.appendOutput(processParamTags(isNonTypeParams,paramTags,getRankMap(formalParameters),writer,alreadyDocumented));
  }
  if (alreadyDocumented.size() != formalParameters.length) {
    result.appendOutput(getInheritedTagletOutput(isNonTypeParams,holder,writer,formalParameters,alreadyDocumented));
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Given an array of <code>ParamTag</code>s,return its string representation. Try to inherit the param tags that are missing.
 * @param holder            the doc that holds the param tags.
 * @param writer            the TagletWriter that will write this tag.
 * @param formalParameters  The array of parmeters (from type or executablemember) to check.
 * @return the TagletOutput representation of these <code>ParamTag</code>s.
 */
private TagletOutput getTagletOutput(boolean isNonTypeParams,Doc holder,TagletWriter writer,Object[] formalParameters,ParamTag[] paramTags){
  TagletOutput result=writer.getOutputInstance();
  Set<String> alreadyDocumented=new HashSet<String>();
  if (paramTags.length > 0) {
    result.appendOutput(processParamTags(isNonTypeParams,paramTags,getRankMap(formalParameters),writer,alreadyDocumented));
  }
  if (alreadyDocumented.size() != formalParameters.length) {
    result.appendOutput(getInheritedTagletOutput(isNonTypeParams,holder,writer,formalParameters,alreadyDocumented));
  }
  return result;
}
Program: 77652
Project: 77652
Buggy source:
/** 
 * Return the list of deprecated Doc objects of a given type.
 * @param the constant representing the type of list being returned.
 */
public List<Doc> getList(int type){
  return deprecatedLists.get(type);
}

Fixed version (ground truth):
/** 
 * Return the list of deprecated Doc objects of a given type.
 * @param type the constant representing the type of list being returned.
 */
public List<Doc> getList(int type){
  return deprecatedLists.get(type);
}
Program: 77653
Project: 77653
Buggy source:
/** 
 * Get the Extern Item object associated with this package name.
 * @param pkgname Package name.
 */
private Item findPackageItem(String pkgName){
  if (packageToItemMap == null) {
    return null;
  }
  return packageToItemMap.get(pkgName);
}

Fixed version (ground truth):
/** 
 * Get the Extern Item object associated with this package name.
 * @param pkgName Package name.
 */
private Item findPackageItem(String pkgName){
  if (packageToItemMap == null) {
    return null;
  }
  return packageToItemMap.get(pkgName);
}
Program: 77654
Project: 77654
Buggy source:
/** 
 * Constructor to build a Extern Item object and map it with the package name. If the same package name is found in the map, then the first mapped Item object or offline location will be retained.
 * @param packagename Package name found in the "package-list" file.
 * @param path        URL or Directory path from where the "package-list"file is picked.
 * @param relative    True if path is URL, false if directory path.
 */
Item(String packageName,String path,boolean relative){
  this.packageName=packageName;
  this.path=path;
  this.relative=relative;
  if (packageToItemMap == null) {
    packageToItemMap=new HashMap<String,Item>();
  }
  if (!packageToItemMap.containsKey(packageName)) {
    packageToItemMap.put(packageName,this);
  }
}

Fixed version (ground truth):
/** 
 * Constructor to build a Extern Item object and map it with the package name. If the same package name is found in the map, then the first mapped Item object or offline location will be retained.
 * @param packageName Package name found in the "package-list" file.
 * @param path        URL or Directory path from where the "package-list"file is picked.
 * @param relative    True if path is URL, false if directory path.
 */
Item(String packageName,String path,boolean relative){
  this.packageName=packageName;
  this.path=path;
  this.relative=relative;
  if (packageToItemMap == null) {
    packageToItemMap=new HashMap<String,Item>();
  }
  if (!packageToItemMap.containsKey(packageName)) {
    packageToItemMap.put(packageName,this);
  }
}
Program: 77655
Project: 77655
Buggy source:
/** 
 * Return the package private members inherited by the class.  Only return if parent is package private and not documented.
 * @param configuation the current configuration of the doclet.
 * @return the package private members inherited by the class.
 */
private List<ProgramElementDoc> getInheritedPackagePrivateMethods(Configuration configuration){
  List<ProgramElementDoc> results=new ArrayList<ProgramElementDoc>();
  for (Iterator<ClassDoc> iter=visibleClasses.iterator(); iter.hasNext(); ) {
    ClassDoc currentClass=iter.next();
    if (currentClass != classdoc && currentClass.isPackagePrivate() && !Util.isLinkable(currentClass,configuration)) {
      results.addAll(getMembersFor(currentClass));
    }
  }
  return results;
}

Fixed version (ground truth):
/** 
 * Return the package private members inherited by the class.  Only return if parent is package private and not documented.
 * @param configuration the current configuration of the doclet.
 * @return the package private members inherited by the class.
 */
private List<ProgramElementDoc> getInheritedPackagePrivateMethods(Configuration configuration){
  List<ProgramElementDoc> results=new ArrayList<ProgramElementDoc>();
  for (Iterator<ClassDoc> iter=visibleClasses.iterator(); iter.hasNext(); ) {
    ClassDoc currentClass=iter.next();
    if (currentClass != classdoc && currentClass.isPackagePrivate() && !Util.isLinkable(currentClass,configuration)) {
      results.addAll(getMembersFor(currentClass));
    }
  }
  return results;
}
Program: 77656
Project: 77656
Buggy source:
/** 
 * Return the visible members of the class being mapped.  Also append at the end of the list members that are inherited by inaccessible parents. We document these members in the child because the parent is not documented.
 * @param configuation the current configuration of the doclet.
 */
public List<ProgramElementDoc> getLeafClassMembers(Configuration configuration){
  List<ProgramElementDoc> result=getMembersFor(classdoc);
  result.addAll(getInheritedPackagePrivateMethods(configuration));
  return result;
}

Fixed version (ground truth):
/** 
 * Return the visible members of the class being mapped.  Also append at the end of the list members that are inherited by inaccessible parents. We document these members in the child because the parent is not documented.
 * @param configuration the current configuration of the doclet.
 */
public List<ProgramElementDoc> getLeafClassMembers(Configuration configuration){
  List<ProgramElementDoc> result=getMembersFor(classdoc);
  result.addAll(getInheritedPackagePrivateMethods(configuration));
  return result;
}
Program: 77657
Project: 77657
Buggy source:
/** 
 * Configure the set of diagnostic parts that should be displayed by the formatter.
 * @param options options to set
 */
public void setVisible(Set<DiagnosticPart> visibleParts);

Fixed version (ground truth):
/** 
 * Configure the set of diagnostic parts that should be displayed by the formatter.
 * @param visibleParts the parts to be set
 */
public void setVisible(Set<DiagnosticPart> visibleParts);
Program: 77658
Project: 77658
Buggy source:
/** 
 * Constructor used by service provider mechanism.  The recommended way to obtain an instance of this class is by using   {@link #create} or theservice provider mechanism.
 * @see javax.tools.JavaCompilerTool
 * @see javax.tools.ToolProvider
 * @see #create
 */
@Deprecated public JavacTool(){
}

Fixed version (ground truth):
/** 
 * Constructor used by service provider mechanism.  The recommended way to obtain an instance of this class is by using   {@link #create} or theservice provider mechanism.
 * @see javax.tools.JavaCompiler
 * @see javax.tools.ToolProvider
 * @see #create
 */
@Deprecated public JavacTool(){
}
Program: 77659
Project: 77659
Buggy source:
public Iterator<TypeSymbol> iterator(){
  return new Iterator<TypeSymbol>(){
    List<TypeSymbol> seen=List.nil();
    TypeSymbol currentSym=getSymbol(intype);
    public boolean hasNext(){
      return currentSym != null;
    }
    public TypeSymbol next(){
      TypeSymbol prevSym=currentSym;
      currentSym=getSymbol(types.supertype(currentSym.type));
      return prevSym;
    }
    public void remove(){
      throw new UnsupportedOperationException("String_Node_Str");
    }
    TypeSymbol getSymbol(    Type intype){
      if (intype.tag != CLASS && intype.tag != TYPEVAR) {
        return null;
      }
      while (intype.tag == TYPEVAR)       intype=intype.getUpperBound();
      if (seen.contains(intype.tsym)) {
        return null;
      }
      seen=seen.prepend(intype.tsym);
      return intype.tsym;
    }
  }
;
}

Fixed version (ground truth):
public Iterator<TypeSymbol> iterator(){
  return new Iterator<TypeSymbol>(){
    List<TypeSymbol> seen=List.nil();
    TypeSymbol currentSym=symbolFor(intype);
    TypeSymbol prevSym=null;
    public boolean hasNext(){
      if (currentSym == syms.noSymbol) {
        currentSym=symbolFor(types.supertype(prevSym.type));
      }
      return currentSym != null;
    }
    public TypeSymbol next(){
      prevSym=currentSym;
      currentSym=syms.noSymbol;
      Assert.check(prevSym != null || prevSym != syms.noSymbol);
      return prevSym;
    }
    public void remove(){
      throw new UnsupportedOperationException();
    }
    TypeSymbol symbolFor(    Type t){
      if (t.tag != CLASS && t.tag != TYPEVAR) {
        return null;
      }
      while (t.tag == TYPEVAR)       t=t.getUpperBound();
      if (seen.contains(t.tsym)) {
        return null;
      }
      seen=seen.prepend(t.tsym);
      return t.tsym;
    }
  }
;
}
Program: 77660
Project: 77660
Buggy source:
public boolean hasNext(){
  return currentSym != null;
}

Fixed version (ground truth):
public boolean hasNext(){
  if (currentSym == syms.noSymbol) {
    currentSym=symbolFor(types.supertype(prevSym.type));
  }
  return currentSym != null;
}
Program: 77661
Project: 77661
Buggy source:
public TypeSymbol next(){
  TypeSymbol prevSym=currentSym;
  currentSym=getSymbol(types.supertype(currentSym.type));
  return prevSym;
}

Fixed version (ground truth):
public TypeSymbol next(){
  prevSym=currentSym;
  currentSym=syms.noSymbol;
  Assert.check(prevSym != null || prevSym != syms.noSymbol);
  return prevSym;
}
Program: 77662
Project: 77662
Buggy source:
public void remove(){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
public void remove(){
  throw new UnsupportedOperationException();
}
Program: 77663
Project: 77663
Buggy source:
/** 
 * Return an Iterable object to scan the superclasses of a given type. It's crucial that the scan is done lazily, as we don't want to accidentally access more supertypes than strictly needed (as this could trigger completion errors if some of the not-needed supertypes are missing/ill-formed).
 */
Iterable<TypeSymbol> superclasses(final Type intype){
  return new Iterable<TypeSymbol>(){
    public Iterator<TypeSymbol> iterator(){
      return new Iterator<TypeSymbol>(){
        List<TypeSymbol> seen=List.nil();
        TypeSymbol currentSym=getSymbol(intype);
        public boolean hasNext(){
          return currentSym != null;
        }
        public TypeSymbol next(){
          TypeSymbol prevSym=currentSym;
          currentSym=getSymbol(types.supertype(currentSym.type));
          return prevSym;
        }
        public void remove(){
          throw new UnsupportedOperationException("String_Node_Str");
        }
        TypeSymbol getSymbol(        Type intype){
          if (intype.tag != CLASS && intype.tag != TYPEVAR) {
            return null;
          }
          while (intype.tag == TYPEVAR)           intype=intype.getUpperBound();
          if (seen.contains(intype.tsym)) {
            return null;
          }
          seen=seen.prepend(intype.tsym);
          return intype.tsym;
        }
      }
;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Return an Iterable object to scan the superclasses of a given type. It's crucial that the scan is done lazily, as we don't want to accidentally access more supertypes than strictly needed (as this could trigger completion errors if some of the not-needed supertypes are missing/ill-formed).
 */
Iterable<TypeSymbol> superclasses(final Type intype){
  return new Iterable<TypeSymbol>(){
    public Iterator<TypeSymbol> iterator(){
      return new Iterator<TypeSymbol>(){
        List<TypeSymbol> seen=List.nil();
        TypeSymbol currentSym=symbolFor(intype);
        TypeSymbol prevSym=null;
        public boolean hasNext(){
          if (currentSym == syms.noSymbol) {
            currentSym=symbolFor(types.supertype(prevSym.type));
          }
          return currentSym != null;
        }
        public TypeSymbol next(){
          prevSym=currentSym;
          currentSym=syms.noSymbol;
          Assert.check(prevSym != null || prevSym != syms.noSymbol);
          return prevSym;
        }
        public void remove(){
          throw new UnsupportedOperationException();
        }
        TypeSymbol symbolFor(        Type t){
          if (t.tag != CLASS && t.tag != TYPEVAR) {
            return null;
          }
          while (t.tag == TYPEVAR)           t=t.getUpperBound();
          if (seen.contains(t.tsym)) {
            return null;
          }
          seen=seen.prepend(t.tsym);
          return t.tsym;
        }
      }
;
    }
  }
;
}
Program: 77664
Project: 77664
Buggy source:
private Symbol findMethod(Env<AttrContext> env,Type site,Name name,List<Type> argtypes,List<Type> typeargtypes,Type intype,Symbol bestSoFar,boolean allowBoxing,boolean useVarargs,boolean operator){
  boolean abstractOk=true;
  List<Type> itypes=List.nil();
  for (  TypeSymbol s : superclasses(intype)) {
    bestSoFar=lookupMethod(env,site,name,argtypes,typeargtypes,s.members(),bestSoFar,allowBoxing,useVarargs,operator,true);
    abstractOk&=excludeAbstractsFilter.accepts(s);
    if (abstractOk) {
      for (      Type itype : types.interfaces(s.type)) {
        itypes=types.union(types.closure(itype),itypes);
      }
    }
    if (name == names.init)     break;
  }
  Symbol concrete=bestSoFar.kind < ERR && (bestSoFar.flags() & ABSTRACT) == 0 ? bestSoFar : methodNotFound;
  if (name != names.init) {
    for (    Type itype : itypes) {
      if (!itype.isInterface())       continue;
      bestSoFar=lookupMethod(env,site,name,argtypes,typeargtypes,itype.tsym.members(),bestSoFar,allowBoxing,useVarargs,operator,true);
      if (concrete != bestSoFar && concrete.kind < ERR && bestSoFar.kind < ERR && types.isSubSignature(concrete.type,bestSoFar.type)) {
        bestSoFar=concrete;
      }
    }
  }
  return bestSoFar;
}

Fixed version (ground truth):
private Symbol findMethod(Env<AttrContext> env,Type site,Name name,List<Type> argtypes,List<Type> typeargtypes,Type intype,Symbol bestSoFar,boolean allowBoxing,boolean useVarargs,boolean operator){
  boolean abstractOk=true;
  List<Type> itypes=List.nil();
  for (  TypeSymbol s : superclasses(intype)) {
    bestSoFar=lookupMethod(env,site,name,argtypes,typeargtypes,s.members(),bestSoFar,allowBoxing,useVarargs,operator,true);
    abstractOk&=(s.flags() & (ABSTRACT | INTERFACE | ENUM)) != 0;
    if (abstractOk) {
      for (      Type itype : types.interfaces(s.type)) {
        itypes=types.union(types.closure(itype),itypes);
      }
    }
    if (name == names.init)     break;
  }
  Symbol concrete=bestSoFar.kind < ERR && (bestSoFar.flags() & ABSTRACT) == 0 ? bestSoFar : methodNotFound;
  if (name != names.init) {
    for (    Type itype : itypes) {
      if (!itype.isInterface())       continue;
      bestSoFar=lookupMethod(env,site,name,argtypes,typeargtypes,itype.tsym.members(),bestSoFar,allowBoxing,useVarargs,operator,true);
      if (concrete != bestSoFar && concrete.kind < ERR && bestSoFar.kind < ERR && types.isSubSignature(concrete.type,bestSoFar.type)) {
        bestSoFar=concrete;
      }
    }
  }
  return bestSoFar;
}
Program: 77665
Project: 77665
Buggy source:
public boolean accepts(Name n){
  return n == names.init;
}

Fixed version (ground truth):
public boolean accepts(Name n){
  return n == n.table.names.init;
}
Program: 77666
Project: 77666
Buggy source:
public MethodHandle(int refKind,Symbol refSym,Names names){
  this.refKind=refKind;
  this.refSym=refSym;
  this.names=names;
  checkConsistent();
}

Fixed version (ground truth):
public MethodHandle(int refKind,Symbol refSym){
  this.refKind=refKind;
  this.refSym=refSym;
  checkConsistent();
}
Program: 77668
Project: 77668
Buggy source:
/** 
 * Return the first sentence of the comment as an array of tags. Includes inline tags (i.e. {&#64link <i>reference</i>} tags)  but not block tags. Each section of plain text is represented as a   {@link Tag}of   {@linkplain Tag#kind() kind} "Text".Inline tags are represented as a  {@link SeeTag} of kind "@see"and name "@link". <p> If the locale is English language, the first sentence is determined by the rules described in the Java Language Specification (first version): &quot;This sentence ends at the first period that is followed by a blank, tab, or line terminator or at the first tagline.&quot;, in addition a line will be terminated by block HTML tags: &lt;p&gt;  &lt;/p&gt;  &lt;h1&gt; &lt;h2&gt;  &lt;h3&gt; &lt;h4&gt;  &lt;h5&gt;  &lt;h6&gt; &lt;hr&gt;  &lt;pre&gt;  or &lt;/pre&gt;. If the locale is not English, the sentence end will be determined by {@link BreakIterator#getSentenceInstance(Locale)}.
 * @return an array of {@link Tag}s representing the first sentence of the comment
 */
Tag[] firstSentenceTags();

Fixed version (ground truth):
/** 
 * Return the first sentence of the comment as an array of tags. Includes inline tags (i.e. {&#64;link <i>reference</i>} tags)  but not block tags. Each section of plain text is represented as a   {@link Tag}of   {@linkplain Tag#kind() kind} "Text".Inline tags are represented as a  {@link SeeTag} of kind "@see"and name "@link". <p> If the locale is English language, the first sentence is determined by the rules described in the Java Language Specification (first version): &quot;This sentence ends at the first period that is followed by a blank, tab, or line terminator or at the first tagline.&quot;, in addition a line will be terminated by block HTML tags: &lt;p&gt;  &lt;/p&gt;  &lt;h1&gt; &lt;h2&gt;  &lt;h3&gt; &lt;h4&gt;  &lt;h5&gt;  &lt;h6&gt; &lt;hr&gt;  &lt;pre&gt;  or &lt;/pre&gt;. If the locale is not English, the sentence end will be determined by {@link BreakIterator#getSentenceInstance(Locale)}.
 * @return an array of {@link Tag}s representing the first sentence of the comment
 */
Tag[] firstSentenceTags();
Program: 77669
Project: 77669
Buggy source:
/** 
 * Return comment as an array of tags. Includes inline tags (i.e. {&#64link <i>reference</i>} tags)  but not block tags. Each section of plain text is represented as a   {@link Tag}of   {@linkplain Tag#kind() kind} "Text".Inline tags are represented as a  {@link SeeTag} of kind "@see"and name "@link".
 * @return an array of {@link Tag}s representing the comment
 */
Tag[] inlineTags();

Fixed version (ground truth):
/** 
 * Return comment as an array of tags. Includes inline tags (i.e. {&#64;link <i>reference</i>} tags)  but not block tags. Each section of plain text is represented as a   {@link Tag}of   {@linkplain Tag#kind() kind} "Text".Inline tags are represented as a  {@link SeeTag} of kind "@see"and name "@link".
 * @return an array of {@link Tag}s representing the comment
 */
Tag[] inlineTags();
Program: 77670
Project: 77670
Buggy source:
/** 
 * Return the param tags in this method, excluding the type parameter tags.
 * @return an array of ParamTag containing all <code>&#64param</code> tagscorresponding to the parameters of this method.
 */
ParamTag[] paramTags();

Fixed version (ground truth):
/** 
 * Return the param tags in this method, excluding the type parameter tags.
 * @return an array of ParamTag containing all <code>&#64;param</code> tagscorresponding to the parameters of this method.
 */
ParamTag[] paramTags();
Program: 77671
Project: 77671
Buggy source:
/** 
 * Return the type parameter tags in this method.
 * @return an array of ParamTag containing all <code>&#64param</code> tagscorresponding to the type parameters of this method.
 * @since 1.5
 */
ParamTag[] typeParamTags();

Fixed version (ground truth):
/** 
 * Return the type parameter tags in this method.
 * @return an array of ParamTag containing all <code>&#64;param</code> tagscorresponding to the type parameters of this method.
 * @since 1.5
 */
ParamTag[] typeParamTags();
Program: 77672
Project: 77672
Buggy source:
/** 
 * Return the throws tags in this method.
 * @return an array of ThrowTag containing all <code>&#64exception</code>and <code>&#64throws</code> tags.
 */
ThrowsTag[] throwsTags();

Fixed version (ground truth):
/** 
 * Return the throws tags in this method.
 * @return an array of ThrowTag containing all <code>&#64;exception</code>and <code>&#64;throws</code> tags.
 */
ThrowsTag[] throwsTags();
Program: 77673
Project: 77673
Buggy source:
/** 
 * Return the first sentence of the comment as an array of tags. Includes inline tags (i.e. {&#64link <i>reference</i>} tags)  but not block tags. Each section of plain text is represented as a   {@link Tag}of kind "Text". Inline tags are represented as a   {@link SeeTag} of kind "@link".If the locale is English language, the first sentence is determined by the rules described in the Java Language Specification (first version): &quot;This sentence ends at the first period that is followed by a blank, tab, or line terminator or at the first tagline.&quot;, in addition a line will be terminated by paragraph and section terminating HTML tags: &lt;p&gt;  &lt;/p&gt;  &lt;h1&gt; &lt;h2&gt;  &lt;h3&gt; &lt;h4&gt;  &lt;h5&gt;  &lt;h6&gt; &lt;hr&gt;  &lt;pre&gt;  or &lt;/pre&gt;. If the locale is not English, the sentence end will be determined by {@link BreakIterator#getSentenceInstance(Locale)}.
 * @return an array of {@link Tag} objects representing thefirst sentence of the comment
 */
Tag[] firstSentenceTags();

Fixed version (ground truth):
/** 
 * Return the first sentence of the comment as an array of tags. Includes inline tags (i.e. {&#64;link <i>reference</i>} tags)  but not block tags. Each section of plain text is represented as a   {@link Tag}of kind "Text". Inline tags are represented as a   {@link SeeTag} of kind "@link".If the locale is English language, the first sentence is determined by the rules described in the Java Language Specification (first version): &quot;This sentence ends at the first period that is followed by a blank, tab, or line terminator or at the first tagline.&quot;, in addition a line will be terminated by paragraph and section terminating HTML tags: &lt;p&gt;  &lt;/p&gt;  &lt;h1&gt; &lt;h2&gt;  &lt;h3&gt; &lt;h4&gt;  &lt;h5&gt;  &lt;h6&gt; &lt;hr&gt;  &lt;pre&gt;  or &lt;/pre&gt;. If the locale is not English, the sentence end will be determined by {@link BreakIterator#getSentenceInstance(Locale)}.
 * @return an array of {@link Tag} objects representing thefirst sentence of the comment
 */
Tag[] firstSentenceTags();
Program: 77674
Project: 77674
Buggy source:
/** 
 * Find the start position of a line.
 * @param line line number (beginning at 1)
 * @return     position of first character in line
 * @throws IndexOutOfBoundsException if <tt>lineNumber < 1</tt> if <tt>lineNumber > no. of lines</tt>
 */
long getStartPosition(long line);

Fixed version (ground truth):
/** 
 * Find the start position of a line.
 * @param line line number (beginning at 1)
 * @return     position of first character in line
 * @throws IndexOutOfBoundsException if  {@code lineNumber < 1}if   {@code lineNumber > no. of lines}
 */
long getStartPosition(long line);
Program: 77675
Project: 77675
Buggy source:
/** 
 * Print the heading in Html &lt;H2> format.
 * @param str The Header string.
 */
public void printIndexHeading(String str){
  h2();
  print(str);
  h2End();
}

Fixed version (ground truth):
/** 
 * Print the heading in Html   {@literal <H2>} format.
 * @param str The Header string.
 */
public void printIndexHeading(String str){
  h2();
  print(str);
  h2End();
}
Program: 77677
Project: 77677
Buggy source:
/** 
 * Handles the &lt;ClassDoc> tag.
 * @param node the XML element that specifies which components to document
 * @param contentTree the content tree to which the documentation will be added
 */
public void buildClassDoc(XMLNode node,Content contentTree) throws Exception {
  String key;
  if (isInterface) {
    key="String_Node_Str";
  }
 else   if (isEnum) {
    key="String_Node_Str";
  }
 else {
    key="String_Node_Str";
  }
  contentTree=writer.getHeader(configuration.getText(key) + "String_Node_Str" + classDoc.name());
  Content classContentTree=writer.getClassContentHeader();
  buildChildren(node,classContentTree);
  contentTree.addContent(classContentTree);
  writer.addFooter(contentTree);
  writer.printDocument(contentTree);
  writer.close();
  copyDocFiles();
}

Fixed version (ground truth):
/** 
 * Handles the   {@literal <ClassDoc>} tag.
 * @param node the XML element that specifies which components to document
 * @param contentTree the content tree to which the documentation will be added
 */
public void buildClassDoc(XMLNode node,Content contentTree) throws Exception {
  String key;
  if (isInterface) {
    key="String_Node_Str";
  }
 else   if (isEnum) {
    key="String_Node_Str";
  }
 else {
    key="String_Node_Str";
  }
  contentTree=writer.getHeader(configuration.getText(key) + "String_Node_Str" + classDoc.name());
  Content classContentTree=writer.getClassContentHeader();
  buildChildren(node,classContentTree);
  contentTree.addContent(classContentTree);
  writer.addFooter(contentTree);
  writer.printDocument(contentTree);
  writer.close();
  copyDocFiles();
}
Program: 77678
Project: 77678
Buggy source:
/** 
 * Enter a binary operation, as above but with two opcodes, which get encoded as (opcode1 << ByteCodeTags.preShift) + opcode2.
 * @param opcode1     First opcode.
 * @param opcode2     Second opcode.
 */
private void enterBinop(String name,Type left,Type right,Type res,int opcode1,int opcode2){
  enterBinop(name,left,right,res,(opcode1 << ByteCodes.preShift) | opcode2);
}

Fixed version (ground truth):
/** 
 * Enter a binary operation, as above but with two opcodes, which get encoded as  {@code (opcode1 << ByteCodeTags.preShift) + opcode2 }.
 * @param opcode1     First opcode.
 * @param opcode2     Second opcode.
 */
private void enterBinop(String name,Type left,Type right,Type res,int opcode1,int opcode2){
  enterBinop(name,left,right,res,(opcode1 << ByteCodes.preShift) | opcode2);
}
Program: 77680
Project: 77680
Buggy source:
/** 
 * Construct a tree that represents the closest outer instance <C.this> such that the given symbol is a member of C.
 * @param pos           The source code position to be used for the tree.
 * @param sym           The accessed symbol.
 * @param preciseMatch  should we accept a type that is a subtype ofsym's owner, even if it doesn't contain sym due to hiding, overriding, or non-inheritance due to protection?
 */
JCExpression makeOwnerThis(DiagnosticPosition pos,Symbol sym,boolean preciseMatch){
  Symbol c=sym.owner;
  if (preciseMatch ? sym.isMemberOf(currentClass,types) : currentClass.isSubClass(sym.owner,types)) {
    return make.at(pos).This(c.erasure(types));
  }
 else {
    return makeOwnerThisN(pos,sym,preciseMatch);
  }
}

Fixed version (ground truth):
/** 
 * Construct a tree that represents the closest outer instance  {@code C.this} such that the given symbol is a member of C.
 * @param pos           The source code position to be used for the tree.
 * @param sym           The accessed symbol.
 * @param preciseMatch  should we accept a type that is a subtype ofsym's owner, even if it doesn't contain sym due to hiding, overriding, or non-inheritance due to protection?
 */
JCExpression makeOwnerThis(DiagnosticPosition pos,Symbol sym,boolean preciseMatch){
  Symbol c=sym.owner;
  if (preciseMatch ? sym.isMemberOf(currentClass,types) : currentClass.isSubClass(sym.owner,types)) {
    return make.at(pos).This(c.erasure(types));
  }
 else {
    return makeOwnerThisN(pos,sym,preciseMatch);
  }
}
Program: 77681
Project: 77681
Buggy source:
/** 
 * Construct a tree that represents the outer instance <C.this>. Never pick the current `this'.
 * @param pos           The source code position to be used for the tree.
 * @param c             The qualifier class.
 */
JCExpression makeOuterThis(DiagnosticPosition pos,TypeSymbol c){
  List<VarSymbol> ots=outerThisStack;
  if (ots.isEmpty()) {
    log.error(pos,"String_Node_Str",c);
    Assert.error();
    return makeNull();
  }
  VarSymbol ot=ots.head;
  JCExpression tree=access(make.at(pos).Ident(ot));
  TypeSymbol otc=ot.type.tsym;
  while (otc != c) {
    do {
      ots=ots.tail;
      if (ots.isEmpty()) {
        log.error(pos,"String_Node_Str",c);
        Assert.error();
        return tree;
      }
      ot=ots.head;
    }
 while (ot.owner != otc);
    if (otc.owner.kind != PCK && !otc.hasOuterInstance()) {
      chk.earlyRefError(pos,c);
      Assert.error();
      return makeNull();
    }
    tree=access(make.at(pos).Select(tree,ot));
    otc=ot.type.tsym;
  }
  return tree;
}

Fixed version (ground truth):
/** 
 * Construct a tree that represents the outer instance  {@code C.this}. Never pick the current `this'.
 * @param pos           The source code position to be used for the tree.
 * @param c             The qualifier class.
 */
JCExpression makeOuterThis(DiagnosticPosition pos,TypeSymbol c){
  List<VarSymbol> ots=outerThisStack;
  if (ots.isEmpty()) {
    log.error(pos,"String_Node_Str",c);
    Assert.error();
    return makeNull();
  }
  VarSymbol ot=ots.head;
  JCExpression tree=access(make.at(pos).Ident(ot));
  TypeSymbol otc=ot.type.tsym;
  while (otc != c) {
    do {
      ots=ots.tail;
      if (ots.isEmpty()) {
        log.error(pos,"String_Node_Str",c);
        Assert.error();
        return tree;
      }
      ot=ots.head;
    }
 while (ot.owner != otc);
    if (otc.owner.kind != PCK && !otc.hasOuterInstance()) {
      chk.earlyRefError(pos,c);
      Assert.error();
      return makeNull();
    }
    tree=access(make.at(pos).Select(tree,ot));
    otc=ot.type.tsym;
  }
  return tree;
}
Program: 77682
Project: 77682
Buggy source:
/** 
 * Return tree simulating the assignment <this.this$n = this$n>.
 */
JCStatement initOuterThis(int pos){
  VarSymbol rhs=outerThisStack.head;
  Assert.check(rhs.owner.kind == MTH);
  VarSymbol lhs=outerThisStack.tail.head;
  Assert.check(rhs.owner.owner == lhs.owner);
  make.at(pos);
  return make.Exec(make.Assign(make.Select(make.This(lhs.owner.erasure(types)),lhs),make.Ident(rhs)).setType(lhs.erasure(types)));
}

Fixed version (ground truth):
/** 
 * Return tree simulating the assignment   {@code this.this$n = this$n}.
 */
JCStatement initOuterThis(int pos){
  VarSymbol rhs=outerThisStack.head;
  Assert.check(rhs.owner.kind == MTH);
  VarSymbol lhs=outerThisStack.tail.head;
  Assert.check(rhs.owner.owner == lhs.owner);
  make.at(pos);
  return make.Exec(make.Assign(make.Select(make.This(lhs.owner.erasure(types)),lhs),make.Ident(rhs)).setType(lhs.erasure(types)));
}
Program: 77683
Project: 77683
Buggy source:
/** 
 * Construct a tree simulating the expression <C.this>.
 * @param pos           The source code position to be used for the tree.
 * @param c             The qualifier class.
 */
JCExpression makeThis(DiagnosticPosition pos,TypeSymbol c){
  if (currentClass == c) {
    return make.at(pos).This(c.erasure(types));
  }
 else {
    return makeOuterThis(pos,c);
  }
}

Fixed version (ground truth):
/** 
 * Construct a tree simulating the expression   {@code C.this}.
 * @param pos           The source code position to be used for the tree.
 * @param c             The qualifier class.
 */
JCExpression makeThis(DiagnosticPosition pos,TypeSymbol c){
  if (currentClass == c) {
    return make.at(pos).This(c.erasure(types));
  }
 else {
    return makeOuterThis(pos,c);
  }
}
Program: 77685
Project: 77685
Buggy source:
/** 
 * Return tree simulating the assignment <this.name = name>, where name is the name of a free variable.
 */
JCStatement initField(int pos,Name name){
  Scope.Entry e=proxies.lookup(name);
  Symbol rhs=e.sym;
  Assert.check(rhs.owner.kind == MTH);
  Symbol lhs=e.next().sym;
  Assert.check(rhs.owner.owner == lhs.owner);
  make.at(pos);
  return make.Exec(make.Assign(make.Select(make.This(lhs.owner.erasure(types)),lhs),make.Ident(rhs)).setType(lhs.erasure(types)));
}

Fixed version (ground truth):
/** 
 * Return tree simulating the assignment   {@code this.name = name}, where name is the name of a free variable.
 */
JCStatement initField(int pos,Name name){
  Scope.Entry e=proxies.lookup(name);
  Symbol rhs=e.sym;
  Assert.check(rhs.owner.kind == MTH);
  Symbol lhs=e.next().sym;
  Assert.check(rhs.owner.owner == lhs.owner);
  make.at(pos);
  return make.Exec(make.Assign(make.Select(make.This(lhs.owner.erasure(types)),lhs),make.Ident(rhs)).setType(lhs.erasure(types)));
}
Program: 77686
Project: 77686
Buggy source:
/** 
 * A name designates an operator if it consists of a non-empty sequence of operator symbols +-~!/*%&|^<>=
 */
boolean isOperator(Name name){
  int i=0;
  while (i < name.getByteLength() && "String_Node_Str".indexOf(name.getByteAt(i)) >= 0)   i++;
  return i > 0 && i == name.getByteLength();
}

Fixed version (ground truth):
/** 
 * A name designates an operator if it consists of a non-empty sequence of operator symbols   {@literal +-~!/*%&|^<>= }
 */
boolean isOperator(Name name){
  int i=0;
  while (i < name.getByteLength() && "String_Node_Str".indexOf(name.getByteAt(i)) >= 0)   i++;
  return i > 0 && i == name.getByteLength();
}
Program: 77687
Project: 77687
Buggy source:
/** 
 * This method scans all the constructor symbol in a given class scope - assuming that the original scope contains a constructor of the kind: Foo(X x, Y y), where X,Y are class type-variables declared in Foo, a method check is executed against the modified constructor type: <X,Y>Foo<X,Y>(X x, Y y). This is crucial in order to enable diamond inference. The inferred return type of the synthetic constructor IS the inferred type for the diamond operator.
 */
private Symbol findDiamond(Env<AttrContext> env,Type site,List<Type> argtypes,List<Type> typeargtypes,boolean allowBoxing,boolean useVarargs){
  Symbol bestSoFar=methodNotFound;
  for (Scope.Entry e=site.tsym.members().lookup(names.init); e.scope != null; e=e.next()) {
    if (e.sym.kind == MTH && (e.sym.flags_field & SYNTHETIC) == 0) {
      List<Type> oldParams=e.sym.type.tag == FORALL ? ((ForAll)e.sym.type).tvars : List.<Type>nil();
      Type constrType=new ForAll(site.tsym.type.getTypeArguments().appendList(oldParams),types.createMethodTypeWithReturn(e.sym.type.asMethodType(),site));
      bestSoFar=selectBest(env,site,argtypes,typeargtypes,new MethodSymbol(e.sym.flags(),names.init,constrType,site.tsym),bestSoFar,allowBoxing,useVarargs,false);
    }
  }
  return bestSoFar;
}

Fixed version (ground truth):
/** 
 * This method scans all the constructor symbol in a given class scope - assuming that the original scope contains a constructor of the kind:  {@code Foo(X x, Y y)}, where X,Y are class type-variables declared in Foo, a method check is executed against the modified constructor type:  {@code <X,Y>Foo<X,Y>(X x, Y y)}. This is crucial in order to enable diamond inference. The inferred return type of the synthetic constructor IS the inferred type for the diamond operator.
 */
private Symbol findDiamond(Env<AttrContext> env,Type site,List<Type> argtypes,List<Type> typeargtypes,boolean allowBoxing,boolean useVarargs){
  Symbol bestSoFar=methodNotFound;
  for (Scope.Entry e=site.tsym.members().lookup(names.init); e.scope != null; e=e.next()) {
    if (e.sym.kind == MTH && (e.sym.flags_field & SYNTHETIC) == 0) {
      List<Type> oldParams=e.sym.type.tag == FORALL ? ((ForAll)e.sym.type).tvars : List.<Type>nil();
      Type constrType=new ForAll(site.tsym.type.getTypeArguments().appendList(oldParams),types.createMethodTypeWithReturn(e.sym.type.asMethodType(),site));
      bestSoFar=selectBest(env,site,argtypes,typeargtypes,new MethodSymbol(e.sym.flags(),names.init,constrType,site.tsym),bestSoFar,allowBoxing,useVarargs,false);
    }
  }
  return bestSoFar;
}
Program: 77688
Project: 77688
Buggy source:
/** 
 * Source file positions in CRT are integers in the format: line-number << LINESHIFT + column-number
 */
private int encodePosition(int pos,Position.LineMap lineMap,Log log){
  int line=lineMap.getLineNumber(pos);
  int col=lineMap.getColumnNumber(pos);
  int new_pos=Position.encodePosition(line,col);
  if (crtDebug) {
    System.out.println("String_Node_Str" + line + "String_Node_Str"+ col+ "String_Node_Str"+ new_pos);
  }
  if (new_pos == Position.NOPOS)   log.warning(pos,"String_Node_Str",line);
  return new_pos;
}

Fixed version (ground truth):
/** 
 * Source file positions in CRT are integers in the format:  {@literal line-number << LINESHIFT + column-number }
 */
private int encodePosition(int pos,Position.LineMap lineMap,Log log){
  int line=lineMap.getLineNumber(pos);
  int col=lineMap.getColumnNumber(pos);
  int new_pos=Position.encodePosition(line,col);
  if (crtDebug) {
    System.out.println("String_Node_Str" + line + "String_Node_Str"+ col+ "String_Node_Str"+ new_pos);
  }
  if (new_pos == Position.NOPOS)   log.warning(pos,"String_Node_Str",line);
  return new_pos;
}
Program: 77689
Project: 77689
Buggy source:
public synchronized int getNumDeactivated() throws RemoteException {
  return (num_deactivated);
}

Fixed version (ground truth):
public synchronized int getNumDeactivated() throws RemoteException {
  return num_deactivated;
}
Program: 77691
Project: 77691
Buggy source:
public void inc() throws RemoteException {
  incNumDeactivated();
}

Fixed version (ground truth):
public synchronized void inc() throws RemoteException {
  num_deactivated++;
}
Program: 77692
Project: 77692
Buggy source:
public String[] bases(String repId){
  String[] results=null;
  if (bases == null)   bases=new Hashtable();
 else   results=(String[])bases.get(repId);
  if (results == null && connectedCodeBase()) {
    results=delegate.bases(repId);
    if (results != null)     bases.put(repId,results);
  }
  return results;
}

Fixed version (ground truth):
public synchronized String[] bases(String repId){
  String[] results=null;
  if (bases == null)   bases=new Hashtable();
 else   results=(String[])bases.get(repId);
  if (results == null && connectedCodeBase()) {
    results=delegate.bases(repId);
    if (results != null)     bases.put(repId,results);
  }
  return results;
}
Program: 77693
Project: 77693
Buggy source:
public FullValueDescription[] metas(String[] repIds){
  FullValueDescription[] results=new FullValueDescription[repIds.length];
  for (int i=0; i < results.length; i++)   results[i]=meta(repIds[i]);
  return results;
}

Fixed version (ground truth):
public synchronized FullValueDescription[] metas(String[] repIds){
  FullValueDescription[] results=new FullValueDescription[repIds.length];
  for (int i=0; i < results.length; i++)   results[i]=meta(repIds[i]);
  return results;
}
Program: 77694
Project: 77694
Buggy source:
private boolean connectedCodeBase(){
  if (delegate != null)   return true;
  if (conn.getCodeBaseIOR() == null) {
    if (conn.getBroker().transportDebugFlag)     conn.dprint("String_Node_Str" + conn);
    return false;
  }
synchronized (this) {
    if (delegate != null)     return true;
    delegate=(CodeBase)CachedCodeBase.iorToCodeBaseObjMap.get(conn.getCodeBaseIOR());
    if (delegate != null)     return true;
    delegate=CodeBaseHelper.narrow(getObjectFromIOR());
    CachedCodeBase.iorToCodeBaseObjMap.put(conn.getCodeBaseIOR(),delegate);
  }
  return true;
}

Fixed version (ground truth):
private synchronized boolean connectedCodeBase(){
  if (delegate != null)   return true;
  if (conn.getCodeBaseIOR() == null) {
    if (conn.getBroker().transportDebugFlag)     conn.dprint("String_Node_Str" + conn);
    return false;
  }
synchronized (iorMapLock) {
    if (delegate != null)     return true;
    delegate=CachedCodeBase.iorMap.get(conn.getCodeBaseIOR());
    if (delegate != null)     return true;
    delegate=CodeBaseHelper.narrow(getObjectFromIOR());
    CachedCodeBase.iorMap.put(conn.getCodeBaseIOR(),delegate);
  }
  return true;
}
Program: 77695
Project: 77695
Buggy source:
public FullValueDescription meta(String repId){
  FullValueDescription result=null;
  if (fvds == null)   fvds=new Hashtable();
 else   result=(FullValueDescription)fvds.get(repId);
  if (result == null && connectedCodeBase()) {
    result=delegate.meta(repId);
    if (result != null)     fvds.put(repId,result);
  }
  return result;
}

Fixed version (ground truth):
public synchronized FullValueDescription meta(String repId){
  FullValueDescription result=null;
  if (fvds == null)   fvds=new Hashtable();
 else   result=(FullValueDescription)fvds.get(repId);
  if (result == null && connectedCodeBase()) {
    result=delegate.meta(repId);
    if (result != null)     fvds.put(repId,result);
  }
  return result;
}
Program: 77696
Project: 77696
Buggy source:
public String implementation(String repId){
  String urlResult=null;
  if (implementations == null)   implementations=new Hashtable();
 else   urlResult=(String)implementations.get(repId);
  if (urlResult == null && connectedCodeBase()) {
    urlResult=delegate.implementation(repId);
    if (urlResult != null)     implementations.put(repId,urlResult);
  }
  return urlResult;
}

Fixed version (ground truth):
public synchronized String implementation(String repId){
  String urlResult=null;
  if (implementations == null)   implementations=new Hashtable();
 else   urlResult=(String)implementations.get(repId);
  if (urlResult == null && connectedCodeBase()) {
    urlResult=delegate.implementation(repId);
    if (urlResult != null)     implementations.put(repId,urlResult);
  }
  return urlResult;
}
Program: 77697
Project: 77697
Buggy source:
public String[] implementations(String[] repIds){
  String[] urlResults=new String[repIds.length];
  for (int i=0; i < urlResults.length; i++)   urlResults[i]=implementation(repIds[i]);
  return urlResults;
}

Fixed version (ground truth):
public synchronized String[] implementations(String[] repIds){
  String[] urlResults=new String[repIds.length];
  for (int i=0; i < urlResults.length; i++)   urlResults[i]=implementation(repIds[i]);
  return urlResults;
}
Program: 77698
Project: 77698
Buggy source:
private static void executeCommandForPid(String pid,String command) throws AttachNotSupportedException, IOException, UnsupportedEncodingException {
  VirtualMachine vm=VirtualMachine.attach(pid);
  HotSpotVirtualMachine hvm=(HotSpotVirtualMachine)vm;
  try (InputStream in=hvm.executeJCmd(command)){
    byte b[]=new byte[256];
    int n;
    do {
      n=in.read(b);
      if (n > 0) {
        String s=new String(b,0,n,"String_Node_Str");
        System.out.print(s);
      }
    }
 while (n > 0);
  }
   vm.detach();
}

Fixed version (ground truth):
private static void executeCommandForPid(String pid,String command) throws AttachNotSupportedException, IOException, UnsupportedEncodingException {
  VirtualMachine vm=VirtualMachine.attach(pid);
  HotSpotVirtualMachine hvm=(HotSpotVirtualMachine)vm;
  String lines[]=command.split("String_Node_Str");
  for (  String line : lines) {
    try (InputStream in=hvm.executeJCmd(line)){
      byte b[]=new byte[256];
      int n;
      do {
        n=in.read(b);
        if (n > 0) {
          String s=new String(b,0,n,"String_Node_Str");
          System.out.print(s);
        }
      }
 while (n > 0);
    }
   }
  vm.detach();
}
Program: 77699
Project: 77699
Buggy source:
protected void close(){
  if (fd != null || fd1 != null) {
    datagramSocketClose();
    fd=null;
    fd1=null;
  }
}

Fixed version (ground truth):
protected void close(){
  if (fd != null || fd1 != null) {
    datagramSocketClose();
    ResourceManager.afterUdpClose();
    fd=null;
    fd1=null;
  }
}
Program: 77700
Project: 77700
Buggy source:
public Log make(){
  return Bark.instance(context);
}

Fixed version (ground truth):
public Log make(Context c){
  return Bark.instance(c);
}
Program: 77701
Project: 77701
Buggy source:
/** 
 * Preregisters factories to create and use a Bark object for use as both a Log and a Bark.
 */
public static void preRegister(final Context context){
  context.put(barkKey,new Context.Factory<Bark>(){
    public Bark make(){
      return new Bark(context);
    }
  }
);
  context.put(Log.logKey,new Context.Factory<Log>(){
    public Log make(){
      return Bark.instance(context);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Preregisters factories to create and use a Bark object for use as both a Log and a Bark.
 */
public static void preRegister(Context context){
  context.put(barkKey,new Context.Factory<Bark>(){
    public Bark make(    Context c){
      return new Bark(c);
    }
  }
);
  context.put(Log.logKey,new Context.Factory<Log>(){
    public Log make(    Context c){
      return Bark.instance(c);
    }
  }
);
}