V6100. An object is used as an argument to its own method. Consider checking the first actual argument of the 'Foo' method.

The analyzer detected a method call in which an object is used as an argument to its own method. Most likely, this is erroneous code and the method should be passed another object.

Consider the example:

a.foo(a);

Due to a typo the incorrect variable name is used here. The fixed version of this code should look like this:

a.foo(b);

or this:

b.foo(a);

And here's an example from a real application:

public class ByteBufferBodyConsumer {
  private ByteBuffer byteBuffer;
  ....
  public void consume(ByteBuffer byteBuffer) {
    byteBuffer.put(byteBuffer);
  }
}

Here they are trying to insert its own values into the 'byteBuffer'.

Fixed code:

public class ByteBufferBodyConsumer {
  private ByteBuffer byteBuffer;
  ....
  public void consume(ByteBuffer byteBuffer) {
    this.byteBuffer.put(byteBuffer);
  }
}

This diagnostic is classified as:


Bugs Found

Checked Projects
419
Collected Errors
14 312
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site. Learn More →
Accept