Questions tagged [javadoc]

Javadoc is an extensible documentation generation system which reads specially formatted comments in Java source code and generates compiled documentation. It is typically used to produce API documentation in the form of HTML web pages.

Javadoc is an extensible documentation generation system which reads specially formatted comments in Java source code and generates compiled documentation. It is typically used to produce API documentation in the form of HTML web pages.

A Javadoc comment starts with /** (an extra star to the normal multi-line comment) and ends with */. It also makes use of tags (starting with @).

Resources

2947 questions
60
votes
4 answers

Javadoc in JDK 8 : Invalid "self-closing element not allowed"

What are the best workarounds when running javadoc using JDK 8 and one receives this error. It seems that for JDK 8 it has been decided that tags like
and

should generate errors, because they are invalid (strict) HTML 4. see discussion…

JE42
  • 4,881
  • 6
  • 41
  • 51
59
votes
5 answers

JavaDoc for private / protected methods?

Should I write JavaDoc for private or protected methods? And what about private variables? I see class examples on my Java book and the private variables are JavaDoc'ed. So I can't understand if it is a good practice to JavaDoc the private (or…
smartmouse
  • 13,912
  • 34
  • 100
  • 166
59
votes
2 answers

Overridden methods in JavaDoc

I'm documenting a Java program that I have developed, and wanted to know if JavaDoc will be generated for an inherited method (which is overridden) if I just document the superclass? If I have a class called Vehicle with a drive() method in, and a…
Alex Blundell
  • 2,084
  • 5
  • 22
  • 31
58
votes
4 answers

How to see Javadoc documentation on mouse hover in NetBeans?

Is it possible, when you mouse hover on method/class so you can see Javadoc in NetBeans 7? I want similar to Eclipse, when you just mouse hover on String and you can read Java API documentation about it. Maybe there is some hot key for that...
VextoR
  • 5,087
  • 22
  • 74
  • 109
57
votes
4 answers

How to create JavaDoc using Android Studio without R and BuildConfig?

I want to generate the JavaDoc for my library excluding R and BuildConfig. The Generate JavaDoc... functionality from the Tools menu does not have the option to exclude files. How to create JavaDoc using Android Studio without R and and BuildConfig?
Jan Deinhard
  • 19,645
  • 24
  • 81
  • 137
57
votes
6 answers

Unable to build Maven project due to Javadoc error?

Has anyone come across a similar Maven error as below? I am unable to build my project due to the error below. All was working previously fine before I started working on the code. I did not even work on the below defined interfaces and it seems to…
Jono
  • 17,341
  • 48
  • 135
  • 217
57
votes
9 answers

Unable to find javadoc command - maven

I ran this command in my project directory to build and package it: mvn clean javadoc:jar package I do have my JAVA_HOME variable set correctly. Evidently: $ which java /usr/bin/java $ sudo ls -l /usr/bin/java lrwxr-xr-x 1 root wheel 74 Dec 18…
user1508893
  • 9,223
  • 14
  • 45
  • 57
56
votes
4 answers

javadoc: @version and @since

Is there a reason to include both @version and @since as part of a class? They seem to be mutually exclusive. Also, what does %I% and %G% mean, and how to set/use them? @version %I%, %G%
Sasha
55
votes
6 answers

Why does the Double.valueof javadoc say it caches values, when it doesn't?

In OpenJDK, for the method: public static Double valueOf(double d) The javadoc says: Returns a Double instance representing the specified double value. If a new Double instance is not required, this method should generally be used in preference to…
z7sg Ѫ
  • 3,153
  • 1
  • 23
  • 35
55
votes
4 answers

Why am I getting a ClassCastException when generating javadocs?

I'm using ant to generate javadocs, but get this exception over and over - why? I'm using JDK version 1.6.0_06. [javadoc] java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc …
ScArcher2
  • 85,501
  • 44
  • 121
  • 160
55
votes
19 answers

Do you use Javadoc for every method you write?

Should I be writing Doc Comments for all of my java methods?
mawaldne
  • 3,919
  • 6
  • 31
  • 37
53
votes
3 answers

Which tag should be used as paragraph separator in Javadoc?

Which is the more appropriate HTML tag for breaking up paragraphs/long sections of javadoc so according to best practices? Is it

or
? Why?

Tom Tresansky
  • 19,364
  • 17
  • 93
  • 129
52
votes
5 answers

Adding author name in Eclipse automatically to existing files

Is there a real easy to use tool (no monster tool) that I can plug into Eclipse, and press a "generate header" button and then the authors name appears in every file in that project?
Franz Kafka
  • 10,623
  • 20
  • 93
  • 149
52
votes
5 answers

JavaDoc: where to add notes/remarks to documentation?

When coding in C# I have always found the tag remarks very useful for providing notes about the implementation of a class or method, or to give information about the theory of what I was implementing. I am now using Java but I can't find an…
tunnuz
  • 23,338
  • 31
  • 90
  • 128
52
votes
3 answers

In javadoc, what is the difference between the tags @throws and @exception?

Take the following implementation of a array-based stack of chars for example: public char peek() throws Underflow { if (!isEmpty()) { return stack[pos]; } else { throw new Underflow("Peeking at an empty stack."); …
jon2512chua
  • 1,062
  • 3
  • 14
  • 26