Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are tags like @param and @return in IntelliJ IDEA?

I've just started using IntelliJ IDEA for Java programming and I'm seeing tags (are they called tags?) like @param and @return. What is the significance of these tags? IntelliJ actually complains if I don't have those tags in my code!

What are the most important ones to know and what are they used for?

I couldn't find anything relevant in the IntelliJ documentation regarding these tags.

like image 639
InvalidBrainException Avatar asked Oct 09 '11 13:10

InvalidBrainException


People also ask

What does @param mean in Javadoc?

Javadoc comments for public methods, constructors and generic classes should use the @param tag to describe the available parameters and type parameters. If the comment includes any empty, incorrect or outdated parameter names then this will make the documentation more difficult to read.

What is @param used for?

Overview. The @param tag provides the name, type, and description of a function parameter. The @param tag requires you to specify the name of the parameter you are documenting. You can also include the parameter's type, enclosed in curly brackets, and a description of the parameter.

How do I auto generate comments in IntelliJ?

Add a Javadoc using automatic commentsType /** before a declaration and press Enter . The IDE auto-completes the doc comment for you.

How do I list methods in IntelliJ?

By default, IntelliJ IDEA shows all classes, methods, and other elements of the current file. To toggle the elements you want to show, click the corresponding buttons on the Structure tool window toolbar.


1 Answers

Yes, they are called tags. If you see those tags in the comments, they are to document your method's parameters and return value.

They can be automatically processed to generate JavaDoc documentation. The generated documentation will be similar to the the Java API Documentation. See how to write doc comments for the JavaDoc tool.

like image 153
stivlo Avatar answered Nov 14 '22 22:11

stivlo