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 212800 - UseNbBundleMessages should warn about parameter count mismatch
Summary: UseNbBundleMessages should warn about parameter count mismatch
Status: NEW
Alias: None
Product: apisupport
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.2
Hardware: PC Linux
: P4 normal (vote)
Assignee: Martin Kozeny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-21 18:47 UTC by Jesse Glick
Modified: 2013-08-09 12:20 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2012-05-21 18:47:15 UTC
E.g. in org.netbeans.modules.project.ui.actions.Actions:

NbBundle.getMessage(Actions.class, "LBL_RunMainProjectAction_Name")

with Bundle.properties:

LBL_RunMainProjectAction_Name=&Run {0,choice,-1#Main Project|0#Project|1#Project ({1})|1<{0} Projects}

cannot (currently) be converted to @Messages since getMessage is expected to return an unsubstituted format string. So the hint should just produce a warning in this case, and not try to replace it.

In the future it might be nice for @Messages to have a way to suppress parameter generation for certain strings. Or, in this case, MainProjectAction could take a plain name (0 -> "&Run Project") in its constructor, and have overridable methods with Java parameters for other variants (-1, 1, 1<). In any event, the hint should still be made more robust.