tracker issue : CF-3035231

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

Bug 71999:When creating a script based UDF, if you specify a return type of foo[], which means array of foo, you get a compiler error

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Raymond Camden / Raymond Camden (Raymond Camden)

Created: 06/17/2008

Components: Language

Versions: 9.0

Failure Type: Unspecified

Found In Build/Fixed In Build: 0000 / 215241

Priority/Frequency: Major / Most users will encounter

Locale/System: English / Platforms All

Vote Count: 0

Problem:

When creating a script based UDF, if you specify a return type of foo[], which means array of foo, you get a compiler error. Since script based UDFs are supposed to be exactly like their tag based counterparts, this  needs to be added. I didn't test - but I'd assumed it would break in the argument list as well.

And also the return type with dot notation doesnt work.
Method:

<-----test.cfc----->

<cfcomponent>
<cfscript>


public function func1()
{

return "this is func1";

}

</cfscript>

<cffunction name="hi">


<cfoutput> i am in cfc </cfoutput>

</cffunction>

</cfcomponent>

<----mytest.cfm----->


<!---<cffunction name="test1" returntype="test[]">
<cfset myobj = createobject("component","test")>
<cfreturn [myobj]>
</cffunction>--->

<cfscript>

test[] function test2()
{
myobj1=createobject("component","test");
return [myobj1];

} 


</cfscript>


<cfdump var="#test2()#">


the commented part has cffunction which works with return type=test[] but that doesnt work for function in cfscript.



--------------repro case for return type with dot notation------
<cfscript>
/**
* This is hint for the function
*
* @argname This is hint for the attribute
*
*/
public com.mysite.mycfc function init ()
{
return this;
}

</cfscript> 
Result:

 Invalid CFML construct found on line 9 at column 5.
ColdFusion was looking at the following text:

[

The CFML compiler was processing:

    * A script statement beginning with test on line 9, column 1.
    * A cfscript tag beginning on line 7, column 2.

 
The error occurred in C:\ColdFusionCentaur\wwwroot\71999\mytest.cfm: line 9

7 : <cfscript>
8 : 
9 : test[] function test2()
10 : {
11 : myobj1=createobject("component","test");

Resources:

    * Check the ColdFusion documentation to verify that you are using the correct syntax.
    * Search the Knowledge Base to find a solution to your problem.

Browser   	Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
Remote Address   	0:0:0:0:0:0:0:1
Referrer   	
Date/Time   	18-Jun-08 12:38 PM
Stack Trace


coldfusion.compiler.ParseException: Invalid CFML construct found on line 9 at column 5.
	at coldfusion.compiler.cfml40.generateParseException(cfml40.java:8406)
	at coldfusion.compiler.cfml40.jj_consume_token(cfml40.java:8277)
	at coldfusion.compiler.cfml40.functionDefinition(cfml40.java:1928)
	at coldfusion.compiler.cfml40.cfscriptStatement(cfml40.java:1445)
	at coldfusion.compiler.cfml40.cfscript(cfml40.java:1360)
	at coldfusion.compiler.cfml40.cfml(cfml40.java:2995)
	at coldfusion.compiler.cfml40.start(cfml40.java:3177)
	at coldfusion.compiler.NeoTranslator.parsePage(NeoTranslator.java:519)
	at coldfusion.compiler.NeoTranslator.translateJava(NeoTranslator.java:308)
	at coldfusion.compiler.NeoTranslator.translateJava(NeoTranslator.java:135)
	at coldfusion.runtime.TemplateClassLoader$TemplateCache$1.fetch(TemplateClassLoader.java:326)
	at coldfusion.util.LruCache.get(LruCache.java:180)
	at coldfusion.runtime.TemplateClassLoader$TemplateCache.fetchSerial(TemplateClassLoader.java:270)
	at coldfusion.util.AbstractCache.fetch(AbstractCache.java:58)
	at coldfusion.util.SoftCache.get(SoftCache.java:81)
	at coldfusion.runtime.TemplateClassLoader.findClass(TemplateClassLoader.java:492)
	at coldfusion.filter.PathFilter.invoke(PathFilter.java:79)
	at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
	at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
	at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
	at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
	at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
	at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
	at coldfusion.CfmServlet.service(CfmServlet.java:175)
	at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
	at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
	at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
	at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
	at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
	at jrun.servlet.FilterChain.service(FilterChain.java:101)
	at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
	at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
	at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
	at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
	at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
	at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
	at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
	at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
	at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

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

Watson Bug ID:	3035231

External Customer Info:
External Company:  
External Customer Name: Raymond Camden
External Customer Email: 5FBC41E943BD265C992015D5
External Test Config: 06/17/2008

Attachments:

Comments: