3

I'm interested in validating JavaDoc, I found this answer of customizing checks:

import com.sun.javadoc.*;

public class CheckingDoclet extends Doclet {

The problem com.sun.javadoc was removed and will be replaced only in java 9 (which means using at least java 10)

The declarations in this package have been superseded by those in the package jdk.javadoc.doclet. For more information, see the Migration Guide in the documentation for that package.

Is there any replacement using Java 8?

EDIT

I need a new check for preventing description after block tag,

In checkstyle there's no such rule and need to create a new check

In PMD there's no such rule and probably need to create a new check

Community
  • 1
  • 1
Ori Marko
  • 56,308
  • 23
  • 131
  • 233
  • How about http://checkstyle.sourceforge.net/writingchecks.html – PowerStat Oct 11 '18 at 06:53
  • @PowerStat Is this my only option? can you elaborate to an answer ? – Ori Marko Oct 11 '18 at 06:56
  • I don't know another way or tool - except asking the CheckStyle/PMD community to find someone who will implement a check on your requirements. Maybe there are plugins out there that I don't know. – PowerStat Oct 11 '18 at 07:03

1 Answers1

1

I would suggest to use the JavaDoc checks of your ide (my is eclipse) - and also of CheckStyle and PMD.

For all three you should do your own configuration!

Within eclipse you can find the configuration for JavaDocs at Windows/Preferences/Java/Compiler/Javadoc

For the case that you have special requirements that can not be fulfilled by these tools - then forget about eclipse. Your only chance is to write your own extensions for CheckStyle or PMD. For example see Writing CheckStyle checks.

Btw. also it is not recommended to use java internal api's - see Stackoverflow About Java 8 Doclets. To my best knowledge these api's will vanish with Java 9/10/11+. So it's not recommended to use them.

PowerStat
  • 3,757
  • 8
  • 32
  • 57
  • I need a new check for preventing description after block tag, In checkstyle need to create a new check, see https://groups.google.com/forum/#!topic/checkstyle/gsVk6qHeG-k – Ori Marko Oct 11 '18 at 06:48
  • Extended my answer. – PowerStat Oct 11 '18 at 07:12
  • 1
    I don’t know why you are using future tense in “these api's will vanish with Java 9/10/11+”. Java 11 has been released already and these package are still there. Further, `com.sun.javadoc` never was an internal package. It was the official [documented javadoc API](https://docs.oracle.com/javase/8/docs/jdk/api/javadoc/doclet/) and [still is part of it](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.javadoc/com/sun/javadoc/package-summary.html) even if we are in a transition phase towards a better designed API. Its removal won’t happen in the next days. – Holger Oct 11 '18 at 14:01
  • JavaDoc does not only need a better designed api, it need w3c standard conform output. Btw. have striked through the part of my comment about "internal api". – PowerStat Oct 12 '18 at 05:00