1

コードには存在しないのに、デフォルトのコンストラクターが常に javadoc ドキュメントに表示されるのはなぜですか?

考えられる解決策の1つは、デフォルトのコンストラクターを明示的に記述し、「内部使用のみ」などのコメントを追加することです.

ありがとう

4

1 に答える 1

2

http://docs.oracle.com/javase/tutorial/java/javaOO/constructors.htmlによると:

The compiler automatically provides a no-argument, default constructor for any class without constructors

つまり、デフォルトのコンストラクターはコンパイル時に暗黙的に追加されます。その時点で、javadoc を取得すると、既に追加されています。これはhttp://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#defaultconstructorsで指定されています:

Section 8.8.7 of the Java Language Specification, Second Edition describes a default constructor: If a class contains no constructor declarations, then a default constructor that takes no parameters is automatically provided. It invokes the superclass constructor with no arguments. The constructor has the same access as its class.
The Javadoc tool generates documentation for default constructors. When it documents such a constructor, Javadoc leaves its description blank, because a default constructor can have no doc comment. 
于 2013-07-17T19:56:00.937 に答える