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

Compiler should not generate code for "dead" local classes.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 1.4.0
    • 1.2.0
    • tools
    • beta
    • generic
    • solaris_2.5.1
    • Verified

      The compiler currently generates code for local classes, even when they appear in the "dead" branch of an if statement:

      public
      class DeadClass {
          String msg = "test";

          DeadClass() {
      if (false) {
      class Foo {
      void method() {
      System.out.println(msg);
      }
      }
      new Foo().method();
      }
          }

          public static void main(String[] args) {
      new DeadClass();
          }
      }

            gafter Neal Gafter (Inactive)
            tturnidgsunw Todd Turnidge (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: