nus-yam/ex-repair huggingface dataset:
Program: 77224
Project: 77224
Buggy source:
/** 
 * Retries the referral currently being processed. A call to this method should be followed by a call to <code>getReferralContext</code> to allow the current referral to be retried. The following code fragment shows a typical usage pattern. <p><blockquote><pre> } catch (ReferralException e) { while (true) { try { ctx = e.getReferralContext(env); break; } catch (NamingException ne) { if (! shallIRetry()) { return; } // modify environment properties (env), if necessary e.retryReferral(); } } } </pre></blockquote>
 */
public abstract void retryReferral();

Fixed version (ground truth):
/** 
 * Retries the referral currently being processed. A call to this method should be followed by a call to <code>getReferralContext</code> to allow the current referral to be retried. The following code fragment shows a typical usage pattern. <blockquote><pre> } catch (ReferralException e) { while (true) { try { ctx = e.getReferralContext(env); break; } catch (NamingException ne) { if (! shallIRetry()) { return; } // modify environment properties (env), if necessary e.retryReferral(); } } } </pre></blockquote>
 */
public abstract void retryReferral();
Program: 77225
Project: 77225
Buggy source:
private void checkPackageAccess(Class<?> cls,ProtectionDomain pd){
  final SecurityManager sm=System.getSecurityManager();
  if (sm != null) {
    if (ReflectUtil.isNonPublicProxyClass(cls)) {
      for (      Class intf : cls.getInterfaces()) {
        checkPackageAccess(intf,pd);
      }
      return;
    }
    final String name=cls.getName();
    final int i=name.lastIndexOf('.');
    if (i != -1) {
      AccessController.doPrivileged(new PrivilegedAction<Void>(){
        public Void run(){
          sm.checkPackageAccess(name.substring(0,i));
          return null;
        }
      }
,new AccessControlContext(new ProtectionDomain[]{pd}));
    }
  }
  domains.add(pd);
}

Fixed version (ground truth):
private void checkPackageAccess(Class<?> cls,ProtectionDomain pd){
  final SecurityManager sm=System.getSecurityManager();
  if (sm != null) {
    if (ReflectUtil.isNonPublicProxyClass(cls)) {
      for (      Class<?> intf : cls.getInterfaces()) {
        checkPackageAccess(intf,pd);
      }
      return;
    }
    final String name=cls.getName();
    final int i=name.lastIndexOf('.');
    if (i != -1) {
      AccessController.doPrivileged(new PrivilegedAction<Void>(){
        public Void run(){
          sm.checkPackageAccess(name.substring(0,i));
          return null;
        }
      }
,new AccessControlContext(new ProtectionDomain[]{pd}));
    }
  }
  domains.add(pd);
}
Program: 77227
Project: 77227
Buggy source:
/** 
 * Remove all stale entries, everywhere. 
 */
private void removeStaleEntries(){
  Entry[] cache=getCache();
  removeStaleEntries(cache,0,cache.length + PROBE_LIMIT - 1);
}

Fixed version (ground truth):
/** 
 * Remove all stale entries, everywhere. 
 */
private void removeStaleEntries(){
  Entry<?>[] cache=getCache();
  removeStaleEntries(cache,0,cache.length + PROBE_LIMIT - 1);
}
Program: 77228
Project: 77228
Buggy source:
/** 
 * Returns the stack depth 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 -1 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 depth on the stack frame of the most recent occurrence ofa 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 int classLoaderDepth(){
  int depth=classLoaderDepth0();
  if (depth != -1) {
    if (hasAllPermission())     depth=-1;
 else     depth--;
  }
  return depth;
}

Fixed version (ground truth):
/** 
 * Returns the stack depth 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 -1 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 depth on the stack frame of the most recent occurrence ofa 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 int classLoaderDepth(){
  int depth=classLoaderDepth0();
  if (depth != -1) {
    if (hasAllPermission())     depth=-1;
 else     depth--;
  }
  return depth;
}
Program: 77230
Project: 77230
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: 77231
Project: 77231
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: 77232
Project: 77232
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: 77233
Project: 77233
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: 77234
Project: 77234
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: 77235
Project: 77235
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: 77236
Project: 77236
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: 77237
Project: 77237
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: 77238
Project: 77238
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: 77239
Project: 77239
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: 77240
Project: 77240
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: 77241
Project: 77241
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: 77242
Project: 77242
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: 77243
Project: 77243
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: 77244
Project: 77244
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: 77245
Project: 77245
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: 77246
Project: 77246
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: 77247
Project: 77247
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: 77248
Project: 77248
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: 77249
Project: 77249
Buggy source:
ClassLoader getSharedLoader(){
  return sharedLoader;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") ClassLoader getSharedLoader(){
  return sharedLoader;
}
Program: 77250
Project: 77250
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: 77251
Project: 77251
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: 77252
Project: 77252
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: 77253
Project: 77253
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: 77254
Project: 77254
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: 77255
Project: 77255
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: 77257
Project: 77257
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: 77258
Project: 77258
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: 77259
Project: 77259
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: 77261
Project: 77261
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: 77262
Project: 77262
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: 77263
Project: 77263
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: 77264
Project: 77264
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: 77265
Project: 77265
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: 77266
Project: 77266
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: 77267
Project: 77267
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: 77269
Project: 77269
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: 77270
Project: 77270
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: 77275
Project: 77275
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;
}