tracker issue : CF-4182565

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

Allow cfproperty default to be a CFML expression

| View in Tracker

Status/Resolution/Reason: To Fix//Investigate

Reporter/Name(from Bugbase): Bradley Wood / Bradley Wood (Bradley Wood)

Created: 08/19/2016

Components: Language

Versions: 2016

Failure Type: Enhancement Request

Found In Build/Fixed In Build: CF2016_Final /

Priority/Frequency: Trivial / Unknown

Locale/System: English / Platforms All

Vote Count: 6

The default attribute of the cfproperty tag requires a string. Allow CF expressions to match the way the default attribute of the cfargument tag works.

component accessors=true {

  // This is just a string
  property name='myString' default='[1,2,3]' type='string';

  // This will actually be an array
  property name='myArray' default='#[1,2,3]#' type='array';

  /**
  * This will actually be a struct
  * @default #{ foo : 'bar' }#
  */
  property name='myStruct' type='struct';
  
}

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

Watson Bug ID:	4182565

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

Attachments:

Comments:

https://luceeserver.atlassian.net/browse/LDEV-971
Comment by External U.
1978 | August 19, 2016 01:19:06 PM GMT
Came across the same issue/block today, with rather unhelpful error messages: component { property name="Name" type="struct" default="#{}#" ; } Error I receieved was "Unable to find an operator implementation for coldfusion.compiler.ASTStructInitializer" with no hint as to line/file that caused the problem. I tried variations such as "default="#structNew()#"" to no avail. The only hint that CF gave me that an empty struct/array was not allowed was when I tried the same type of property but of array type, using the full "arrayNew" notation, which gave me "Expression in cfproperty value must have a constant value." error. Definitely should be allowed to have a default cf expression in such cases, instead of needing to manually set on init.
Comment by Thomas H.
1979 | June 22, 2017 01:15:59 PM GMT
+1 for sure! I'd asked about this on CF-3352745, but Adobe never responded.
Vote by Aaron N.
1980 | February 22, 2018 04:27:36 AM GMT