title: Sonar javadoc rule
body: <p>Currently I'm rewriting checkstyle rule JavadocStyle using Sonar internal libraries. But I'm facing one problem - rule throws true on noMainDescription() even if method or class does not have javadoc. I am using <a href="https://github.com/SonarSource/sonar-java/blob/master/java-checks/src/main/java/org/sonar/java/checks/helpers/Javadoc.java" rel="nofollow noreferrer">sonar javadoc class to get javadoc information</a>. 
  This is my test class: </p>
  
  <p><a href="https://i.stack.imgur.com/Mc9tG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Mc9tG.png" alt="SonarLint shows which class or method violates rule"></a></p>
  
  <p>This is what I get in sonar: </p>
  
  <p><a href="https://i.stack.imgur.com/9dkZ1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9dkZ1.png" alt="SonarQube view"></a></p>
  
  <p>One of my tasks is to check if javadoc contains description or is empty and throw violation.</p>
  
  <p>I use this code to check it: </p>
  
  <pre><code>@Override
  public void visitNode(Tree tree) {
      Javadoc javadoc = new Javadoc(tree);
      String lines = String.join("  ", javadoc.javadocLines);
  
      // Javadoc description
      reportEmptyDescription(tree, javadoc);
  
  }
  
  public void reportEmptyDescription(Tree tree, Javadoc javadoc) {
      if (isDescriptionEmpty(javadoc)) {
          reportIssue(tree.firstToken(), "Javadoc has empty description section");
      }
      if (tree.is(Tree.Kind.METHOD) &amp;&amp; ((MethodTree) tree).symbol().returnType().toString() != "void"
              &amp;&amp; isReturnDescriptionEmpty(javadoc)) {
          reportIssue(tree.firstToken(), "Javadoc has empty return description");
      }
      if (tree.is(Tree.Kind.METHOD) &amp;&amp; !((MethodTree) tree).parameters().isEmpty()
              &amp;&amp; isParametersDescriptionEmpty(javadoc)) {
          reportIssue(tree.firstToken(), "Javadoc has empty parameters description");
      }
  }
  
  public boolean isDescriptionEmpty(Javadoc javadoc) {
      return javadoc.noMainDescription(); // check if it returns true when description exists
  }
  
  public boolean isReturnDescriptionEmpty(Javadoc javadoc) {
      return javadoc.noReturnDescription(); // check if it returns true when description exists
  }
  
  public boolean isParametersDescriptionEmpty(Javadoc javadoc) {
      if (javadoc.undocumentedParameters().isEmpty()) {
          return false;
      } else {
          return true;
      }
  }
  </code></pre>
  
  <p>My problem is shown in first violation: class does not have javadocs but rule reads that it have but with no description.</p>
  
  <p>Is there a way to prevent this problem?</p>