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
2,987
questions
1014
votes
3
answers
593k
views
How to reference a method in javadoc?
How can I use the @link tag to link to a method?
I want to change:
/**
* Returns the Baz object owned by the Bar object owned by Foo owned by this.
* A convenience method, equivalent to getFoo()....
915
votes
4
answers
313k
views
Linking to an external URL in Javadoc?
Something like:
/**
* See {@linktourl http://google.com}
*/
624
votes
18
answers
258k
views
Multiple line code example in Javadoc comment
I have a small code example I want to include in the Javadoc comment for a method.
/**
* -- ex: looping through List of Map objects --
* <code>
* for (int i = 0; i < list.size(); i++) {
...
513
votes
11
answers
330k
views
How to see JavaDoc in IntelliJ IDEA? [duplicate]
I just switched from Eclipse to IntelliJ. IntelliJ lacks one feature from Eclipse - when you put your mouse over a method, Eclipse shows javadoc info. I think the way to show it is to use a shortcut ...
399
votes
5
answers
171k
views
How to add reference to a method parameter in javadoc?
Is there a way to add references to one or more of a method's parameters from the method documentation body?
Something like:
/**
* When {@paramref a} is null, we rely on b for the discombobulation.
...
345
votes
19
answers
229k
views
Maven is not working in Java 8 when Javadoc tags are incomplete
Since I use Maven I have been able to build and install in my local repository projects that have incomplete Javadoc tags (for example, a missing parameter).
However, since I migrated to Java 8 (1.8....
336
votes
3
answers
372k
views
Javadoc link to method in other class
Currently I'm referencing methods in other classes with this Javadoc syntax:
@see {@link com.my.package.Class#method()}
And in what I understand from the documentation this is the correct way to do ...
257
votes
12
answers
80k
views
How to attach javadoc or sources to jars in libs folder?
New version of ADT r17 plugin for Eclipse added feature to automatically setup JAR dependencies. Any .jar files in the /libs folder are added to the build configuration now. Unfortunately Android ...
247
votes
19
answers
191k
views
How to generate javadoc comments in Android Studio
Can I use shortcut keys in Android studio to generate javadoc comments?
If not, what is the easiest way to generate javadoc comments?
237
votes
1
answer
94k
views
Javadoc: package.html or package-info.java
When trying to create package level Javadoc comments, whats the preferred method? What do you do?
package-info.java
Pros
Newer
Cons
Abuse of a class - Classes are for code, not for only comments
...
220
votes
5
answers
38k
views
codestyle; put javadoc before or after annotation?
I know that it isn't the most vital of issues, but I just realised that I can put the javadoc comment block before or after the annotation. What would we want to adopt as a coding standard?
/**
* ...
218
votes
9
answers
301k
views
/** and /* in Java Comments
What's the difference between
/**
* comment
*
*
*/
and
/*
*
* comment
*
*/
in Java? When should I use them?
215
votes
5
answers
50k
views
How can you escape the @ character in javadoc?
How can I escape the @ symbol in javadoc? I am trying to use it inside a {@code} tag, which is inside <pre> tags.
I already tried the html escape @ sequence, but that didn't work.
213
votes
5
answers
546k
views
How can I generate Javadoc comments in Eclipse? [duplicate]
Is there a way to generate Javadoc comments in Eclipse? If so, what is it?
213
votes
4
answers
120k
views
Javadoc @see or {@link}?
Could someone tell me the difference between javadoc @see and {@link}?
Or rather, when to use which of them?
211
votes
3
answers
66k
views
How Do I Document Packages in Java?
In the Java APIs I can see Javadoc comments for packages.
How/where do I place Javadoc comments to document a package?
195
votes
3
answers
201k
views
What is the IntelliJ shortcut key to create a javadoc comment?
In Eclipse, I can press Alt+Shift+J and get a javadoc comment automatically generated with fields, returns, or whatever would be applicable for that specific javadoc comment. I'm assuming that ...
191
votes
3
answers
67k
views
Is there a javadoc tag for documenting generic type parameters?
I've been looking through the javadoc documentation on Sun's site, trying to find if there's a javadoc tag which can be used to document a class or method's generic type signature.
Something like @...
188
votes
18
answers
170k
views
Get source jar files attached to Eclipse for Maven-managed dependencies
I am using Maven (and the Maven Eclipse Integration) to manage the dependencies for my Java projects in Eclipse. The automatic download feature for JAR files from the Maven repositories is a real time ...
177
votes
8
answers
99k
views
Change Author template in Android Studio
I want to change the automatic author that appears when I create a file in AndroidStudio.
/**
* Created by a556520 on 16/01/14.
*/
public class POI {
The author takes 'a556520' but I want that ...
177
votes
4
answers
114k
views
Using javadoc for Python documentation [closed]
I am currently beginning with Python and I have a strong PHP background and in PHP I have took the habit of using javadoc as a documentation template.
I was wondering if javadoc has its place as ...
166
votes
4
answers
333k
views
How to generate Javadoc HTML files in Eclipse?
I have written Javadoc style comments like this in my project's code:
/**
* Description...
*
* @param ...
* @return .....
*/
How can I generate Javadoc HTML files using the Eclipse IDE?
163
votes
4
answers
38k
views
Android Studio: Javadoc is empty on hover
I have moved from Eclipse to Android Studio recently, and am liking it. However, I miss the Javadoc on hover feature from Eclipse.
I followed the instructions here to add the functionality, however, ...
154
votes
11
answers
359k
views
good example of Javadoc [closed]
is there a good example of a source file containing Javadoc?
I can find lots of good examples of Javadoc on the internet, I would just like to find out the particular syntax used to create them, and ...
149
votes
10
answers
64k
views
How can I use "<" and ">" in javadoc without formatting?
If I write <xmlElement> in a javadoc, it does not appear, because tags have special functions on formatting texts.
How can I show this chars in a javadoc?
148
votes
3
answers
53k
views
How to @link to a Enum Value using Javadoc
Using Javadoc 1.5, I have been unable to create a @link to an Enumeration value.
What I would like to do is to create an Enum like this:
public enum Planet {
/**
* MERCURY is a fun place.
*/
...
143
votes
14
answers
89k
views
Simple Getter/Setter comments
What convention do you use to comment getters and setters? This is something I've wondered for quite some time, for instance:
/**
* (1a) what do you put here?
* @param salary (1b) what do you put ...
141
votes
5
answers
215k
views
Usage of @see in JavaDoc?
When do I use @see when dealing with JavaDocs? What is its usage?
For example if MethodA calls MethodB then do I have to put @see in MethodB's javadoc and reference MethodA because that is what ...
138
votes
4
answers
105k
views
How to create multiple levels of indentation in Javadoc?
Suppose, that as part of documenting your code (Javadoc) you want to indicate that the relationships between elements using deep indentation.
How can I create a nested list as:
some element
some ...
137
votes
3
answers
49k
views
Intellij IDEA show javadoc automatically
When I am coding at Netbeans it autocompletes the code and show Javadocs. However when I am using Intellij IDEA if I click Ctrl+Space I can see the auto-complete and if I click Ctrl+Q I can see the ...
128
votes
6
answers
164k
views
Autocompletion of @author in Intellij
I'm migrating from Eclipse to Intellij Idea. One thing I couldn't figure out yet is autocompletion of the @author JavaDoc tag.
When typing @a in Eclipse, there are two proposals:
@author - author ...
128
votes
1
answer
61k
views
How can I reference the value of a final static field in the class?
Using JavaDoc, how can I reference the value of a final static field in the class?
I want the ??? in this example replaced by the value of the field STATIC_FIELD.
/**
* This is a simple class with ...
128
votes
5
answers
60k
views
How do I change the Javadocs template generated in Eclipse?
I dislike the default Javadocs generated for me when I create a Class or methods, especially the @author variable, which is the current system username on my windows box.
I would like to change it. ...
125
votes
4
answers
85k
views
Netbeans: how to change @author
When creating a new class or interface in Netbeans IDE, an "@author ...." tag appears. How to change its value? If possible, I would like to change it by using Netbeans menu and not by editing some ...
125
votes
2
answers
107k
views
How to link javadoc to private field? [duplicate]
how can I make a javadoc link to a private field?
class Foo {
private String bar;
public String getBar() { return bar; }
}
{@link Foo#getBar()} works.
{@link Foo#bar} doesn't.
124
votes
7
answers
79k
views
Should Javadoc comments be added to the implementation?
Is it correct practice to add Javadoc comments in the interface and add non-Javadoc comments in the implementation?
Most IDEs generate non-JavaDoc comments for implementations when you auto generate ...
115
votes
1
answer
108k
views
Details of difference between @see and @inheritDoc
I have looked over JavaDoc reference, and while I understand basic difference between @see (various links) and {@inheritDoc} (export of superclass JavaDoc comment), I need clarification on how things ...
108
votes
13
answers
22k
views
Android Studio quick documentation always "fetching documentation"
I just moved to Android Studio from Eclipse, and I found that it always shows "fetching documentation" when I use quick documentation (Ctrl+Q).
How can I solve this problem?
I downloaded the ...
105
votes
7
answers
147k
views
Javadoc: line breaks without HTML-tags?
Sorry for a probable FAQ kind of question, but I just can't find the answer.
As far as I remember Eclipse, a blank line in a Javadoc comment is displayed (in in-source Javadoc popups) as a line break ...
103
votes
4
answers
120k
views
How to write Javadoc of properties?
I often find myself with a dilemma when writing javadoc for properties/members of a "simple" POJO class holding only properties and getters and setters (DTO-style)....
1) Write javadoc for the ...
101
votes
3
answers
88k
views
How to Javadoc a Class's Individual Enums
I am writing the Javadoc for a class that contains its own enums. Is there a way to generate Javadoc for the individual enums? For example, right now I have something like this:
/**
* This documents &...
101
votes
4
answers
23k
views
Javadoc reuse for overloaded methods
I'm developing an API with many identically named methods that just differ by signature, which I guess is fairly common. They all do the same thing, except that they initialize various values by ...
86
votes
5
answers
27k
views
Should I use JavaDoc deprecation or the annotation in Java?
There are at the moment, two ways to mark code as depreacted in java.
Via JavaDoc
/**
* @deprecated
*/
Or as an annotation:
@Deprecated
This is my problem - I find it a bit too much to declare ...
84
votes
13
answers
136k
views
How to attach source or JavaDoc in eclipse for any jar file e.g. JavaFX?
Presently I'm working with JavaFX. Whenever I hover over a method of JavaFX its gives me the following error:
'Note: This element neither has attached source nor attached Javadoc and hence no ...
84
votes
12
answers
19k
views
Are there some good and modern alternatives to Javadoc? [closed]
Let's face it: You don't need to be a designer to see that
default Javadoc looks ugly.
There are some resources on the web which offer re-styled Javadoc. But the default behaviour represents the ...
84
votes
3
answers
9k
views
Missing iFrame view for Javadocs JDK 11+
I've been using the JavaDocs for JDK 11
But I've noticed that the iFrames view appears no longer to be available.
I've looked around, but can't see any details on why this has been done, and what the ...
83
votes
0
answers
133k
views
Where can I find the JDK documentation, and how can I read it offline? [duplicate]
I know how to read the Javadoc (JDK documentation) online on a website, but I want to download a copy to my computer so that I can read it offline when no Internet connection is available.
To be clear,...
82
votes
5
answers
67k
views
Eclipse how to link a jar containing javadocs/source with its binary?
I would like to have the javadoc comments contained in a jar file show in eclipse when I hover over a class.
For example, after downloading JODA-2.0, three jars are obtained:
joda-time-2.0
joda-time-...
78
votes
9
answers
98k
views
Javadoc @author tag good practices
I'm wondering about best practices when creating Javadocs. I have a project with many files. Code has been created by many developers. Each file has an annotation @author, so it is obvious who has ...
74
votes
3
answers
60k
views
Javadoc linking to a class in another package
I have two packages, Shapes and Fruits:
com.myproject.Shapes.
Circle
Square
Triangle
com.myproject.Fruits.
Apple
Orange
I am writing the JavaDoc for Apple and need to provide an {...