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

Simple switch statement with large case values gives OutOfMemoryError in javac

XMLWordPrintable

    • merlin
    • generic, x86
    • generic, windows_nt, windows_2000
    • Verified



      Name: tb29552 Date: 09/05/2000


      /*
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      javac causes an OutOfMemoryError if compiling the following simple class:

      */
      public class SwitchTest {
          public static final int MEMENTO_NULL = 0x7FFFFFFD;
          public static final int MEMENTO_ALLE = 0x7FFFFFFE;
          public static final int MEMENTO_LEER = 0x7FFFFFFF;

          public static void main(String[] argv) {
              int i = MEMENTO_LEER;
              switch (i) {
              case MEMENTO_NULL:
                  System.out.println("Null");
                  break;

              case MEMENTO_ALLE:
                  System.out.println("Alle");
                  break;

              case MEMENTO_LEER:
                  System.out.println("Leer");
                  break;
              }
          }
      }
      /*

      The exact error message is:

      The system is out of resources.
      Consult the following stack trace for details.

      java.lang.OutOfMemoryError
              <<no stack trace available>>
      */

      (Review ID: 109269)
      ======================================================================

            gafter Neal Gafter (Inactive)
            tbell Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: