Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-1419

don't generate unneeded references to outer objects in inner classes

    Details

      Description

      Currently (change set 16246 of trunk) named inner classes always contain a reference to their enclosing object, regardless of whether it is use or not. This is similar to the old behavior of anonymous inner classes as demonstrated in https://lampsvn.epfl.ch/trac/scala/ticket/854 . I think named inner classes should not retain a reference to the enclosing object if it is not required so that subtle memory leaks can be avoided.

        Attachments

          Issue Links

            Activity

            Hide
            moors Adriaan Moors added a comment -

            Bumping since this should not require a binary incompatible change.

            Show
            moors Adriaan Moors added a comment - Bumping since this should not require a binary incompatible change.
            Hide
            oscar Oscar Boykin added a comment -

            Adriaan, shouldn't it? There are classes that will have one fewer parameter in the constructor, no?

            Show
            oscar Oscar Boykin added a comment - Adriaan, shouldn't it? There are classes that will have one fewer parameter in the constructor, no?
            Hide
            moors Adriaan Moors added a comment -

            You're right, thanks! Since this has an implementation, I'll see if I can still PR that refinement I did a year ago... We do have to ship RC1 at some point, so no promises

            Show
            moors Adriaan Moors added a comment - You're right, thanks! Since this has an implementation, I'll see if I can still PR that refinement I did a year ago... We do have to ship RC1 at some point, so no promises
            Hide
            moors Adriaan Moors added a comment -

            Aha! Even better, Jason already fixed this in SI-9408 (Avoid capturing outer class in local classes.)

            Show
            moors Adriaan Moors added a comment - Aha! Even better, Jason already fixed this in SI-9408 (Avoid capturing outer class in local classes.)
            Hide
            nilskp Nils Kilden-Pedersen added a comment -

            Adriaan, is 9408 the same? It seems to be a change in capture, not an elimination.

            Show
            nilskp Nils Kilden-Pedersen added a comment - Adriaan, is 9408 the same? It seems to be a change in capture, not an elimination.

              People

              • Assignee:
                retronym Jason Zaugg
                Reporter:
                eengbrec Erik Engbrecht
                TracCC:
                Erik Engbrecht, Seth Tisue
              • Votes:
                11 Vote for this issue
                Watchers:
                20 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: