I'm trying to add a interface to a cfc that includes some functions in a cfml file however it throws a error with the message "component [...] does not implement the function [..] of the interface" the function it's complaining about is implemented in the included cfml file, i've tested this in both railo 4 and lucee 5 and get the same error in both but it works in coldfusion 11 does anyone know if there is a workaround or fix for this in lucee or railo?
Below is example code that reproduces the error.
interface {
public numeric function func() output="false";
}
component implements="int" {
include "inc.cfm";
}
<cfscript>
public numeric function func() output="false"{
return 2;
}
</cfscript>
<cfscript>
cfc = createObject("component", "comp");
writedump(cfc.func());
</cfscript>
One possible workaround i've found is to replace the original cfc that includes the cfml file with an empty cfc that implements the interface but also extends the original cfc renamed to something else, by replacing original cfc you can keep the same type while also adding the interface. So the updated parts of the example with the question would look like this
component implements="int" {
include "inc.cfm";
}
component extends="comp-to-extend" implements="int" {}