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

Remove requirement for super() and this() to be 1st call in constructors

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 7
    • Fix Version/s: None
    • Component/s: specification
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_7

      Description

      A DESCRIPTION OF THE REQUEST :
      Requiring super() or this() to be the first call in a constructor is frustrating and does not prevent super methods being called on the object before it is fully constructed. This requirement offers no benefit and hinders developers.

      See this stack overflow post for detailed discussion:
      http://stackoverflow.com/questions/1168345/why-does-this-and-super-have-to-be-the-first-statement-in-a-constructor

      JUSTIFICATION :
      For example, I cannot revalidate arguments to my constructor prior to passing them to super.


      CUSTOMER SUBMITTED WORKAROUND :
      If you can squish your logic into a single mega-statement, try that.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                abuckley Alex Buckley
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: