nus-yam/ex-repair huggingface dataset:
Program: 78942
Project: 78942
Buggy source:
/** 
 * Throws a <code>SecurityException</code> if the calling thread is not allowed to access the system property with the specified <code>key</code> name. <p> This method is used by the <code>getProperty</code> method of class <code>System</code>. <p> This method calls <code>checkPermission</code> with the <code>PropertyPermission(key, "read")</code> permission. <p> <p> If you override this method, then you should make a call to <code>super.checkPropertyAccess</code> at the point the overridden method would normally throw an exception.
 * @param key   a system property key.
 * @exception SecurityException  if the calling thread does not havepermission to access the specified system property.
 * @exception NullPointerException if the <code>key</code> argument is<code>null</code>.
 * @exception IllegalArgumentException if <code>key</code> is empty.
 * @see java.lang.System#getProperty(java.lang.String)
 * @see #checkPermission(java.security.Permission) checkPermission
 */
public void checkPropertyAccess(String key){
  checkPermission(new PropertyPermission(key,SecurityConstants.PROPERTY_READ_ACTION));
}

Fixed version (ground truth):
/** 
 * Throws a <code>SecurityException</code> if the calling thread is not allowed to access the system property with the specified <code>key</code> name. <p> This method is used by the <code>getProperty</code> method of class <code>System</code>. <p> This method calls <code>checkPermission</code> with the <code>PropertyPermission(key, "read")</code> permission. <p> If you override this method, then you should make a call to <code>super.checkPropertyAccess</code> at the point the overridden method would normally throw an exception.
 * @param key   a system property key.
 * @exception SecurityException  if the calling thread does not havepermission to access the specified system property.
 * @exception NullPointerException if the <code>key</code> argument is<code>null</code>.
 * @exception IllegalArgumentException if <code>key</code> is empty.
 * @see java.lang.System#getProperty(java.lang.String)
 * @see #checkPermission(java.security.Permission) checkPermission
 */
public void checkPropertyAccess(String key){
  checkPermission(new PropertyPermission(key,SecurityConstants.PROPERTY_READ_ACTION));
}
Program: 78943
Project: 78943
Buggy source:
/** 
 * Returns the class loader of the most recently executing method from a class defined using a non-system class loader. A non-system class loader is defined as being a class loader that is not equal to the system class loader (as returned by   {@link ClassLoader#getSystemClassLoader}) or one of its ancestors. <p> This method will return <code>null</code> in the following three cases:<p> <ol> <li>All methods on the execution stack are from classes defined using the system class loader or one of its ancestors. <li>All methods on the execution stack up to the first "privileged" caller (see   {@link java.security.AccessController#doPrivileged}) are from classes defined using the system class loader or one of its ancestors. <li> A call to <code>checkPermission</code> with <code>java.security.AllPermission</code> does not result in a SecurityException. </ol>
 * @return  the class loader of the most recent occurrence on the stackof a method from a class defined using a non-system class loader.
 * @deprecated This type of security checking is not recommended.It is recommended that the <code>checkPermission</code> call be used instead.
 * @see java.lang.ClassLoader#getSystemClassLoader() getSystemClassLoader
 * @see #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated protected ClassLoader currentClassLoader(){
  ClassLoader cl=currentClassLoader0();
  if ((cl != null) && hasAllPermission())   cl=null;
  return cl;
}

Fixed version (ground truth):
/** 
 * Returns the class loader of the most recently executing method from a class defined using a non-system class loader. A non-system class loader is defined as being a class loader that is not equal to the system class loader (as returned by   {@link ClassLoader#getSystemClassLoader}) or one of its ancestors. <p> This method will return <code>null</code> in the following three cases: <ol> <li>All methods on the execution stack are from classes defined using the system class loader or one of its ancestors. <li>All methods on the execution stack up to the first "privileged" caller (see   {@link java.security.AccessController#doPrivileged}) are from classes defined using the system class loader or one of its ancestors. <li> A call to <code>checkPermission</code> with <code>java.security.AllPermission</code> does not result in a SecurityException. </ol>
 * @return  the class loader of the most recent occurrence on the stackof a method from a class defined using a non-system class loader.
 * @deprecated This type of security checking is not recommended.It is recommended that the <code>checkPermission</code> call be used instead.
 * @see java.lang.ClassLoader#getSystemClassLoader() getSystemClassLoader
 * @see #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated protected ClassLoader currentClassLoader(){
  ClassLoader cl=currentClassLoader0();
  if ((cl != null) && hasAllPermission())   cl=null;
  return cl;
}
Program: 78944
Project: 78944
Buggy source:
/** 
 * Returns the class of the most recently executing method from a class defined using a non-system class loader. A non-system class loader is defined as being a class loader that is not equal to the system class loader (as returned by   {@link ClassLoader#getSystemClassLoader}) or one of its ancestors. <p> This method will return <code>null</code> in the following three cases:<p> <ol> <li>All methods on the execution stack are from classes defined using the system class loader or one of its ancestors. <li>All methods on the execution stack up to the first "privileged" caller (see   {@link java.security.AccessController#doPrivileged}) are from classes defined using the system class loader or one of its ancestors. <li> A call to <code>checkPermission</code> with <code>java.security.AllPermission</code> does not result in a SecurityException. </ol>
 * @return  the class  of the most recent occurrence on the stackof a method from a class defined using a non-system class loader.
 * @deprecated This type of security checking is not recommended.It is recommended that the <code>checkPermission</code> call be used instead.
 * @see java.lang.ClassLoader#getSystemClassLoader() getSystemClassLoader
 * @see #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated protected Class<?> currentLoadedClass(){
  Class<?> c=currentLoadedClass0();
  if ((c != null) && hasAllPermission())   c=null;
  return c;
}

Fixed version (ground truth):
/** 
 * Returns the class of the most recently executing method from a class defined using a non-system class loader. A non-system class loader is defined as being a class loader that is not equal to the system class loader (as returned by   {@link ClassLoader#getSystemClassLoader}) or one of its ancestors. <p> This method will return <code>null</code> in the following three cases: <ol> <li>All methods on the execution stack are from classes defined using the system class loader or one of its ancestors. <li>All methods on the execution stack up to the first "privileged" caller (see   {@link java.security.AccessController#doPrivileged}) are from classes defined using the system class loader or one of its ancestors. <li> A call to <code>checkPermission</code> with <code>java.security.AllPermission</code> does not result in a SecurityException. </ol>
 * @return  the class  of the most recent occurrence on the stackof a method from a class defined using a non-system class loader.
 * @deprecated This type of security checking is not recommended.It is recommended that the <code>checkPermission</code> call be used instead.
 * @see java.lang.ClassLoader#getSystemClassLoader() getSystemClassLoader
 * @see #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated protected Class<?> currentLoadedClass(){
  Class<?> c=currentLoadedClass0();
  if ((c != null) && hasAllPermission())   c=null;
  return c;
}
Program: 78945
Project: 78945
Buggy source:
/** 
 * Call a JavaScript function member of this object.
 * @param name name of the member function to call
 * @param args arguments to be passed to the member function
 * @return result of call
 */
public Object callMember(String name,Object... args){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Call a JavaScript function member of this object.
 * @param name name of the member function to call
 * @param args arguments to be passed to the member function
 * @return result of call
 */
public Object callMember(final String name,final Object... args){
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 78946
Project: 78946
Buggy source:
/** 
 * Does this object have a named member?
 * @param name name of member
 * @return true if this object has a member of the given name
 */
public boolean hasMember(String name){
  return false;
}

Fixed version (ground truth):
/** 
 * Does this object have a named member?
 * @param name name of member
 * @return true if this object has a member of the given name
 */
public boolean hasMember(final String name){
  return false;
}
Program: 78947
Project: 78947
Buggy source:
/** 
 * Retrieves a named member of this JavaScript object.
 * @param name of member
 * @return member
 */
public Object getMember(String name){
  return null;
}

Fixed version (ground truth):
/** 
 * Retrieves a named member of this JavaScript object.
 * @param name of member
 * @return member
 */
public Object getMember(final String name){
  return null;
}
Program: 78948
Project: 78948
Buggy source:
/** 
 * Call this object as a JavaScript function. This is equivalent to 'func.apply(thiz, args)' in JavaScript.
 * @param thiz 'this' object to be passed to the function
 * @param args arguments to method
 * @return result of call
 */
public Object call(Object thiz,Object... args){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Call this object as a JavaScript function. This is equivalent to 'func.apply(thiz, args)' in JavaScript.
 * @param thiz 'this' object to be passed to the function
 * @param args arguments to method
 * @return result of call
 */
public Object call(final Object thiz,final Object... args){
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 78949
Project: 78949
Buggy source:
/** 
 * Remove a named member from this JavaScript object
 * @param name name of the member
 */
public void removeMember(String name){
}

Fixed version (ground truth):
/** 
 * Remove a named member from this JavaScript object
 * @param name name of the member
 */
public void removeMember(final String name){
}
Program: 78950
Project: 78950
Buggy source:
/** 
 * Set an indexed member in this JavaScript object
 * @param index index of the member slot
 * @param value value of the member
 */
public void setSlot(int index,Object value){
}

Fixed version (ground truth):
/** 
 * Set an indexed member in this JavaScript object
 * @param index index of the member slot
 * @param value value of the member
 */
public void setSlot(final int index,final Object value){
}
Program: 78951
Project: 78951
Buggy source:
/** 
 * Retrieves an indexed member of this JavaScript object.
 * @param index index slot to retrieve
 * @return member
 */
public Object getSlot(int index){
  return null;
}

Fixed version (ground truth):
/** 
 * Retrieves an indexed member of this JavaScript object.
 * @param index index slot to retrieve
 * @return member
 */
public Object getSlot(final int index){
  return null;
}
Program: 78952
Project: 78952
Buggy source:
/** 
 * Does this object have a indexed property?
 * @param slot index to check
 * @return true if this object has a slot
 */
public boolean hasSlot(int slot){
  return false;
}

Fixed version (ground truth):
/** 
 * Does this object have a indexed property?
 * @param slot index to check
 * @return true if this object has a slot
 */
public boolean hasSlot(final int slot){
  return false;
}
Program: 78953
Project: 78953
Buggy source:
/** 
 * Set a named member in this JavaScript object
 * @param name  name of the member
 * @param value value of the member
 */
public void setMember(String name,Object value){
}

Fixed version (ground truth):
/** 
 * Set a named member in this JavaScript object
 * @param name  name of the member
 * @param value value of the member
 */
public void setMember(final String name,final Object value){
}
Program: 78954
Project: 78954
Buggy source:
/** 
 * Evaluate a JavaScript expression.
 * @param s JavaScript expression to evaluate
 * @return evaluation result
 */
public Object eval(String s){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Evaluate a JavaScript expression.
 * @param s JavaScript expression to evaluate
 * @return evaluation result
 */
public Object eval(final String s){
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 78955
Project: 78955
Buggy source:
/** 
 * Call this 'constructor' JavaScript function to create a new object. This is equivalent to 'new func(arg1, arg2...)' in JavaScript.
 * @param args arguments to method
 * @return result of constructor call
 */
public Object newObject(Object... args){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Call this 'constructor' JavaScript function to create a new object. This is equivalent to 'new func(arg1, arg2...)' in JavaScript.
 * @param args arguments to method
 * @return result of constructor call
 */
public Object newObject(final Object... args){
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 78956
Project: 78956
Buggy source:
@Override public Object eval(final ScriptContext ctxt) throws ScriptException {
  final ScriptObject global=getNashornGlobalFrom(ctxt);
  if (func.getScope() == global) {
    return evalImpl(func,ctxt,global);
  }
 else {
    return evalImpl(compileImpl(source,ctxt),ctxt,global);
  }
}

Fixed version (ground truth):
@Override public Object eval(final ScriptContext ctxt) throws ScriptException {
  final ScriptObject globalObject=getNashornGlobalFrom(ctxt);
  if (func.getScope() == globalObject) {
    return evalImpl(func,ctxt,globalObject);
  }
  return evalImpl(compileImpl(source,ctxt),ctxt,globalObject);
}
Program: 78957
Project: 78957
Buggy source:
private CompiledScript asCompiledScript(final Source source) throws ScriptException {
  final ScriptFunction func=compileImpl(source,context);
  return new CompiledScript(){
    @Override public Object eval(    final ScriptContext ctxt) throws ScriptException {
      final ScriptObject global=getNashornGlobalFrom(ctxt);
      if (func.getScope() == global) {
        return evalImpl(func,ctxt,global);
      }
 else {
        return evalImpl(compileImpl(source,ctxt),ctxt,global);
      }
    }
    @Override public ScriptEngine getEngine(){
      return NashornScriptEngine.this;
    }
  }
;
}

Fixed version (ground truth):
private CompiledScript asCompiledScript(final Source source) throws ScriptException {
  final ScriptFunction func=compileImpl(source,context);
  return new CompiledScript(){
    @Override public Object eval(    final ScriptContext ctxt) throws ScriptException {
      final ScriptObject globalObject=getNashornGlobalFrom(ctxt);
      if (func.getScope() == globalObject) {
        return evalImpl(func,ctxt,globalObject);
      }
      return evalImpl(compileImpl(source,ctxt),ctxt,globalObject);
    }
    @Override public ScriptEngine getEngine(){
      return NashornScriptEngine.this;
    }
  }
;
}
Program: 78958
Project: 78958
Buggy source:
public ArrayType getArrayType(){
  if (elementType.isInteger()) {
    return Type.INT_ARRAY;
  }
 else   if (elementType.isLong()) {
    return Type.LONG_ARRAY;
  }
 else   if (elementType.isNumeric()) {
    return Type.NUMBER_ARRAY;
  }
 else {
    return Type.OBJECT_ARRAY;
  }
}

Fixed version (ground truth):
/** 
 * Get the array element type as Java format, e.g. [I
 * @return array element type
 */
public ArrayType getArrayType(){
  if (elementType.isInteger()) {
    return Type.INT_ARRAY;
  }
 else   if (elementType.isLong()) {
    return Type.LONG_ARRAY;
  }
 else   if (elementType.isNumeric()) {
    return Type.NUMBER_ARRAY;
  }
 else {
    return Type.OBJECT_ARRAY;
  }
}
Program: 78959
Project: 78959
Buggy source:
@Override public boolean isOfContext(final Context context){
  return this.context == context;
}

Fixed version (ground truth):
@Override public boolean isOfContext(final Context ctxt){
  return this.context == ctxt;
}
Program: 78960
Project: 78960
Buggy source:
/** 
 * Nashorn extension: Error.captureStackTrace. Capture stack trace at the point of call into the Error object provided.
 * @param self self reference
 * @param errorObj the error object
 * @return undefined
 */
@Function(attributes=Attribute.NOT_ENUMERABLE,where=Where.CONSTRUCTOR) public static Object captureStackTrace(final Object self,final Object errorObj){
  Global.checkObject(errorObj);
  final ScriptObject sobj=(ScriptObject)errorObj;
  final ECMAException exp=new ECMAException(sobj,null);
  sobj.delete("String_Node_Str",false);
  final ScriptFunction getStack=ScriptFunctionImpl.makeFunction("String_Node_Str",GET_STACK);
  final ScriptFunction setStack=ScriptFunctionImpl.makeFunction("String_Node_Str",SET_STACK);
  sobj.addOwnProperty("String_Node_Str",Attribute.NOT_ENUMERABLE,getStack,setStack);
  return UNDEFINED;
}

Fixed version (ground truth):
/** 
 * Nashorn extension: Error.captureStackTrace. Capture stack trace at the point of call into the Error object provided.
 * @param self self reference
 * @param errorObj the error object
 * @return undefined
 */
@SuppressWarnings("String_Node_Str") @Function(attributes=Attribute.NOT_ENUMERABLE,where=Where.CONSTRUCTOR) public static Object captureStackTrace(final Object self,final Object errorObj){
  Global.checkObject(errorObj);
  final ScriptObject sobj=(ScriptObject)errorObj;
  new ECMAException(sobj,null);
  sobj.delete("String_Node_Str",false);
  final ScriptFunction getStack=ScriptFunctionImpl.makeFunction("String_Node_Str",GET_STACK);
  final ScriptFunction setStack=ScriptFunctionImpl.makeFunction("String_Node_Str",SET_STACK);
  sobj.addOwnProperty("String_Node_Str",Attribute.NOT_ENUMERABLE,getStack,setStack);
  return UNDEFINED;
}
Program: 78961
Project: 78961
Buggy source:
ClassLoader getSharedLoader(){
  return sharedLoader;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") ClassLoader getSharedLoader(){
  return sharedLoader;
}
Program: 78962
Project: 78962
Buggy source:
/** 
 * Constructor A logger can be paired with a property, e.g.   {@code --log:codegen:info} is equivalent to {@code -Dnashorn.codegen.log}
 * @param loggerName name of logger - this is the unique key with which it can be identified
 * @param property   system property activating the logger on {@code info} level
 */
public DebugLogger(final String loggerName,final String property){
  if (property != null && Options.getBooleanProperty(property)) {
    this.logger=Logging.getOrCreateLogger(loggerName,Level.INFO);
  }
 else {
    this.logger=Logging.getLogger(loggerName);
  }
  this.isEnabled=logger.getLevel() != Level.OFF;
}

Fixed version (ground truth):
/** 
 * Constructor A logger can be paired with a property, e.g.   {@code --log:codegen:info} is equivalent to {@code -Dnashorn.codegen.log}
 * @param loggerName name of logger - this is the unique key with which it can be identified
 * @param property   system property activating the logger on {@code info} level
 */
public DebugLogger(final String loggerName,final String property){
}
Program: 78963
Project: 78963
Buggy source:
/** 
 * Check if the logger is above of the level of detail given
 * @see java.util.logging.Level
 * @param level logging level
 * @return true if level is above the given one
 */
public boolean levelAbove(final Level level){
  return logger.getLevel().intValue() > level.intValue();
}

Fixed version (ground truth):
/** 
 * Check if the logger is above of the level of detail given
 * @see java.util.logging.Level
 * @param level logging level
 * @return true if level is above the given one
 */
public boolean levelAbove(final Level level){
  return getLevel().intValue() > level.intValue();
}
Program: 78964
Project: 78964
Buggy source:
/** 
 * Is this global of the given Context?
 * @return true if this global belongs to the given Context
 */
public boolean isOfContext(Context context);

Fixed version (ground truth):
/** 
 * Is this global of the given Context?
 * @param ctxt the context
 * @return true if this global belongs to the given Context
 */
public boolean isOfContext(final Context ctxt);
Program: 78965
Project: 78965
Buggy source:
/** 
 * Returns the identification string associated with this <code>GraphicsDevice</code>. <p> A particular program might use more than one <code>GraphicsDevice</code> in a <code>GraphicsEnvironment</code>. This method returns a <code>String</code> identifying a particular <code>GraphicsDevice</code> in the local <code>GraphicsEnvironment</code>.  Although there is no public method to set this <code>String</code>, a programmer can use the <code>String</code> for debugging purposes.  Vendors of the Java<sup><font size=-2>TM</font></sup> Runtime Environment can format the return value of the <code>String</code>.  To determine how to interpret the value of the <code>String</code>, contact the vendor of your Java Runtime.  To find out who the vendor is, from your program, call the  {@link System#getProperty(String) getProperty} method of theSystem class with "java.vendor".
 * @return a <code>String</code> that is the identificationof this <code>GraphicsDevice</code>.
 */
public abstract String getIDstring();

Fixed version (ground truth):
/** 
 * Returns the identification string associated with this <code>GraphicsDevice</code>. <p> A particular program might use more than one <code>GraphicsDevice</code> in a <code>GraphicsEnvironment</code>. This method returns a <code>String</code> identifying a particular <code>GraphicsDevice</code> in the local <code>GraphicsEnvironment</code>.  Although there is no public method to set this <code>String</code>, a programmer can use the <code>String</code> for debugging purposes.  Vendors of the Java&trade; Runtime Environment can format the return value of the <code>String</code>.  To determine how to interpret the value of the <code>String</code>, contact the vendor of your Java Runtime.  To find out who the vendor is, from your program, call the  {@link System#getProperty(String) getProperty} method of theSystem class with "java.vendor".
 * @return a <code>String</code> that is the identificationof this <code>GraphicsDevice</code>.
 */
public abstract String getIDstring();
Program: 78966
Project: 78966
Buggy source:
/** 
 * Returns an array of design limits interleaved in the form [from->to] for each axis.  For example, design limits for weight could be from 0.1 to 1.0. The values are returned in the same order returned by <code>getDesignAxisNames</code>.
 * @return an array of design limits for each axis.
 */
public float[] getDesignAxisRanges();

Fixed version (ground truth):
/** 
 * Returns an array of design limits interleaved in the form [from&rarr;to] for each axis.  For example, design limits for weight could be from 0.1 to 1.0. The values are returned in the same order returned by <code>getDesignAxisNames</code>.
 * @return an array of design limits for each axis.
 */
public float[] getDesignAxisRanges();
Program: 78967
Project: 78967
Buggy source:
/** 
 * Returns an <code>int</code> that ORs together the values for all the ranges that will be shaped. <p> For example, to check if a shaper shapes to Arabic, you would use the following: <blockquote> <code>if ((shaper.getRanges() & shaper.ARABIC) != 0) { ... </code> </blockquote> <p>Note that this method supports only the bit mask-based ranges. Call   {@link #getRangeSet()} for the enum-based ranges.
 * @return the values for all the ranges to be shaped.
 */
public int getRanges(){
  return mask & ~CONTEXTUAL_MASK;
}

Fixed version (ground truth):
/** 
 * Returns an <code>int</code> that ORs together the values for all the ranges that will be shaped. <p> For example, to check if a shaper shapes to Arabic, you would use the following: <blockquote> <code>if ((shaper.getRanges() &amp; shaper.ARABIC) != 0) { ... </code> </blockquote> <p>Note that this method supports only the bit mask-based ranges. Call   {@link #getRangeSet()} for the enum-based ranges.
 * @return the values for all the ranges to be shaped.
 */
public int getRanges(){
  return mask & ~CONTEXTUAL_MASK;
}
Program: 78969
Project: 78969
Buggy source:
/** 
 * Returns the start offset within the selected text. If there is no selection, but there is a caret, the start and end offsets will be the same. Return 0 if the text is empty, or the caret position if no selection.
 * @return the index into the text of the start of the selection >= 0
 */
public int getSelectionStart(){
  return JTextComponent.this.getSelectionStart();
}

Fixed version (ground truth):
/** 
 * Returns the start offset within the selected text. If there is no selection, but there is a caret, the start and end offsets will be the same. Return 0 if the text is empty, or the caret position if no selection.
 * @return the index into the text of the start of the selection &ge; 0
 */
public int getSelectionStart(){
  return JTextComponent.this.getSelectionStart();
}
Program: 78970
Project: 78970
Buggy source:
/** 
 * Sets the selection end to the specified position.  The new end point is constrained to be at or after the current selection start. <p> This is available for backward compatibility to code that called this method on <code>java.awt.TextComponent</code>. This is implemented to forward to the <code>Caret</code> implementation which is where the actual selection is maintained.
 * @param selectionEnd the end position of the text >= 0
 * @beaninfo description: ending location of the selection.
 */
public void setSelectionEnd(int selectionEnd){
  select(getSelectionStart(),selectionEnd);
}

Fixed version (ground truth):
/** 
 * Sets the selection end to the specified position.  The new end point is constrained to be at or after the current selection start. <p> This is available for backward compatibility to code that called this method on <code>java.awt.TextComponent</code>. This is implemented to forward to the <code>Caret</code> implementation which is where the actual selection is maintained.
 * @param selectionEnd the end position of the text &ge; 0
 * @beaninfo description: ending location of the selection.
 */
public void setSelectionEnd(int selectionEnd){
  select(getSelectionStart(),selectionEnd);
}
Program: 78971
Project: 78971
Buggy source:
/** 
 * Sets the selection start to the specified position.  The new starting point is constrained to be before or at the current selection end. <p> This is available for backward compatibility to code that called this method on <code>java.awt.TextComponent</code>. This is implemented to forward to the <code>Caret</code> implementation which is where the actual selection is maintained.
 * @param selectionStart the start position of the text >= 0
 * @beaninfo description: starting location of the selection.
 */
public void setSelectionStart(int selectionStart){
  select(selectionStart,getSelectionEnd());
}

Fixed version (ground truth):
/** 
 * Sets the selection start to the specified position.  The new starting point is constrained to be before or at the current selection end. <p> This is available for backward compatibility to code that called this method on <code>java.awt.TextComponent</code>. This is implemented to forward to the <code>Caret</code> implementation which is where the actual selection is maintained.
 * @param selectionStart the start position of the text &ge; 0
 * @beaninfo description: starting location of the selection.
 */
public void setSelectionStart(int selectionStart){
  select(selectionStart,getSelectionEnd());
}
Program: 78973
Project: 78973
Buggy source:
/** 
 * Converts the given place in the view coordinate system to the nearest representative location in the model. The component must have a positive size for this translation to be computed (i.e. layout cannot be computed until the component has been sized).  The component does not have to be visible or painted.
 * @param pt the location in the view to translate
 * @return the offset >= 0 from the start of the document,or -1 if the component does not yet have a positive size.
 * @see TextUI#viewToModel
 */
public int viewToModel(Point pt){
  return getUI().viewToModel(this,pt);
}

Fixed version (ground truth):
/** 
 * Converts the given place in the view coordinate system to the nearest representative location in the model. The component must have a positive size for this translation to be computed (i.e. layout cannot be computed until the component has been sized).  The component does not have to be visible or painted.
 * @param pt the location in the view to translate
 * @return the offset &ge; 0 from the start of the document,or -1 if the component does not yet have a positive size.
 * @see TextUI#viewToModel
 */
public int viewToModel(Point pt){
  return getUI().viewToModel(this,pt);
}
Program: 78974
Project: 78974
Buggy source:
/** 
 * Returns the number of characters (valid indices)
 * @return the number of characters >= 0
 */
public int getCharCount(){
  return model.getLength();
}

Fixed version (ground truth):
/** 
 * Returns the number of characters (valid indices)
 * @return the number of characters &ge; 0
 */
public int getCharCount(){
  return model.getLength();
}
Program: 78975
Project: 78975
Buggy source:
/** 
 * Converts the given location in the model to a place in the view coordinate system. The component must have a positive size for this translation to be computed (i.e. layout cannot be computed until the component has been sized).  The component does not have to be visible or painted.
 * @param pos the position >= 0
 * @return the coordinates as a rectangle, with (r.x, r.y) as the locationin the coordinate system, or null if the component does not yet have a positive size.
 * @exception BadLocationException if the given position does notrepresent a valid location in the associated document
 * @see TextUI#modelToView
 */
public Rectangle modelToView(int pos) throws BadLocationException {
  return getUI().modelToView(this,pos);
}

Fixed version (ground truth):
/** 
 * Converts the given location in the model to a place in the view coordinate system. The component must have a positive size for this translation to be computed (i.e. layout cannot be computed until the component has been sized).  The component does not have to be visible or painted.
 * @param pos the position &ge; 0
 * @return the coordinates as a rectangle, with (r.x, r.y) as the locationin the coordinate system, or null if the component does not yet have a positive size.
 * @exception BadLocationException if the given position does notrepresent a valid location in the associated document
 * @see TextUI#modelToView
 */
public Rectangle modelToView(int pos) throws BadLocationException {
  return getUI().modelToView(this,pos);
}
Program: 78976
Project: 78976
Buggy source:
/** 
 * Returns the end offset within the selected text. If there is no selection, but there is a caret, the start and end offsets will be the same. Return 0 if the text is empty, or the caret position if no selection.
 * @return the index into teh text of the end of the selection >= 0
 */
public int getSelectionEnd(){
  return JTextComponent.this.getSelectionEnd();
}

Fixed version (ground truth):
/** 
 * Returns the end offset within the selected text. If there is no selection, but there is a caret, the start and end offsets will be the same. Return 0 if the text is empty, or the caret position if no selection.
 * @return the index into teh text of the end of the selection &ge; 0
 */
public int getSelectionEnd(){
  return JTextComponent.this.getSelectionEnd();
}
Program: 78977
Project: 78977
Buggy source:
private Node leaveCmp(final BinaryNode binaryNode){
  ensureTypeNotUnknown(binaryNode.lhs());
  ensureTypeNotUnknown(binaryNode.rhs());
  return end(ensureSymbol(Type.BOOLEAN,binaryNode));
}

Fixed version (ground truth):
private Node leaveCmp(final BinaryNode binaryNode){
  ensureTypeNotUnknown(binaryNode.lhs());
  ensureTypeNotUnknown(binaryNode.rhs());
  Type widest=Type.widest(binaryNode.lhs().getType(),binaryNode.rhs().getType());
  ensureSymbol(widest,binaryNode.lhs());
  ensureSymbol(widest,binaryNode.rhs());
  return end(ensureSymbol(Type.BOOLEAN,binaryNode));
}
Program: 78978
Project: 78978
Buggy source:
@Override public Node leaveNEW(final UnaryNode unaryNode){
  return end(ensureSymbol(Type.OBJECT,unaryNode));
}

Fixed version (ground truth):
@Override public Node leaveNEW(final UnaryNode unaryNode){
  return end(ensureSymbol(Type.OBJECT,unaryNode.setRHS(((CallNode)unaryNode.rhs()).setIsNew())));
}
Program: 78979
Project: 78979
Buggy source:
/** 
 * Eg. var d = 17; var e; e = d; //initially typed as int for node type, should retype as double e = object; var d = 17; var e; e -= d; //initially type number, should number remain with a final conversion supplied by Store. ugly, but the computation result of the sub is numeric e = object;
 */
@SuppressWarnings("String_Node_Str") @Override public Node leaveBinaryNode(final BinaryNode binaryNode){
  final Type widest=Type.widest(binaryNode.lhs().getType(),binaryNode.rhs().getType());
  BinaryNode newBinaryNode=binaryNode;
switch (binaryNode.tokenType()) {
default :
    if (!binaryNode.isAssignment() || binaryNode.isSelfModifying()) {
      break;
    }
  newBinaryNode=newBinaryNode.setLHS(widen(newBinaryNode.lhs(),widest));
case ADD:
newBinaryNode=(BinaryNode)widen(newBinaryNode,widest);
}
return newBinaryNode;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public Node leaveBinaryNode(final BinaryNode binaryNode){
  final Type widest=Type.widest(binaryNode.lhs().getType(),binaryNode.rhs().getType());
  BinaryNode newBinaryNode=binaryNode;
  if (isAdd(binaryNode)) {
    newBinaryNode=(BinaryNode)widen(newBinaryNode,widest);
    if (newBinaryNode.getType().isObject() && !isAddString(newBinaryNode)) {
      return new RuntimeNode(newBinaryNode,Request.ADD);
    }
  }
 else   if (binaryNode.isComparison()) {
    final Expression lhs=newBinaryNode.lhs();
    final Expression rhs=newBinaryNode.rhs();
    Type cmpWidest=Type.widest(lhs.getType(),rhs.getType());
    boolean newRuntimeNode=false, finalized=false;
switch (newBinaryNode.tokenType()) {
case EQ_STRICT:
case NE_STRICT:
      if (lhs.getType().isBoolean() != rhs.getType().isBoolean()) {
        newRuntimeNode=true;
        cmpWidest=Type.OBJECT;
        finalized=true;
      }
default :
    if (newRuntimeNode || cmpWidest.isObject()) {
      return new RuntimeNode(newBinaryNode,Request.requestFor(binaryNode)).setIsFinal(finalized);
    }
  break;
}
return newBinaryNode;
}
 else {
if (!binaryNode.isAssignment() || binaryNode.isSelfModifying()) {
return newBinaryNode;
}
checkThisAssignment(binaryNode);
newBinaryNode=newBinaryNode.setLHS(widen(newBinaryNode.lhs(),widest));
newBinaryNode=(BinaryNode)widen(newBinaryNode,widest);
}
return newBinaryNode;
}
Program: 78981
Project: 78981
Buggy source:
private void branchOptimizer(final Expression node,final Label label,final boolean state){
  if (!(node instanceof TernaryNode)) {
    if (node instanceof BinaryNode) {
      branchOptimizer((BinaryNode)node,label,state);
      return;
    }
    if (node instanceof UnaryNode) {
      branchOptimizer((UnaryNode)node,label,state);
      return;
    }
  }
  load(node);
  method.convert(Type.BOOLEAN);
  if (state) {
    method.ifne(label);
  }
 else {
    method.ifeq(label);
  }
}

Fixed version (ground truth):
private void branchOptimizer(final Expression node,final Label label,final boolean state){
  if (!(node instanceof TernaryNode)) {
    if (node instanceof BinaryNode) {
      branchOptimizer((BinaryNode)node,label,state);
      return;
    }
    if (node instanceof UnaryNode) {
      branchOptimizer((UnaryNode)node,label,state);
      return;
    }
  }
  codegen.load(node);
  method.convert(Type.BOOLEAN);
  if (state) {
    method.ifne(label);
  }
 else {
    method.ifeq(label);
  }
}
Program: 78982
Project: 78982
Buggy source:
/** 
 * Returns the extended modifier mask for this event. <P> Extended modifiers are the modifiers that ends with the _DOWN_MASK suffix, such as ALT_DOWN_MASK, BUTTON1_DOWN_MASK, and others. <P> Extended modifiers represent the state of all modal keys, such as ALT, CTRL, META, and the mouse buttons just after the event occurred. <P> For example, if the user presses <b>button 1</b> followed by <b>button 2</b>, and then releases them in the same order, the following sequence of events is generated: <PRE> <code>MOUSE_PRESSED</code>:  <code>BUTTON1_DOWN_MASK</code> <code>MOUSE_PRESSED</code>:  <code>BUTTON1_DOWN_MASK | BUTTON2_DOWN_MASK</code> <code>MOUSE_RELEASED</code>: <code>BUTTON2_DOWN_MASK</code> <code>MOUSE_CLICKED</code>:  <code>BUTTON2_DOWN_MASK</code> <code>MOUSE_RELEASED</code>: <code>MOUSE_CLICKED</code>: </PRE> <P> It is not recommended to compare the return value of this method using <code>==</code> because new modifiers can be added in the future. For example, the appropriate way to check that SHIFT and BUTTON1 are down, but CTRL is up is demonstrated by the following code: <PRE> int onmask = SHIFT_DOWN_MASK | BUTTON1_DOWN_MASK; int offmask = CTRL_DOWN_MASK; if ((event.getModifiersEx() & (onmask | offmask)) == onmask) { ... } </PRE> The above code will work even if new modifiers are added.
 * @since 1.4
 */
public int getModifiersEx(){
  return modifiers & ~JDK_1_3_MODIFIERS;
}

Fixed version (ground truth):
/** 
 * Returns the extended modifier mask for this event. <P> Extended modifiers are the modifiers that ends with the _DOWN_MASK suffix, such as ALT_DOWN_MASK, BUTTON1_DOWN_MASK, and others. <P> Extended modifiers represent the state of all modal keys, such as ALT, CTRL, META, and the mouse buttons just after the event occurred. <P> For example, if the user presses <b>button 1</b> followed by <b>button 2</b>, and then releases them in the same order, the following sequence of events is generated: <PRE> <code>MOUSE_PRESSED</code>:  <code>BUTTON1_DOWN_MASK</code> <code>MOUSE_PRESSED</code>:  <code>BUTTON1_DOWN_MASK | BUTTON2_DOWN_MASK</code> <code>MOUSE_RELEASED</code>: <code>BUTTON2_DOWN_MASK</code> <code>MOUSE_CLICKED</code>:  <code>BUTTON2_DOWN_MASK</code> <code>MOUSE_RELEASED</code>: <code>MOUSE_CLICKED</code>: </PRE> <P> It is not recommended to compare the return value of this method using <code>==</code> because new modifiers can be added in the future. For example, the appropriate way to check that SHIFT and BUTTON1 are down, but CTRL is up is demonstrated by the following code: <PRE> int onmask = SHIFT_DOWN_MASK | BUTTON1_DOWN_MASK; int offmask = CTRL_DOWN_MASK; if ((event.getModifiersEx() &amp; (onmask | offmask)) == onmask) { ... } </PRE> The above code will work even if new modifiers are added.
 * @since 1.4
 */
public int getModifiersEx(){
  return modifiers & ~JDK_1_3_MODIFIERS;
}
Program: 78987
Project: 78987
Buggy source:
/** 
 * Provides a hint to the look and feel as to the <code>KeyEvent.VK</code> constant that can be used as a mnemonic to access the panel. A return value <= 0 indicates there is no mnemonic. <p> The return value here is a hint, it is ultimately up to the look and feel to honor the return value in some meaningful way. <p> This implementation returns 0, indicating the <code>AbstractColorChooserPanel</code> does not support a mnemonic, subclasses wishing a mnemonic will need to override this.
 * @return KeyEvent.VK constant identifying the mnemonic; <= 0 for nomnemonic
 * @see #getDisplayedMnemonicIndex
 * @since 1.4
 */
public int getMnemonic(){
  return 0;
}

Fixed version (ground truth):
/** 
 * Provides a hint to the look and feel as to the <code>KeyEvent.VK</code> constant that can be used as a mnemonic to access the panel. A return value &lt;= 0 indicates there is no mnemonic. <p> The return value here is a hint, it is ultimately up to the look and feel to honor the return value in some meaningful way. <p> This implementation returns 0, indicating the <code>AbstractColorChooserPanel</code> does not support a mnemonic, subclasses wishing a mnemonic will need to override this.
 * @return KeyEvent.VK constant identifying the mnemonic; &lt;= 0 for nomnemonic
 * @see #getDisplayedMnemonicIndex
 * @since 1.4
 */
public int getMnemonic(){
  return 0;
}
Program: 78988
Project: 78988
Buggy source:
/** 
 * Provides a hint to the look and feel as to the index of the character in <code>getDisplayName</code> that should be visually identified as the mnemonic. The look and feel should only use this if <code>getMnemonic</code> returns a value > 0. <p> The return value here is a hint, it is ultimately up to the look and feel to honor the return value in some meaningful way. For example, a look and feel may wish to render each <code>AbstractColorChooserPanel</code> in a <code>JTabbedPane</code>, and further use this return value to underline a character in the <code>getDisplayName</code>. <p> This implementation returns -1, indicating the <code>AbstractColorChooserPanel</code> does not support a mnemonic, subclasses wishing a mnemonic will need to override this.
 * @return Character index to render mnemonic for; -1 to provide novisual identifier for this panel.
 * @see #getMnemonic
 * @since 1.4
 */
public int getDisplayedMnemonicIndex(){
  return -1;
}

Fixed version (ground truth):
/** 
 * Provides a hint to the look and feel as to the index of the character in <code>getDisplayName</code> that should be visually identified as the mnemonic. The look and feel should only use this if <code>getMnemonic</code> returns a value &gt; 0. <p> The return value here is a hint, it is ultimately up to the look and feel to honor the return value in some meaningful way. For example, a look and feel may wish to render each <code>AbstractColorChooserPanel</code> in a <code>JTabbedPane</code>, and further use this return value to underline a character in the <code>getDisplayName</code>. <p> This implementation returns -1, indicating the <code>AbstractColorChooserPanel</code> does not support a mnemonic, subclasses wishing a mnemonic will need to override this.
 * @return Character index to render mnemonic for; -1 to provide novisual identifier for this panel.
 * @see #getMnemonic
 * @since 1.4
 */
public int getDisplayedMnemonicIndex(){
  return -1;
}
Program: 78989
Project: 78989
Buggy source:
/** 
 * Fetches the location of other end of a logical selection.  If there is no selection, this will be the same as dot.
 * @return the mark >= 0
 */
public abstract int getMark();

Fixed version (ground truth):
/** 
 * Fetches the location of other end of a logical selection.  If there is no selection, this will be the same as dot.
 * @return the mark &gt;= 0
 */
public abstract int getMark();
Program: 78990
Project: 78990
Buggy source:
/** 
 * Fetches the location of the caret.
 * @return the dot >= 0
 */
public abstract int getDot();

Fixed version (ground truth):
/** 
 * Fetches the location of the caret.
 * @return the dot &gt;= 0
 */
public abstract int getDot();
Program: 78991
Project: 78991
Buggy source:
/** 
 * Fetches the index within the element represented. This is the location that children were added and/or removed.
 * @return the index >= 0
 */
public int getIndex();

Fixed version (ground truth):
/** 
 * Fetches the index within the element represented. This is the location that children were added and/or removed.
 * @return the index &gt;= 0
 */
public int getIndex();
Program: 78992
Project: 78992
Buggy source:
/** 
 * Returns the offset within the document of the start of the change.
 * @return the offset >= 0
 */
public int getOffset();

Fixed version (ground truth):
/** 
 * Returns the offset within the document of the start of the change.
 * @return the offset &gt;= 0
 */
public int getOffset();
Program: 78993
Project: 78993
Buggy source:
/** 
 * Returns the length of the change.
 * @return the length >= 0
 */
public int getLength();

Fixed version (ground truth):
/** 
 * Returns the length of the change.
 * @return the length &gt;= 0
 */
public int getLength();
Program: 78994
Project: 78994
Buggy source:
/** 
 * Constructs a ListDataEvent object. If index0 is > index1, index0 and index1 will be swapped such that index0 will always be <= index1.
 * @param source  the source Object (typically <code>this</code>)
 * @param type    an int specifying {@link #CONTENTS_CHANGED},  {@link #INTERVAL_ADDED}, or   {@link #INTERVAL_REMOVED}
 * @param index0  one end of the new interval
 * @param index1  the other end of the new interval
 */
public ListDataEvent(Object source,int type,int index0,int index1){
  super(source);
  this.type=type;
  this.index0=Math.min(index0,index1);
  this.index1=Math.max(index0,index1);
}

Fixed version (ground truth):
/** 
 * Constructs a ListDataEvent object. If index0 is &gt; index1, index0 and index1 will be swapped such that index0 will always be &lt;= index1.
 * @param source  the source Object (typically <code>this</code>)
 * @param type    an int specifying {@link #CONTENTS_CHANGED},  {@link #INTERVAL_ADDED}, or   {@link #INTERVAL_REMOVED}
 * @param index0  one end of the new interval
 * @param index1  the other end of the new interval
 */
public ListDataEvent(Object source,int type,int index0,int index1){
  super(source);
  this.type=type;
  this.index0=Math.min(index0,index1);
  this.index1=Math.max(index0,index1);
}
Program: 78995
Project: 78995
Buggy source:
/** 
 * Notification from the <code>UIManager</code> that the look and feel [L&F] has changed. Replaces the current UI object with the latest version from the <code>UIManager</code>.
 * @see JComponent#updateUI
 */
public void updateUI(){
  super.updateUI();
  setForeground(null);
  setBackground(null);
}

Fixed version (ground truth):
/** 
 * Notification from the <code>UIManager</code> that the look and feel [L&amp;F] has changed. Replaces the current UI object with the latest version from the <code>UIManager</code>.
 * @see JComponent#updateUI
 */
public void updateUI(){
  super.updateUI();
  setForeground(null);
  setBackground(null);
}