Implicit getters strong typed in metadata to string

Description

If any CFC declares implicit getters like so

/** * The LogBox object linkage */ property name="logbox";

When you get the metadata for the getter: `getMetadata( this ).getLogBox` the return type for the function is hard coded to string. Actually, all getters are hard coded to string in the metadata definition.

However, when used, they are not evaluated as strings and execution works. However, all libraries that rely on this metadata for AOP, method generations, mocking, and testing all fail. Because the metadata is hard coded as string. Adobe set's this correctly to either the property type or any as the default

Environment

None

Attachments

3
  • 19 Jul 2022, 03:22 pm
  • 19 Jul 2022, 03:22 pm
  • 19 Jul 2022, 03:22 pm

Activity

Show:

Pothys - MitrahSoft 21 July 2022 at 07:23

I've checked this ticket with the lucee latest version 5.3.10.28-SNAPSHOT. Yes, implicit getters properties returnType and component metaData implicit getters functions returnType is always string in the getMetaData result. Seems ACF returns the correct return type in the getMetaData result.

Maybe the problem is that creating the new UDFGetterProperty sets the return type as a string. I think it should be the type of property rather than a string.

https://github.com/lucee/Lucee/blob/ae748ee55c4763d0918c2ff6327b4d6d6a2e512e/core/src/main/java/lucee/runtime/type/UDFGetterProperty.java#L38

I added a testcase to this ticket
Pull request: https://github.com/lucee/Lucee/pull/1710

Luis Majano 19 July 2022 at 15:37

Michael Born @ Ortus 19 July 2022 at 15:24

Here’s a quick-and-dirty test case:

// MyComponent component accessors="true"{ property name="reviewers" type="array"; public function init(){ return this; } } // index.cfm... theTest = new MyComponent(); writeDump( getMetadata( theTest[ "getReviewers" ] ) );

Michael Born @ Ortus 19 July 2022 at 15:22

I just ran across this issue - three years later, still not solved!

Attaching a simple test case.

See also comparison screenshots with ACF 2018 and Lucee 5.3.10:

Details

Assignee

Reporter

Priority

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Created 15 April 2019 at 21:44
Updated 22 July 2022 at 14:17

Flag notifications