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

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 7
    • specification
    • x86
    • windows_7

      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.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: