tracker issue : CF-3972123

select a category, or use search below
(searches all categories and all time range)
Title:

initmethod is not inherited

| View in Tracker

Status/Resolution/Reason: To Fix//

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 04/19/2015

Components: Language

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Normal / Some users will encounter

Locale/System: English / Platforms All

Vote Count: 0

SSIA, really. See my blog article: 

http://blog.adamcameron.me/2015/04/cfml-initmethod-and-cfc-inheritance.html

Summary:

Code:

{code}
// P.cfc
component initmethod=constructor {

    function constructor(){
        writeOutput("P.constructor() ran<br>");
        return this;
    }
}


// C.cfc
component extends=P {

    function init(){
        writeOutput("C.init() ran<br>");
        return this;
    }

    function constructor(){
        super.constructor(argumentCollection=arguments);
        writeOutput("C.constructor() ran<br>");
        return this;
    }
}

// test.cfm
o = new C();
{code}

Expected:
P.constructor() ran
C.constructor() ran

Actual:
C.init() ran 

Raising this as a bug as it did not meet my expectations. I realise this is not documented (but not documented one way or the other), but I think it's a reasonable expectation to have.

Cheers.

-- 
Adam

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3972123

External Customer Info:
External Company:  
External Customer Name: Adam
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

Can you please confirm in what version of ColdFusion this is going to be implemented in. It says "to fix" but does not say which version.
Comment by External U.
7772 | January 25, 2016 08:20:46 AM GMT