Results 1 to 5 of 5

Thread: classes with constructor-args instantiated twice

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    3

    Default 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. #2
    Join Date
    Oct 2008
    Location
    Belgium
    Posts
    160

    Default

    Strange, this should not be the case normally. I will look into this. Thanks for reporting.
    Christophe Herreman
    Spring ActionScript Founder
    http://www.herrodius.com

  3. #3
    Join Date
    Oct 2008
    Location
    Belgium
    Posts
    160

    Default

    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
    Christophe Herreman
    Spring ActionScript Founder
    http://www.herrodius.com

  4. #4
    Join Date
    Mar 2009
    Posts
    3

    Default

    Hi Christophe,

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

    Best regards - Nils.

  5. #5
    Join Date
    Feb 2009
    Location
    California
    Posts
    8

    Default

    Jürgen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •