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

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

    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

          People

            Unassigned Unassigned
            Eugene Beldy Eugene Beldy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: