Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6785571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:08:35+00:00 2026-05-26T17:08:35+00:00

How liberally should I use @throws in my javadoc, or any API? For instance,

  • 0

How liberally should I use @throws in my javadoc, or any API? For instance, if I have:

LDAPException
NullPointerException
IllegalArgumentException
Exception

Should I be using @throws for each one, or should I just say @throws Exception?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:08:35+00:00Added an answer on May 26, 2026 at 5:08 pm

    Ideally, the javadoc @throws clauses should be a superset of your actual method throws clause.

    For example, if your method throws IOException, you may not only have a @throws IOException to explain situations when a generic I/O error occurs, but also @throws FileNotFoundException (a subclass of IOException) to talk about why that may happen.

    Likewise, you may document @throws NullPointerException to state when this may occur, even if you don’t declare throws NullPointerException, since it’s an unchecked exception and does not need to be (and generally is not) written in the method signature.

    Should you @throws Exception? No, but, more generally you should not throws Exception. That’s a different discussion. But as a result, no, it would not be good to repeat this sort of bad practice in javadoc. What would it talk about — the different exceptions that can occur? then why not document them one by one with @throws anyway?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am just getting started using any DI/IoC toolset and have a very basic
I have an application that uses AJAX liberally. I have several places where a
I have a parameter for a method, that should be a string and I
I'm creating a form where the user should be able to enter any text
I'm using MySQLdb, I use: cursor.execute(QUERY) Where QYERY is: INSERT (A,B,C) VALUES(%s,%s,something);'%(k1, u'W')** w
Is there any valid use for javascript's encodeURI function? As far as I can
If you have binary strings (literally String objects that contain only 1's and 0's),
I have a string which follows literally : lt;img src=quot;http://www.news.gov.tt/thumbnail.php?file=Hon__Jerry_Narace_Minister__Of_Health_599152837.jpgamp;size=summary_mediumquot;gt;lt;pgt;Fifty-eight people have been tested
In my career I have seen literally dozens of ways that people choose to
I've been trying to track this one for literally a month now without any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.