I have refactored a class and moved some code from the constructor to a static initializer. What should I do with the javadoc that was on the constructor? Is it possible to add javadoc to a static initializer?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
First and foremost, it’s arguable if static initializers are good practice to start with.
If you decide to use them nevertheless, I’d add the documentation to the JavaDoc at the class level. Static initializers can, depending on how they’re implemented, cause side-effects. If you use static initializers with side-effects, the behaviour should be documented for the consumer of said class.