Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javadoc shows Error "reference not found" although reference cleary exists

Tags:

java-8

javadoc

With Java8 the javadoc checks became stricter. The common solution is to disable the strict javadoc checking. Nevertheless, I started trying to fix the errors in some projects.
But there is one error I don't get fixed.

The corresponding class:

package foo;

import com.google.gwt.user.client.ui.TextArea;
[...]

public class MyClass {

  [...]

  /**
   * @see TextArea#getValue()
   */
  public String getValue() {
      [...]
  }

  /**
   * @see TextArea#setValue(String value)
   */
  public void setValue(String value) {
      [...]
  }

  /**
   * @see TextArea#setValue(String, boolean)
   */
  public void setValue(String value, boolean fireEvents) {
      [...]
  }
}

And the error message:

[ERROR] ...\MyClass.java:44: error: reference not found
[ERROR] * @see TextArea#setValue(String value)  
[ERROR] ^
[ERROR] ...\MyClass.java:51: error: reference not found
[ERROR] * @see TextArea#setValue(String, boolean)

The error message states that it cannot find TextArea in the Javadoc of the setValue-Methods - but on the other hand has no problems to find TextArea on the getValue-Method.

As far as I can say, I followed How to specify a name as well as @see reference.

Any clues? Thanks a lot!

like image 276
markus_ Avatar asked Oct 13 '16 14:10

markus_


1 Answers

Okay, I got the answer now, it's a bit tricky!

  • TextArea extends ValueBoxBase<String>
  • TextArea#getValue() has no Parameters, so everything is fine
  • The Method TextArea#setValue(String value) does not exist in TextArea, it is rather defined in the superclass: ValueBoxBase#setValue(Object, boolean).

But there it is! There is "technically" no method setValue(String). It's rather setValue(Object). There is either no way for javadoc to resolve this on its own or it's just a bug.

Thus, the only was I found to solve this is using the reference to the superclass.

/**
 * @see com.google.gwt.user.client.ui.ValueBoxBase#setValue(Object, boolean)
 */
like image 142
markus_ Avatar answered Sep 21 '22 20:09

markus_