nus-yam/ex-repair huggingface dataset:
Program: 72057
Project: 72057
Buggy source:
/** 
 * Return the kind of this tag. similar or synonymous tags.  For most tags, <code>kind()&nbsp;==&nbsp;name()</code>; the following table lists those cases where there is more than one tag of a given kind: <p> <table border="1" cellpadding="4" cellspacing="0"> <tr><th><tt> kind()  </tt></th>  <th><tt> name()      </tt></th></tr> <tr><td><tt> @throws </tt></td>  <td><tt> @throws     </tt></td></tr> <tr><td><tt> @throws </tt></td>  <td><tt> @exception  </tt></td></tr> <tr><td><tt> @see    </tt></td>  <td><tt> @see        </tt></td></tr> <tr><td><tt> @see    </tt></td>  <td><tt> @link       </tt></td></tr> <tr><td><tt> @see    </tt></td>  <td><tt> @linkplain  </tt></td></tr> <tr><td><tt> @serial </tt></td>  <td><tt> @serial     </tt></td></tr> <tr><td><tt> @serial </tt></td>  <td><tt> @serialData </tt></td></tr> </table>
 */
String kind();

Fixed version (ground truth):
/** 
 * Return the kind of this tag. For most tags, <code>kind()&nbsp;==&nbsp;name()</code>; the following table lists those cases where there is more than one tag of a given kind: <p> <table border="1" cellpadding="4" cellspacing="0" summary="related tags"> <tr><th>  {@code kind()  }</th>  <th>  {@code name()      }</th></tr> <tr><td>  {@code @throws }</td>  <td>  {@code @throws     }</td></tr> <tr><td>  {@code @throws }</td>  <td>  {@code @exception  }</td></tr> <tr><td>  {@code @see    }</td>  <td>  {@code @see        }</td></tr> <tr><td>  {@code @see    }</td>  <td>  {@code @link       }</td></tr> <tr><td>  {@code @see    }</td>  <td>  {@code @linkplain  }</td></tr> <tr><td>  {@code @serial }</td>  <td>  {@code @serial     }</td></tr> <tr><td>  {@code @serial }</td>  <td>  {@code @serialData }</td></tr> </table>
 * @return the kind of this tag.
 */
String kind();
Program: 72058
Project: 72058
Buggy source:
/** 
 * Return the name of this tag.  The name is the string starting with "@" that is used in a doc comment, such as <code>@return</code>.  For inline tags, such as <code>{&#064;link}</code>, the curly brackets are not part of the name, so in this example the name would be simply <code>@link</code>.
 */
String name();

Fixed version (ground truth):
/** 
 * Return the name of this tag.  The name is the string starting with "@" that is used in a doc comment, such as <code>@return</code>.  For inline tags, such as <code>{&#064;link}</code>, the curly brackets are not part of the name, so in this example the name would be simply <code>@link</code>.
 * @return the name of this tag
 */
String name();
Program: 72059
Project: 72059
Buggy source:
/** 
 * Return the containing   {@link Doc} of this Tag element.
 */
Doc holder();

Fixed version (ground truth):
/** 
 * Return the containing   {@link Doc} of this Tag element.
 * @return the containing {@link Doc} of this Tag element
 */
Doc holder();
Program: 72060
Project: 72060
Buggy source:
/** 
 * Return the text of this tag, that is, portion beyond tag name.
 */
String text();

Fixed version (ground truth):
/** 
 * Return the text of this tag, that is, the portion beyond tag name.
 * @return the text of this tag
 */
String text();
Program: 72061
Project: 72061
Buggy source:
BasicLookupHelper(Name name,Type site,List<Type> argtypes,List<Type> typeargtypes){
  super(name,site,argtypes,typeargtypes,MethodResolutionPhase.VARARITY);
}

Fixed version (ground truth):
BasicLookupHelper(Name name,Type site,List<Type> argtypes,List<Type> typeargtypes,MethodResolutionPhase maxPhase){
  super(name,site,argtypes,typeargtypes,maxPhase);
}
Program: 72063
Project: 72063
Buggy source:
/** 
 * Resolve operator.
 * @param pos       The position to use for error reporting.
 * @param optag     The tag of the operation tree.
 * @param env       The environment current at the operation.
 * @param argtypes  The types of the operands.
 */
Symbol resolveOperator(DiagnosticPosition pos,JCTree.Tag optag,Env<AttrContext> env,List<Type> argtypes){
  MethodResolutionContext prevResolutionContext=currentResolutionContext;
  try {
    currentResolutionContext=new MethodResolutionContext();
    Name name=treeinfo.operatorName(optag);
    env.info.pendingResolutionPhase=currentResolutionContext.step=BASIC;
    Symbol sym=findMethod(env,syms.predefClass.type,name,argtypes,null,false,false,true);
    if (boxingEnabled && sym.kind >= WRONG_MTHS)     env.info.pendingResolutionPhase=currentResolutionContext.step=BOX;
    sym=findMethod(env,syms.predefClass.type,name,argtypes,null,true,false,true);
    return accessMethod(sym,pos,env.enclClass.sym.type,name,false,argtypes,null);
  }
  finally {
    currentResolutionContext=prevResolutionContext;
  }
}

Fixed version (ground truth):
/** 
 * Resolve operator.
 * @param pos       The position to use for error reporting.
 * @param optag     The tag of the operation tree.
 * @param env       The environment current at the operation.
 * @param argtypes  The types of the operands.
 */
