Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-4876

Incorrect "Malformed format string" hint for numbers in java.text.MessageFormat

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersLinkUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • java - Hints
    • None

    Description

      Following code produces warning "Argument 0 is not a number":

       

      java.math.BigDecimal bigDecimal = java.math.BigDecimal.ONE;
      java.text.MessageFormat.format("{0,number,#0.00}", bigDecimal);

       

      That is incorrect, because java.math.BigDecimal is a subclass of java.lang.Number. It's not limited to java.math.BigDecimal, as all non-primitive arguments produce the same warning.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            Eugene Beldy Eugene Beldy

            Dates

              Created:
              Updated:

              Slack

                Issue deployment