Unicorn with delicious cookie
Nous utilisons des cookies pour améliorer votre expérience de navigation. En savoir plus
Accepter
to the top
>
>
>
V6100. An object is used as an...
menu mobile close menu
Additional information
toggle menu Contents

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

17 Nov 2020

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:

You can look at examples of errors detected by the V6100 diagnostic.