Symbol resolveOperator(DiagnosticPosition pos,JCTree.Tag optag,Env<AttrContext> env,List<Type> argtypes){
  MethodResolutionContext prevResolutionContext=currentResolutionContext;
  try {
    currentResolutionContext=new MethodResolutionContext();
    Name name=treeinfo.operatorName(optag);
    return lookupMethod(env,pos,syms.predefClass,currentResolutionContext,new BasicLookupHelper(name,syms.predefClass.type,argtypes,null,BOX){
      @Override Symbol lookup(      Env<AttrContext> env,      MethodResolutionPhase phase){
        return findMethod(env,site,name,argtypes,typeargtypes,phase.isBoxingRequired(),phase.isVarargsRequired(),true);
      }
      @Override Symbol access(      Env<AttrContext> env,      DiagnosticPosition pos,      Symbol location,      Symbol sym){
        return accessMethod(sym,pos,env.enclClass.sym.type,name,false,argtypes,null);
      }
    }
);
  }
  finally {
    currentResolutionContext=prevResolutionContext;
  }
}
Program: 72064
Project: 72064
Buggy source:
String computeKey(Element e){
  StringBuilder buf=new StringBuilder();
  while (e != null) {
    buf.append(e.toString());
    e=e.getEnclosingElement();
  }
  buf.append(jfo.getName());
  return buf.toString();
}

Fixed version (ground truth):
String computeKey(Element e){
  StringBuilder buf=new StringBuilder();
  if (predefTranslationMap.containsKey(e.getSimpleName().toString())) {
    buf.append("String_Node_Str");
    String replacedName=predefTranslationMap.get(e.getSimpleName().toString());
    buf.append(e.toString().replace(e.getSimpleName().toString(),replacedName));
  }
 else   if (e.getSimpleName().toString().startsWith("String_Node_Str")) {
    buf.append("String_Node_Str");
    buf.append(e.toString());
  }
 else {
    while (e != null) {
      buf.append(e.toString());
      e=e.getEnclosingElement();
    }
    buf.append(jfo.getName());
  }
  return buf.toString();
}
Program: 72065
Project: 72065
Buggy source:
protected ResolveHarness(JavaFileObject jfo){
  this.jfo=jfo;
  this.diagProcessors=new DiagnosticProcessor[]{new VerboseResolutionNoteProcessor(),new VerboseDeferredInferenceNoteProcessor(),new ErrorProcessor()};
}

Fixed version (ground truth):
protected ResolveHarness(JavaFileObject jfo){
  this.jfo=jfo;
  this.diagProcessors=new DiagnosticProcessor[]{new VerboseResolutionNoteProcessor(),new VerboseDeferredInferenceNoteProcessor(),new ErrorProcessor()};
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
  predefTranslationMap.put("String_Node_Str","String_Node_Str");
}
Program: 72066
Project: 72066
Buggy source:
/** 
 * Convenience method equivalent to   {@code v.scan(e, null)}.
 * @return the result of scanning {@code e}.
 */
public final R scan(Element e){
  return scan(e,null);
}

Fixed version (ground truth):
/** 
 * Convenience method equivalent to   {@code v.scan(e, null)}.
 * @param e the element to scan
 * @return the result of scanning {@code e}.
 */
public final R scan(Element e){
  return scan(e,null);
}
Program: 72067
Project: 72067
Buggy source:
/** 
 * Return a name with the same sequence of characters as the argument.
 * @param cs the character sequence to return as a name
 */
Name getName(CharSequence cs);

Fixed version (ground truth):
/** 
 * Return a name with the same sequence of characters as the argument.
 * @param cs the character sequence to return as a name
 * @return a name with the same sequence of characters as the argument
 */
Name getName(CharSequence cs);
Program: 72068
Project: 72068
Buggy source:
/** 
 * Returns the element corresponding to a type. The type may be a   {@code DeclaredType} or {@code TypeVariable}. Returns   {@code null} if the type is not one with acorresponding element.
 * @return the element corresponding to the given type
 */
Element asElement(TypeMirror t);

Fixed version (ground truth):
/** 
 * Returns the element corresponding to a type. The type may be a   {@code DeclaredType} or {@code TypeVariable}. Returns   {@code null} if the type is not one with acorresponding element.
 * @param t the type to map to an element
 * @return the element corresponding to the given type
 */
