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

Large, negative, illegal int literals are not flagged as errors.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.2.0
    • 1.2.0
    • tools
    • 1.2beta4
    • generic
    • generic
    • Not verified


      allan.jacobs@Eng 1997-12-05
      Negative int literals that the specification says should cause
      a compile-time error are not rejected by JDK 1.2 javac.


      algol% cat irange1.java
      public class irange1 {
      public static void main(String[] argv) {
          int i1 = -2147483649; // error: -2147483549 out-of-range
          System.out.println(i1);
      }
      }

      With a JDK 1.1.4 compiler:
      pine% javac -d . irange1.java
      irange1.java:4: Numeric overflow.
          int i1 = -2147483649; // error: -2147483549 out-of-range
                    ^
      1 error


      With a JDK 1.2 compiler:
      algol% ${JSOFT}/javac -d . irange1.java
      algol% ${JSOFT}/java -verify irange1
      2147483647

      With JTG's exact-vm compiler (JDK 1.2):
      algol% /usr/java1.2e/bin/javac -d . irange1.java
      algol% /usr/java1.2e/bin/java -verify irange1
      2147483647

            tturnidgsunw Todd Turnidge (Inactive)
            ajacobssunw Allan Jacobs (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: