Announcement Announcement Module
Collapse
No announcement yet.
classes with constructor-args instantiated twice Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • classes with constructor-args instantiated twice

    Hi all,

    I'm just starting out with Spring AS and there's something that's puzzling me:

    When you specify constructor arguments (via 'constructor-arg'), an instance of the class is initially created with all arguments set to 'null'. This instance is discarded and not returned by getObject(), so I'm not sure why it's being created in the first place.

    This happens whether or not the instantiation is lazy or the class is defined as a singleton.

    Here's some trace output from a test class constructor:

    WithArgs constructor
    Arg 1: null
    Arg 2: null

    WithArgs constructor
    Arg 1: First constructor arg
    Arg 2: Second constructor arg

    Is there a reason for the first instantiation or is this a glitch in the system?

    I'm really enjoying Spring AS, thanks for all the work!

    - Nils.

  • #2
    Strange, this should not be the case normally. I will look into this. Thanks for reporting.

    Comment


    • #3
      The reason we instantiate the class with null arguments is to work around a bug in describeType. I can understand that this might cause unwanted side effects so I'll see if we can come up with another solution.

      Here's the bug btw: http://bugs.adobe.com/jira/browse/FP-183

      regards,
      Christophe

      Comment


      • #4
        Hi Christophe,

        thanks for looking into it and providing further information, that's much appreciated.

        Best regards - Nils.

        Comment


        • #5
          See the patch I posted with http://code.google.com/p/as3reflect/...detail?id=6#c0

          Comment

          Working...
          X