Skip to content

class with constructor marked @private is ignored #958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
myphysicslab opened this issue Mar 19, 2015 · 2 comments
Closed

class with constructor marked @private is ignored #958

myphysicslab opened this issue Mar 19, 2015 · 2 comments

Comments

@myphysicslab
Copy link

A common pattern for a utility class is to have a @Private constructor (so that no instance can be made) and public static methods. JSDoc decides to not show the entire class in this case (when --access is set to not include private).

Additionally, the @classdesc needs to still appear for such a class, even though the constructor itself should not appear (when private access is turned off).

My current workaround is to not mark the constructor with @Private, and make the body of the constructor just throw an exception. But when reading the documentation it now looks like you can instantiate these classes. I can add a description explaining this, or add a @throws tag to the constructor, but far better is to just not show the constructor.

@myphysicslab
Copy link
Author

FYI, adding a @throws tag to the constructor is looking like a good enough workaround for me -- plus it allows the @classdesc to appear (and other tags like @todo, @author).

@hegemonic
Copy link
Contributor

Duplicate of #952.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants