Bug 83804 - [1.5][javadoc] Missing Javadoc node for package declaration
Summary: [1.5][javadoc] Missing Javadoc node for package declaration
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-27 04:32 EST by Martin Aeschlimann CLA
Modified: 2005-05-11 13:57 EDT (History)
2 users (show)

See Also:


Attachments
Patch to implement this functionality (32.30 KB, patch)
2005-04-22 13:53 EDT, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2005-01-27 04:32:02 EST
20050127

Look at the AST of the following code:
The package declaration should have the Javadoc node set (new in 5.0)

/**
 * 
 */
package pack;

public class E {

}
Comment 1 Christopher Oezbek CLA 2005-01-27 05:07:55 EST
I think the bug needs some more explanation. As there is only one file from 
which the documentation about the package should be taken, which should be 
called "package-info.java". Otherwise several .java files could override the 
package-javadoc.

References:
http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html#packagecomment

Example source (package-info.java):

/**
 * Provides the classes necessary to create an applet and the classes an  
applet uses
 * to communicate with its applet context.
 * <p>
 * The applet framework involves two entities:
 * the applet and the applet context. An applet is an embeddable window  
(see the
 * {@link java.awt.Panel} class) with a few extra methods that the applet  
context
 * can use to initialize, start, and stop the applet.
 *
 * @since 1.0
 * @see java.awt
 */
package testPackageInfo;
Comment 2 Martin Aeschlimann CLA 2005-01-27 05:53:15 EST
Jim, what was the reason for adding a Javadoc property to the package
declaration node? The link from comment 1 only mentions types, methods and
fields where Javadoc comments are recognized.
Comment 3 Jim des Rivieres CLA 2005-01-27 10:36:49 EST
The link in comment 1 shows this new wrinkle that was added in J2SE5.

In JLS3, package declarations can carry both annotations and a Javadoc 
comment. The only expected place for these is in a compilation unit 
named "package-info.java"; this file is expected to contain only a package 
declaration (i.e., no type decls); note that the name "package-info" is not 
even a legal identifier. "package-info.java" supercedes the 
old "package.html", which is less powerful because it cannot express 
annotations on packages.
Comment 4 Christopher Oezbek CLA 2005-01-27 11:58:16 EST
The problem reaches even more as reported so far. The annotation that can be 
defined for a package inside the package-info.java has to be attached to all 
package declarations inside this packages.

Example:

package-info.java:

/** Test Java Doc              // -> AST is missing JavaDoc
 */
@Deprecated package testJava5; // -> AST shows annotation correctly

test.java:

package testJava5;             // -> AST neighter shows annotation nor JavaDoc

public class test {

}

----

There is even a different bug at work here:

package-info.java:

@Deprecated package testJava5; // -> AST does not show annotation -> correct

test.java:

@Deprecated package testJava5; // -> AST will show annotation -> wrong

public class test {

}
Comment 5 Christopher Oezbek CLA 2005-01-27 12:00:31 EST
The last bug shows up as a compile error though (red circled x) in the code 
editor.
Comment 6 Frederic Fusier CLA 2005-03-16 11:05:16 EST
There's no API change for this...
Comment 7 Frederic Fusier CLA 2005-04-22 13:53:54 EDT
Created attachment 20251 [details]
Patch to implement this functionality

Note that this patch also cover implementation for bug 86380...
Comment 8 Frederic Fusier CLA 2005-04-22 14:05:13 EDT
Patch applied in HEAD.

Test cases added in JavadocTest_1_? classes + ASTConverterJavadocTest +
JavaSearchBugsTests + SelectionJavadocModelTests
Comment 9 Maxime Daniel CLA 2005-05-11 11:20:15 EDT
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.