Bug 255626 - [javadoc] Compiler may flag ignored javadoc comments
Summary: [javadoc] Compiler may flag ignored javadoc comments
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-18 07:01 EST by Frederic Fusier CLA
Modified: 2022-08-30 06:31 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Fusier CLA 2008-11-18 07:01:47 EST
When a javadoc comment is misplaced in the code, it will be ignored by the javadoc tool while generating the documentation.

It could be interesting to warn users that there's a potential issue on this kind of comments. Of course, this warning would be controlled by a new Javadoc compiler preferences and would be disabled by default...

Bug 252555 and bug 254825 exhibit this behavior, but here's a typical test case merging all cases I have in mind:

/**
 * Package javadoc comment is ignored by the javadoc tool except for the 
 * specific package-info.java file...
 * 
 * Our compiler always parses it but intentionally does not report any warning
 * if the compilation unit is not package-info.java.
 */
package my.pack.age;

/**
 * Duplicate javadoc comments are ignored both by the javadoc tool and by our
 * compiler.
 */
/**
 * Only the last javadoc comments is used while generating the documentation
 * or parsed by our compiler.
 */
public class Test {

    class X {
        /**
         * Javadoc comments in member types are not ignored by javadoc tool.
         * 
         * It's parsed and resolved as well by our compiler.
         */
        void foo() {}
    }
    Object foo(Object o) {
        class Y {
            /**
             * Local types are ignored by javadoc tool, hence javadoc comments
             * defined there are not included in the generated doc.
             * 
             * However, our compiler parsed and resolved these javadoc
             * comments.
             */
            void foo() {}
        }
        /**
         * Statements are ignored by javadoc tool, hence javadoc comments
         * defined there are not included in the generated doc.
         * 
         * There are neither parsed nor resolved by our compiler.
         */
        return new Object() {
            /**
             * Anonymous classes are ignored by javadoc tool, hence javadoc 
             * comments defined there are not included in the generated doc.
             * 
             * However, our compiler parsed and resolved these javadoc
             * comments.
             */
            void x() {}
        };
    }
}
Comment 1 Markus Keller CLA 2008-11-18 09:59:20 EST
Note that this would flag every compilation unit in Eclipse, since they all have the copyright header in front of the package declaration. I think we need an exception for the header comment, given that we already 'standardized' this with setting in the code formatter and Java editor folding.
Comment 2 Frederic Fusier CLA 2008-11-18 10:28:06 EST
(In reply to comment #1)
> Note that this would flag every compilation unit in Eclipse, since they all
> have the copyright header in front of the package declaration. I think we need
> an exception for the header comment, given that we already 'standardized' this
> with setting in the code formatter and Java editor folding.
> 
Or we could avoid to report the warning when the javadoc comment does not contains any tags. This warning is more to inform the user that no verification is done in such a comment rather that let him or her know that it won't be generated while using the javadoc tool...
Comment 3 Eclipse Genie CLA 2020-06-27 17:08:34 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 4 Eclipse Genie CLA 2022-08-30 06:31:50 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.