Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6277156

Compiler throws misleading error message when Long.MIN_VALUE and Integer.MIN_VALUE used with '--'

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Compiler throws misleading error message when Long.MIN_VALUE and Integer.MIN_VALUE used with '--'

      Please see the following code:
      <code>
      class Foo {
          public static void main(String... arg) {
              System.out.println(--9223372036854775808l);
              System.out.println(--2147483648);
          }
      }
      </code>
      Output when compiled
      <output>
      Test19.java:3: integer number too large: 9223372036854775808
              System.out.println(--9223372036854775808l);
                                   ^
      Test19.java:4: integer number too large: 2147483648
              System.out.println(--2147483648);
                                   ^
      2 errors
      </output>

      1)The above error message says 9223372036854775808l and 2147483648 as large integers though they are in the range. This is misleading to the user.

      Rather it can be like
      <output>
      Test19.java:3: unexpected type
      required: variable
      found : value
              System.out.println(--9223372036854775808l);

      Test19.java:4: unexpected type
      required: variable
      found : value
              System.out.println(--2147483648);
                                   ^
      2 errors
      </output>
      ###@###.### 2005-05-27 11:25:49 GMT

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            savadhansunw Seetharama Avadhanam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: