Java 8 - Custom JavaDoc check using Doclet

user7294900 :

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

PowerStat :

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.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=107528&siteId=1