Element asElement(TypeMirror t);
Program: 72069
Project: 72069
Buggy source:
private static List<Archive> init(){
  List<Archive> result=new ArrayList<Archive>();
  String javaHome=System.getProperty("String_Node_Str");
  List<File> files=new ArrayList<File>();
  File jre=new File(javaHome,"String_Node_Str");
  File lib=new File(javaHome,"String_Node_Str");
  try {
    if (jre.exists() && jre.isDirectory()) {
      result.addAll(addJarFiles(new File(jre,"String_Node_Str")));
      result.addAll(addJarFiles(lib));
    }
 else     if (lib.exists() && lib.isDirectory()) {
      File classes=new File(javaHome,"String_Node_Str");
      if (classes.exists() && classes.isDirectory()) {
        result.add(new Archive(classes,ClassFileReader.newInstance(classes)));
      }
      result.addAll(addJarFiles(lib));
    }
 else {
      throw new RuntimeException("String_Node_Str" + javaHome + "String_Node_Str");
    }
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  return result;
}

Fixed version (ground truth):
private static List<Archive> init(){
  List<Archive> result=new ArrayList<Archive>();
  String javaHome=System.getProperty("String_Node_Str");
  File jre=new File(javaHome,"String_Node_Str");
  File lib=new File(javaHome,"String_Node_Str");
  try {
    if (jre.exists() && jre.isDirectory()) {
      result.addAll(addJarFiles(new File(jre,"String_Node_Str")));
      result.addAll(addJarFiles(lib));
    }
 else     if (lib.exists() && lib.isDirectory()) {
      File classes=new File(javaHome,"String_Node_Str");
      if (classes.exists() && classes.isDirectory()) {
        result.add(new Archive(classes,ClassFileReader.newInstance(classes)));
      }
      result.addAll(addJarFiles(lib));
    }
 else {
      throw new RuntimeException("String_Node_Str" + javaHome + "String_Node_Str");
    }
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  return result;
}
Program: 72072
Project: 72072
Buggy source:
private void checkConfigPermission(){
  final SecurityManager sm=System.getSecurityManager();
  if (sm != null) {
    sm.checkPermission(new RuntimePermission("String_Node_Str"));
  }
}

Fixed version (ground truth):
private static void checkConfigPermission(){
  final SecurityManager sm=System.getSecurityManager();
  if (sm != null) {
    sm.checkPermission(new RuntimePermission("String_Node_Str"));
  }
}
Program: 72073
Project: 72073
Buggy source:
@Override protected void makeObject(final MethodEmitter m){
  final String className=SCRIPTFUNCTION_IMPL_OBJECT;
  m._new(className).dup();
  loadConstant(new RecompilableScriptFunctionData(functionNode,compiler.getCodeInstaller(),Compiler.binaryName(getClassName()),makeMap()));
  if (isLazy || functionNode.needsParentScope()) {
    m.loadScope();
  }
 else {
    m.loadNull();
  }
  m.invoke(constructorNoLookup(className,cparams));
}

Fixed version (ground truth):
@Override protected void makeObject(final MethodEmitter m){
  final String className=SCRIPTFUNCTION_IMPL_OBJECT;
  m._new(className).dup();
  loadConstant(new RecompilableScriptFunctionData(functionNode,compiler.getCodeInstaller(),Compiler.binaryName(getClassName()),makeMap()));
  if (isLazy || functionNode.needsParentScope()) {
    m.loadScope();
  }
 else {
    m.loadNull();
  }
  m.invoke(constructorNoLookup(className,RecompilableScriptFunctionData.class,ScriptObject.class));
}
Program: 72074
Project: 72074
Buggy source:
private void newFunctionObject(final FunctionNode functionNode){
  final boolean isLazy=functionNode.isLazy();
  final Class<?>[] cparams=new Class<?>[]{RecompilableScriptFunctionData.class,ScriptObject.class};
  new ObjectCreator(this,new ArrayList<String>(),new ArrayList<Symbol>(),false,false){
    @Override protected void makeObject(    final MethodEmitter m){
      final String className=SCRIPTFUNCTION_IMPL_OBJECT;
      m._new(className).dup();
      loadConstant(new RecompilableScriptFunctionData(functionNode,compiler.getCodeInstaller(),Compiler.binaryName(getClassName()),makeMap()));
      if (isLazy || functionNode.needsParentScope()) {
        m.loadScope();
      }
 else {
        m.loadNull();
      }
      m.invoke(constructorNoLookup(className,cparams));
    }
  }
.makeObject(method);
}

Fixed version (ground truth):
private void newFunctionObject(final FunctionNode functionNode){
  final boolean isLazy=functionNode.isLazy();
  new ObjectCreator(this,new ArrayList<String>(),new ArrayList<Symbol>(),false,false){
    @Override protected void makeObject(    final MethodEmitter m){
      final String className=SCRIPTFUNCTION_IMPL_OBJECT;
      m._new(className).dup();
      loadConstant(new RecompilableScriptFunctionData(functionNode,compiler.getCodeInstaller(),Compiler.binaryName(getClassName()),makeMap()));
      if (isLazy || functionNode.needsParentScope()) {
        m.loadScope();
      }
 else {
        m.loadNull();
      }
      m.invoke(constructorNoLookup(className,RecompilableScriptFunctionData.class,ScriptObject.class));
    }
  }
.makeObject(method);
}
Program: 72075
Project: 72075
Buggy source:
/** 
 * Check if this function's generated Java method needs a   {@code callee} parameter. Functions that need access totheir parent scope, functions that reference themselves, and non-strict functions that need an Arguments object (since it exposes  {@code arguments.callee} property) will need to have a callee parameter.We also conservatively need a callee if we have lazy children, i.e. nested function nodes that have not yet been evaluated. _They_ may need the callee and we don't know it
 * @return true if the function's generated Java method needs a {@code callee} parameter.
 */
public boolean needsCallee(){
  return hasLazyChildren() || needsParentScope() || needsSelfSymbol()|| (needsArguments() && !isStrictMode());
}

Fixed version (ground truth):
/** 
 * Check if this function's generated Java method needs a   {@code callee} parameter. Functions that need access totheir parent scope, functions that reference themselves, and non-strict functions that need an Arguments object (since it exposes  {@code arguments.callee} property) will need to have a callee parameter.
 * @return true if the function's generated Java method needs a {@code callee} parameter.
 */
public boolean needsCallee(){
  return needsParentScope() || needsSelfSymbol() || (needsArguments() && !isStrictMode());
}
Program: 72076
Project: 72076
Buggy source:
private void copyOptions(final ScriptObject options,final ScriptEnvironment scriptEnv){
  AccessController.doPrivileged(new PrivilegedAction<Void>(){
    public Void run(){
      for (      Field f : scriptEnv.getClass().getFields()) {
        try {
          options.set(f.getName(),f.get(scriptEnv),false);
        }
 catch (        final IllegalArgumentException|IllegalAccessException exp) {
          throw new RuntimeException(exp);
        }
      }
      return null;
    }
  }
);
}

Fixed version (ground truth):
private static void copyOptions(final ScriptObject options,final ScriptEnvironment scriptEnv){
  AccessController.doPrivileged(new PrivilegedAction<Void>(){
    @Override public Void run(){
      for (      Field f : scriptEnv.getClass().getFields()) {
        try {
          options.set(f.getName(),f.get(scriptEnv),false);
        }
 catch (        final IllegalArgumentException|IllegalAccessException exp) {
          throw new RuntimeException(exp);
        }
      }
      return null;
    }
  }
);
}
Program: 72077
Project: 72077
Buggy source:
public Void run(){
  for (  Field f : scriptEnv.getClass().getFields()) {
    try {
      options.set(f.getName(),f.get(scriptEnv),false);
    }
 catch (    final IllegalArgumentException|IllegalAccessException exp) {
      throw new RuntimeException(exp);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public Void run(){
  for (  Field f : scriptEnv.getClass().getFields()) {
    try {
      options.set(f.getName(),f.get(scriptEnv),false);
    }
 catch (    final IllegalArgumentException|IllegalAccessException exp) {
      throw new RuntimeException(exp);
    }
  }
  return null;
}
Program: 72078
Project: 72078
Buggy source:
private synchronized Class<?> compile(final Source source,final ErrorManager errMan,final boolean strict){
  errMan.reset();
  GlobalObject global=null;
  Class<?> script;
  if (env._class_cache_size > 0) {
    global=(GlobalObject)Context.getGlobalTrusted();
    script=global.findCachedClass(source);
    if (script != null) {
      return script;
    }
  }
  final FunctionNode functionNode=new Parser(env,source,errMan,strict).parse();
  if (errors.hasErrors() || env._parse_only) {
    return null;
  }
  if (env._print_ast) {
    getErr().println(new ASTWriter(functionNode));
  }
  if (env._print_parse) {
    getErr().println(new PrintVisitor(functionNode));
  }
  final URL url=source.getURL();
  final ScriptLoader loader=env._loader_per_compile ? createNewLoader() : scriptLoader;
  final CodeSource cs=url == null ? null : new CodeSource(url,(CodeSigner[])null);
  final CodeInstaller<ScriptEnvironment> installer=new ContextCodeInstaller(this,loader,cs);
  final Compiler compiler=new Compiler(installer,functionNode,strict);
  compiler.compile();
  script=compiler.install();
  if (global != null) {
    global.cacheClass(source,script);
  }
  return script;
}

Fixed version (ground truth):
private synchronized Class<?> compile(final Source source,final ErrorManager errMan,final boolean strict){
  errMan.reset();
  GlobalObject global=null;
  Class<?> script;
  if (env._class_cache_size > 0) {
    global=(GlobalObject)Context.getGlobalTrusted();
    script=global.findCachedClass(source);
    if (script != null) {
      Compiler.LOG.fine("String_Node_Str" + source + "String_Node_Str");
      return script;
    }
  }
  final FunctionNode functionNode=new Parser(env,source,errMan,strict).parse();
  if (errors.hasErrors() || env._parse_only) {
    return null;
  }
  if (env._print_ast) {
    getErr().println(new ASTWriter(functionNode));
  }
  if (env._print_parse) {
    getErr().println(new PrintVisitor(functionNode));
  }
  final URL url=source.getURL();
  final ScriptLoader loader=env._loader_per_compile ? createNewLoader() : scriptLoader;
  final CodeSource cs=url == null ? null : new CodeSource(url,(CodeSigner[])null);
  final CodeInstaller<ScriptEnvironment> installer=new ContextCodeInstaller(this,loader,cs);
  final Compiler compiler=new Compiler(installer,functionNode,strict);
  compiler.compile();
  script=compiler.install();
  if (global != null) {
    global.cacheClass(source,script);
  }
  return script;
}
Program: 72079
Project: 72079
Buggy source:
/** 
 * Install a class for use by the Nashorn runtime
 * @param name Binary name of class.
 * @param data Class data bytes.
 * @param cs CodeSource code source of the class bytes.
 * @return Installed class.
 */
synchronized Class<?> installClass(final String name,final byte[] data,final CodeSource cs){
  if (cs == null) {
    return defineClass(name,data,0,data.length,new ProtectionDomain(null,getPermissions(null)));
  }
 else {
    return defineClass(name,data,0,data.length,cs);
  }
}

Fixed version (ground truth):
/** 
 * Install a class for use by the Nashorn runtime
 * @param name Binary name of class.
 * @param data Class data bytes.
 * @param cs CodeSource code source of the class bytes.
 * @return Installed class.
 */
synchronized Class<?> installClass(final String name,final byte[] data,final CodeSource cs){
  if (cs == null) {
    return defineClass(name,data,0,data.length,new ProtectionDomain(null,getPermissions(null)));
  }
  return defineClass(name,data,0,data.length,cs);
}
Program: 72080
Project: 72080
Buggy source:
/** 
 * Returns a method handle representing a constructor that takes a single argument of the source type (which, really, should be one of   {@link ScriptObject},   {@link ScriptFunction}, or   {@link Object}, and returns an instance of the adapter for the target type. Used to implement the function autoconverters as well as the Nashorn's JSR-223 script engine's   {@code getInterface()} method.
 * @param sourceType the source type; should be either {@link ScriptObject},   {@link ScriptFunction}, or  {@link Object}. In case of   {@code Object}, it will return a method handle that dispatches to either the script object or function constructor at invocation based on the actual argument.
 * @param targetType the target type, for which adapter instances will be created
 * @return the constructor method handle.
 * @throws Exception if anything goes wrong
 */
public static MethodHandle getConstructor(final Class<?> sourceType,final Class<?> targetType) throws Exception {
  final StaticClass adapterClass=getAdapterClassFor(new Class<?>[]{targetType});
  return AccessController.doPrivileged(new PrivilegedExceptionAction<MethodHandle>(){
    public MethodHandle run() throws Exception {
      return MH.bindTo(Bootstrap.getLinkerServices().getGuardedInvocation(new LinkRequestImpl(NashornCallSiteDescriptor.get("String_Node_Str",MethodType.methodType(targetType,StaticClass.class,sourceType),0),false,adapterClass,null)).getInvocation(),adapterClass);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Returns a method handle representing a constructor that takes a single argument of the source type (which, really, should be one of   {@link ScriptObject},   {@link ScriptFunction}, or   {@link Object}, and returns an instance of the adapter for the target type. Used to implement the function autoconverters as well as the Nashorn's JSR-223 script engine's   {@code getInterface()} method.
 * @param sourceType the source type; should be either {@link ScriptObject},   {@link ScriptFunction}, or  {@link Object}. In case of   {@code Object}, it will return a method handle that dispatches to either the script object or function constructor at invocation based on the actual argument.
 * @param targetType the target type, for which adapter instances will be created
 * @return the constructor method handle.
 * @throws Exception if anything goes wrong
 */
public static MethodHandle getConstructor(final Class<?> sourceType,final Class<?> targetType) throws Exception {
  final StaticClass adapterClass=getAdapterClassFor(new Class<?>[]{targetType});
  return AccessController.doPrivileged(new PrivilegedExceptionAction<MethodHandle>(){
    @Override public MethodHandle run() throws Exception {
      return MH.bindTo(Bootstrap.getLinkerServices().getGuardedInvocation(new LinkRequestImpl(NashornCallSiteDescriptor.get("String_Node_Str",MethodType.methodType(targetType,StaticClass.class,sourceType),0),false,adapterClass,null)).getInvocation(),adapterClass);
    }
  }
);
}
Program: 72081
Project: 72081
Buggy source:
@Override public RegExpMatcher match(final String str){
  if (pattern == null) {
    return null;
  }
  RegExpMatcher matcher=this.matcher;
  if (matcher == null || matcher.getInput() != str) {
    matcher=new DefaultMatcher(str);
    this.matcher=matcher;
  }
  return matcher;
}

Fixed version (ground truth):
@Override public RegExpMatcher match(final String str){
  if (pattern == null) {
    return null;
  }
  RegExpMatcher currentMatcher=this.matcher;
  if (currentMatcher == null || matcher.getInput() != str) {
    currentMatcher=new DefaultMatcher(str);
    this.matcher=currentMatcher;
  }
  return currentMatcher;
}
Program: 72082
Project: 72082
Buggy source:
@Override public RegExpMatcher match(final String input){
  if (regex == null) {
    return null;
  }
  RegExpMatcher matcher=this.matcher;
  if (matcher == null || input != matcher.getInput()) {
    matcher=new JoniMatcher(input);
    this.matcher=matcher;
  }
  return matcher;
}

Fixed version (ground truth):
@Override public RegExpMatcher match(final String input){
  if (regex == null) {
    return null;
  }
  RegExpMatcher currentMatcher=this.matcher;
  if (currentMatcher == null || input != currentMatcher.getInput()) {
    currentMatcher=new JoniMatcher(input);
    this.matcher=currentMatcher;
  }
  return currentMatcher;
}
Program: 72083
Project: 72083
Buggy source:
/** 
 * Throw a regexp parser exception.
 * @param key the message key
 * @param str string argument
 * @throws jdk.nashorn.internal.runtime.ParserException
 */
protected static void throwParserException(final String key,final String str) throws ParserException {
  throw new ParserException(ECMAErrors.getMessage("String_Node_Str" + key,str));
}

Fixed version (ground truth):
/** 
 * Throw a regexp parser exception.
 * @param key the message key
 * @param str string argument
 * @throws jdk.nashorn.internal.runtime.ParserException unconditionally
 */
protected static void throwParserException(final String key,final String str) throws ParserException {
  throw new ParserException(ECMAErrors.getMessage("String_Node_Str" + key,str));
}
Program: 72084
Project: 72084
Buggy source:
/** 
 * Creates a Regular expression from the given   {@code pattern} and {@code flags} strings.
 * @param pattern RegExp pattern string
 * @param flags RegExp flags string
 * @throws ParserException if flags is invalid or pattern string has syntax error.
 */
protected RegExp compile(final String pattern,final String flags) throws ParserException {
  return new DefaultRegExp(pattern,flags);
}

Fixed version (ground truth):
/** 
 * Creates a Regular expression from the given   {@code pattern} and {@code flags} strings.
 * @param pattern RegExp pattern string
 * @param flags   RegExp flags string
 * @return new RegExp
 * @throws ParserException if flags is invalid or pattern string has syntax error.
 */
protected RegExp compile(final String pattern,final String flags) throws ParserException {
  return new DefaultRegExp(pattern,flags);
}
Program: 72085
Project: 72085
Buggy source:
/** 
 * Compile a regexp with the given   {@code source} and {@code flags}.
 * @param pattern RegExp pattern string
 * @param flags  flag string
 * @throws ParserException if invalid source or flags
 */
public static RegExp create(final String pattern,final String flags){
  return instance.compile(pattern,flags);
}

Fixed version (ground truth):
/** 
 * Compile a regexp with the given   {@code source} and {@code flags}.
 * @param pattern RegExp pattern string
 * @param flags   flag string
 * @return new RegExp
 * @throws ParserException if invalid source or flags
 */
public static RegExp create(final String pattern,final String flags){
  return instance.compile(pattern,flags);
}
Program: 72086
Project: 72086
Buggy source:
/** 
 * Get the group with the given index or the empty string if group index is not valid.
 * @param index the group index
 * @return the group or ""
 */
public Object getGroup(int index){
  return index >= 0 && index < groups.length ? groups[index] : "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Get the group with the given index or the empty string if group index is not valid.
 * @param groupIndex the group index
 * @return the group or ""
 */
public Object getGroup(final int groupIndex){
  return groupIndex >= 0 && groupIndex < groups.length ? groups[groupIndex] : "String_Node_Str";
}
Program: 72087
Project: 72087
Buggy source:
public static boolean isDynamicMethod(final Object obj){
  return obj instanceof DynamicMethod;
}

Fixed version (ground truth):
/** 
 * Returns true if the object is a Dynalink Java dynamic method.
 * @param obj the object we want to test for being a dynamic method
 * @return true if it is a dynamic method, false otherwise.
 */
public static boolean isDynamicMethod(final Object obj){
  return obj instanceof DynamicMethod;
}
Program: 72090
Project: 72090
Buggy source:
@Override public Symbol access(Name name,TypeSymbol location){
  return types.createErrorType(name,location,syms.errSymbol.type).tsym;
}

Fixed version (ground truth):
@Override protected Symbol access(Name name,TypeSymbol location){
  return ambiguousSyms.last();
}
Program: 72092
Project: 72092
Buggy source:
AmbiguityError(Symbol sym1,Symbol sym2){
  super(AMBIGUOUS,sym1,"String_Node_Str");
  this.sym2=sym2;
}

Fixed version (ground truth):
AmbiguityError(Symbol sym1,Symbol sym2){
  super(AMBIGUOUS,"String_Node_Str");
  ambiguousSyms=flatten(sym2).appendList(flatten(sym1));
}
Program: 72093
Project: 72093
Buggy source:
@Override JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,DiagnosticPosition pos,Symbol location,Type site,Name name,List<Type> argtypes,List<Type> typeargtypes){
  AmbiguityError pair=this;
  while (true) {
    if (pair.sym.kind == AMBIGUOUS)     pair=(AmbiguityError)pair.sym;
 else     if (pair.sym2.kind == AMBIGUOUS)     pair=(AmbiguityError)pair.sym2;
 else     break;
  }
  Name sname=pair.sym.name;
  if (sname == names.init)   sname=pair.sym.owner.name;
  return diags.create(dkind,log.currentSource(),pos,"String_Node_Str",sname,kindName(pair.sym),pair.sym,pair.sym.location(site,types),kindName(pair.sym2),pair.sym2,pair.sym2.location(site,types));
}

Fixed version (ground truth):
@Override JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,DiagnosticPosition pos,Symbol location,Type site,Name name,List<Type> argtypes,List<Type> typeargtypes){
  List<Symbol> diagSyms=ambiguousSyms.reverse();
  Symbol s1=diagSyms.head;
  Symbol s2=diagSyms.tail.head;
  Name sname=s1.name;
  if (sname == names.init)   sname=s1.owner.name;
  return diags.create(dkind,log.currentSource(),pos,"String_Node_Str",sname,kindName(s1),s1,s1.location(site,types),kindName(s2),s2,s2.location(site,types));
}
Program: 72094
Project: 72094
Buggy source:
@Override public boolean exists(){
  return false;
}

Fixed version (ground truth):
@Override public boolean exists(){
  return true;
}
Program: 72095
Project: 72095
Buggy source:
/** 
 * Construct the SplitIndexWriter. Uses path to this file and relative path from this file.
 * @param path       Path to the file which is getting generated.
 * @param filename   Name of the file which is getting genrated.
 * @param relpath    Relative path from this file to the current directory.
 * @param indexbuilder Unicode based Index from {@link IndexBuilder}
 */
public SplitIndexWriter(ConfigurationImpl configuration,DocPath path,IndexBuilder indexbuilder,int prev,int next) throws IOException {
  super(configuration,path,indexbuilder);
  this.prev=prev;
  this.next=next;
}

Fixed version (ground truth):
/** 
 * Construct the SplitIndexWriter. Uses path to this file and relative path from this file.
 * @param path       Path to the file which is getting generated.
 * @param indexbuilder Unicode based Index from {@link IndexBuilder}
 */
public SplitIndexWriter(ConfigurationImpl configuration,DocPath path,IndexBuilder indexbuilder,int prev,int next) throws IOException {
  super(configuration,path,indexbuilder);
  this.prev=prev;
  this.next=next;
}
Program: 72097
Project: 72097
Buggy source:
/** 
 * @inheritDoc 
 */
@Override public int hashCode(){
  return path.hashCode();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public int hashCode(){
  return path.hashCode();
}
Program: 72098
Project: 72098
Buggy source:
/** 
 * @inheritDoc 
 */
@Override public boolean equals(Object other){
  return (other instanceof DocPath) && path.equals(((DocPath)other).path);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public boolean equals(Object other){
  return (other instanceof DocPath) && path.equals(((DocPath)other).path);
}
Program: 72099
Project: 72099
Buggy source:
/** 
 * Find the specified directory in the source path.
 * @param name Name of the directory to be searched for in the source path.
 * @return File Return the directory if found else return null.
 */
public File getDirectory(DocPath p){
  for (int i=0; i < sourcePath.length; i++) {
    File directoryNeeded=new File(sourcePath[i],p.getPath());
    if (directoryNeeded.isDirectory()) {
      return directoryNeeded;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Find the specified directory in the source path.
 * @param p Name of the directory to be searched for in the source path.
 * @return File Return the directory if found else return null.
 */
public File getDirectory(DocPath p){
  for (int i=0; i < sourcePath.length; i++) {
    File directoryNeeded=new File(sourcePath[i],p.getPath());
    if (directoryNeeded.isDirectory()) {
      return directoryNeeded;
    }
  }
  return null;
}
Program: 72100
Project: 72100
Buggy source:
/** 
 * Create the directory path for the file to be generated, construct FileOutputStream and OutputStreamWriter depending upon docencoding.
 * @param path The directory path to be created for this file.
 * @param filename File Name to which the PrintWriter will do the Output.
 * @param docencoding Encoding to be used for this file.
 * @exception IOException Exception raised by the FileWriter is passed onto next level.
 * @exception UnsupportedEncodingException Exception raised by theOutputStreamWriter is passed on to next level.
 * @return Writer Writer for the file getting generated.
 * @see java.io.FileOutputStream
 * @see java.io.OutputStreamWriter
 */
public static Writer genWriter(Configuration configuration,DocPath path) throws IOException, UnsupportedEncodingException {
  File file=path.resolveAgainst(configuration.destDirName);
  createDirectory(configuration,file.getParentFile());
  FileOutputStream fos=new FileOutputStream(file);
  if (configuration.docencoding == null) {
    return new BufferedWriter(new OutputStreamWriter(fos));
  }
 else {
    return new BufferedWriter(new OutputStreamWriter(fos,configuration.docencoding));
  }
}

Fixed version (ground truth):
/** 
 * Create the directory path for the file to be generated, construct FileOutputStream and OutputStreamWriter depending upon docencoding.
 * @param path The directory path to be created for this file.
 * @exception IOException Exception raised by the FileWriter is passed onto next level.
 * @exception UnsupportedEncodingException Exception raised by theOutputStreamWriter is passed on to next level.
 * @return Writer Writer for the file getting generated.
 * @see java.io.FileOutputStream
 * @see java.io.OutputStreamWriter
 */
public static Writer genWriter(Configuration configuration,DocPath path) throws IOException, UnsupportedEncodingException {
  File file=path.resolveAgainst(configuration.destDirName);
  createDirectory(configuration,file.getParentFile());
  FileOutputStream fos=new FileOutputStream(file);
  if (configuration.docencoding == null) {
    return new BufferedWriter(new OutputStreamWriter(fos));
  }
 else {
    return new BufferedWriter(new OutputStreamWriter(fos,configuration.docencoding));
  }
}
Program: 72101
Project: 72101
Buggy source:
/** 
 * Given a path string create all the directories in the path. For example, if the path string is "java/applet", the method will create directory "java" and then "java/applet" if they don't exist. The file separator string "/" is platform dependent system property.
 * @param path Directory path string.
 */
public static void createDirectory(Configuration configuration,File dir){
  if (dir == null) {
    return;
  }
  if (dir.exists()) {
    return;
  }
 else {
    if (dir.mkdirs()) {
      return;
    }
 else {
      configuration.message.error("String_Node_Str",dir.getPath());
      throw new DocletAbortException();
    }
  }
}

Fixed version (ground truth):
/** 
 * Given a path string create all the directories in the path. For example, if the path string is "java/applet", the method will create directory "java" and then "java/applet" if they don't exist. The file separator string "/" is platform dependent system property.
 * @param dir Directory path string.
 */
public static void createDirectory(Configuration configuration,File dir){
  if (dir == null) {
    return;
  }
  if (dir.exists()) {
    return;
  }
 else {
    if (dir.mkdirs()) {
      return;
    }
 else {
      configuration.message.error("String_Node_Str",dir.getPath());
      throw new DocletAbortException();
    }
  }
}
Program: 72102
Project: 72102
Buggy source:
/** 
 * Return the kind of this tag. similar or synonymous tags.  For most tags, <code>kind()&nbsp;==&nbsp;name()</code>; the following table lists those cases where there is more than one tag of a given kind: <p> <table border="1" cellpadding="4" cellspacing="0"> <tr><th><tt> kind()  </th>  <th><tt> name()      </th></tr> <tr><td><tt> @throws </td>  <td><tt> @throws     </td></tr> <tr><td><tt> @throws </td>  <td><tt> @exception  </td></tr> <tr><td><tt> @see    </td>  <td><tt> @see        </td></tr> <tr><td><tt> @see    </td>  <td><tt> @link       </td></tr> <tr><td><tt> @see    </td>  <td><tt> @linkplain  </td></tr> <tr><td><tt> @serial </td>  <td><tt> @serial     </td></tr> <tr><td><tt> @serial </td>  <td><tt> @serialData </td></tr> </table>
 */
String kind();

Fixed version (ground truth):
/** 
 * Return the kind of this tag. similar or synonymous tags.  For most tags, <code>kind()&nbsp;==&nbsp;name()</code>; the following table lists those cases where there is more than one tag of a given kind: <p> <table border="1" cellpadding="4" cellspacing="0"> <tr><th><tt> kind()  </tt></th>  <th><tt> name()      </tt></th></tr> <tr><td><tt> @throws </tt></td>  <td><tt> @throws     </tt></td></tr> <tr><td><tt> @throws </tt></td>  <td><tt> @exception  </tt></td></tr> <tr><td><tt> @see    </tt></td>  <td><tt> @see        </tt></td></tr> <tr><td><tt> @see    </tt></td>  <td><tt> @link       </tt></td></tr> <tr><td><tt> @see    </tt></td>  <td><tt> @linkplain  </tt></td></tr> <tr><td><tt> @serial </tt></td>  <td><tt> @serial     </tt></td></tr> <tr><td><tt> @serial </tt></td>  <td><tt> @serialData </tt></td></tr> </table>
 */
String kind();
Program: 72103
Project: 72103
Buggy source:
/** 
 * Get the ClassFile object for a specified class.
 * @param className the name of the class to be returned.
 * @return the ClassFile for the given class
 * @throws Dependencies #ClassFileNotFoundException if the classfile cannot be found
 */
public ClassFile getClassFile(String className) throws ClassFileNotFoundException ;

Fixed version (ground truth):
/** 
 * Get the ClassFile object for a specified class.
 * @param className the name of the class to be returned.
 * @return the ClassFile for the given class
 * @throws Dependencies.ClassFileNotFoundException if the classfile cannot befound
 */
public ClassFile getClassFile(String className) throws ClassFileNotFoundException ;
Program: 72104
Project: 72104
Buggy source:
/** 
 * See   {@link Kind#LOCAL_UBYTE}. 
 */
R visitLocalAndValue(Instruction instr,int index,int value,P p);

Fixed version (ground truth):
/** 
 * See   {@link Kind#LOCAL_BYTE}. 
 */
R visitLocalAndValue(Instruction instr,int index,int value,P p);
Program: 72106
Project: 72106
Buggy source:
/** 
 * Add the inherited summary link for the member.
 * @param classDoc the classDoc that we should link to
 * @param member the member being linked to
 * @param linksTree the content tree to which the link will be added
 */
protected void addInheritedSummaryLink(ClassDoc cd,ProgramElementDoc member,Content linksTree){
  linksTree.addContent(new RawHtml(writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER,cd,(MemberDoc)member,member.name(),false)));
}

Fixed version (ground truth):
/** 
 * Add the inherited summary link for the member.
 * @param cd the classDoc that we should link to
 * @param member the member being linked to
 * @param linksTree the content tree to which the link will be added
 */
protected void addInheritedSummaryLink(ClassDoc cd,ProgramElementDoc member,Content linksTree){
  linksTree.addContent(new RawHtml(writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER,cd,(MemberDoc)member,member.name(),false)));
}
Program: 72107
Project: 72107
Buggy source:
/** 
 * Add the summary link for the member.
 * @param context the id of the context where the link will be printed
 * @param classDoc the classDoc that we should link to
 * @param member the member being linked to
 * @param tdSummary the content tree to which the link will be added
 */
protected void addSummaryLink(int context,ClassDoc cd,ProgramElementDoc member,Content tdSummary){
  ExecutableMemberDoc emd=(ExecutableMemberDoc)member;
  String name=emd.name();
  Content strong=HtmlTree.STRONG(new RawHtml(writer.getDocLink(context,cd,(MemberDoc)emd,name,false)));
  Content code=HtmlTree.CODE(strong);
  writer.displayLength=name.length();
  addParameters(emd,false,code);
  tdSummary.addContent(code);
}

Fixed version (ground truth):
/** 
 * Add the summary link for the member.
 * @param context the id of the context where the link will be printed
 * @param cd the classDoc that we should link to
 * @param member the member being linked to
 * @param tdSummary the content tree to which the link will be added
 */
protected void addSummaryLink(int context,ClassDoc cd,ProgramElementDoc member,Content tdSummary){
  ExecutableMemberDoc emd=(ExecutableMemberDoc)member;
  String name=emd.name();
  Content strong=HtmlTree.STRONG(new RawHtml(writer.getDocLink(context,cd,(MemberDoc)emd,name,false)));
  Content code=HtmlTree.CODE(strong);
  writer.displayLength=name.length();
  addParameters(emd,false,code);
  tdSummary.addContent(code);
}
Program: 72108
Project: 72108
Buggy source:
/** 
 * Add the comment for the given member.
 * @param member the member being documented.
 * @param contentTree the content tree to which the comment will be added.
 */
protected void addComment(ProgramElementDoc member,Content htmltree){
  if (member.inlineTags().length > 0) {
    writer.addInlineComment(member,htmltree);
  }
}

Fixed version (ground truth):
/** 
 * Add the comment for the given member.
 * @param member the member being documented.
 * @param htmltree the content tree to which the comment will be added.
 */
protected void addComment(ProgramElementDoc member,Content htmltree){
  if (member.inlineTags().length > 0) {
    writer.addInlineComment(member,htmltree);
  }
}
Program: 72109
Project: 72109
Buggy source:
/** 
 * Constructor. Initialises resource for the  {@link com.sun.tools.doclets.MessageRetriever}.
 */
private ConfigurationImpl(){
  standardmessage=new MessageRetriever(this,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Constructor. Initializes resource for the  {@link com.sun.tools.doclets.internal.toolkit.util.MessageRetriever MessageRetriever}.
 */
private ConfigurationImpl(){
  standardmessage=new MessageRetriever(this,"String_Node_Str");
}
Program: 72110
Project: 72110
Buggy source:
/** 
 * Add the anchor.
 * @param builder the deprecated list builder
 * @param type the type of list being documented
 * @param contentTree the content tree to which the anchor will be added
 */
private void addAnchor(DeprecatedAPIListBuilder builder,int type,Content htmlTree){
  if (builder.hasDocumentation(type)) {
    htmlTree.addContent(getMarkerAnchor(ANCHORS[type]));
  }
}

Fixed version (ground truth):
/** 
 * Add the anchor.
 * @param builder the deprecated list builder
 * @param type the type of list being documented
 * @param htmlTree the content tree to which the anchor will be added
 */
private void addAnchor(DeprecatedAPIListBuilder builder,int type,Content htmlTree){
  if (builder.hasDocumentation(type)) {
    htmlTree.addContent(getMarkerAnchor(ANCHORS[type]));
  }
}
Program: 72111
Project: 72111
Buggy source:
/** 
 * Returns a package name label.
 * @param parsedName the package name
 * @return the package name content
 */
public Content getPackageLabel(String packageName){
  return new StringContent(packageName);
}

Fixed version (ground truth):
/** 
 * Returns a package name label.
 * @param packageName the package name
 * @return the package name content
 */
public Content getPackageLabel(String packageName){
  return new StringContent(packageName);
}
Program: 72112
Project: 72112
Buggy source:
/** 
 * Add the member header.
 * @param fieldsType the class document to be listed
 * @param fieldTypeStr the string for the filed type to be documented
 * @param fieldDimensions the dimensions of the field string to be added
 * @param firldName name of the field to be added
 * @param contentTree the content tree to which the member header will be added
 */
public void addMemberHeader(ClassDoc fieldType,String fieldTypeStr,String fieldDimensions,String fieldName,Content contentTree){
  Content nameContent=new RawHtml(fieldName);
  Content heading=HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING,nameContent);
  contentTree.addContent(heading);
  Content pre=new HtmlTree(HtmlTag.PRE);
  if (fieldType == null) {
    pre.addContent(fieldTypeStr);
  }
 else {
    Content fieldContent=new RawHtml(writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_SERIAL_MEMBER,fieldType)));
    pre.addContent(fieldContent);
  }
  pre.addContent(fieldDimensions + "String_Node_Str");
  pre.addContent(fieldName);
  contentTree.addContent(pre);
}

Fixed version (ground truth):
/** 
 * Add the member header.
 * @param fieldType the class document to be listed
 * @param fieldTypeStr the string for the field type to be documented
 * @param fieldDimensions the dimensions of the field string to be added
 * @param fieldName name of the field to be added
 * @param contentTree the content tree to which the member header will be added
 */
public void addMemberHeader(ClassDoc fieldType,String fieldTypeStr,String fieldDimensions,String fieldName,Content contentTree){
  Content nameContent=new RawHtml(fieldName);
  Content heading=HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING,nameContent);
  contentTree.addContent(heading);
  Content pre=new HtmlTree(HtmlTag.PRE);
  if (fieldType == null) {
    pre.addContent(fieldTypeStr);
  }
 else {
    Content fieldContent=new RawHtml(writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_SERIAL_MEMBER,fieldType)));
    pre.addContent(fieldContent);
  }
  pre.addContent(fieldDimensions + "String_Node_Str");
  pre.addContent(fieldName);
  contentTree.addContent(pre);
}