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

final treatment of anonymous classes not marked in .class files?

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.4.1
    • specification
    • x86
    • windows_2000

      Name: gm110360 Date: 11/11/2002


      FULL PRODUCT VERSION :
      jdk 1.4.1 and earlier versions

      FULL OPERATING SYSTEM VERSION :
      Win2000

      A DESCRIPTION OF THE PROBLEM :
      jls states, that anonymous classes are implicit final.
      But it seems, the class-files are not marked as such.
      An anonymous class is compiled to a separate class-file
      named like SomeClass$1 . When I open this class-file with
      JBuilder, it is (somewhat) decompiled, but shows no 'final'
      modifier.
      Nothing prevents me to compile and run something like:
       Object o = new SomeClass$1() {};
      in another class in the same package.
      I think, this is not intended. I don't have headache from
      this - but I just want to be sure, that the VM can
      immediatly use the fact, that an anonymous class (and it's
      methods) is final, without too much 'hotspotting'.
      Typical application of anonymous classes like comparators
      would immediatley benefit from this.
      I propose to explicitly mark class files compiled from
      anonymous classes as 'final'.



      REPRODUCIBILITY :
      This bug can be reproduced always.
      (Review ID: 166886)
      ======================================================================

            abuckley Alex Buckley
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: