This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 268469 - Improve Hint for undocumented parameters in @NbBundle.Message
Summary: Improve Hint for undocumented parameters in @NbBundle.Message
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-11 14:21 UTC by jmborer
Modified: 2016-10-11 14:27 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jmborer 2016-10-11 14:21:49 UTC
I looked at the code of org.netbeans.modules.openide.util.NbBundleProcessor where the @Messages annotation is transformed into Bundle.java

As far as I understand, for each key/value pair, the comments preceding the declaration are added to a map associated with the pair. Later on, they are parsed. If the comment matches the following regex "# [{](\\d+)[}] - (.+)", it is supposed to be used to document the Bundle.java java doc.

So for my example, it fixed the warnings when I used:

@NbBundle.Messages({"# {0} - name",
                        "# {1} - site",
                        "LBL_Name=Repository {0} ({1})"})

and in the generated Bundle.java, I get:
    /**
     * @param name name
     * @param site site
     * @return <i>Repository </i>{@code name}<i> (</i>{@code site}<i>)</i>
     * @see RepositoryNode
     */
    static String LBL_Name(Object name, Object site) {
        return org.openide.util.NbBundle.getMessage(Bundle.class, "LBL_Name", name, site);
    }

 Even if examples can be found at http://bits.netbeans.org/dev/javadoc/org-openide-util/org/openide/util/NbBundle.Messages.html the expression is very sensible to spaces. You can easily oversee the problem like here:

@NbBundle.Messages({"# {0} - name",
                        "# {1}  - site",
                        "LBL_Name=Repository {0} ({1})"})

There are double spaces between the end brace and dash on the second line)

The hint should explain the format to use for comments (or provide an example) or even better generate/fix the comments as it does for the missing params in the Javadoc.