Regression: Invalid "member is set to final" error on static property when code changes

Description

I have a stand-alone repro case defined here: https://github.com/adamcameron/cfml/tree/lucee_static_final_bug_improved/vendor/lucee/staticFinal. There’s a docker run statement in the readme.md to get it cranked up, but I will reproduce here for searchability. Code (all file go in same subdir):

// Application.cfc component {} // Base.cfc component { include "include.cfm"; } // C.cfc component extends=Base { static { final static.MAORI_NUMBERS = ["tahi", "rua", "toru", "wha"] } } // include.cfm <cfscript> public function build() { return this; } </cfscript> // test.cfm <cfinvoke component="C" method="build" returnVariable="o"> <cfdump var="#o#">

 

Repro:

1. Grab the files from this directory, stick them somewhere (doesn't matter where)

2. Run a Lucee container in that directory, eg:

docker run \ --publish 8888:8888 \ --volume ${PWD}/:/var/www/ \ --name lucee-static-final-bug \ --detach \ lucee/lucee:5.3.10.97-nginx

3. Browse to http://localhost:8888/test.cfm. You should see a <cfdump> of the C object.

4. Rename include.cfm to be anything else, eg: include2.cfm. Change the reference to it in Base.cfc as well. <--- THIS IS THE CRITICAL BIT!!

5. Reload the page. I am seeing this:

Cannot update key [MAORI_NUMBERS] in static scope from component [C], that member is set to final The Error Occurred in /var/www/C.cfc: line 5 3: static { 4: final static.MAORI_NUMBERS = ["tahi", "rua", "toru", "wha"] 5: } 6: }

6. Revert to include.cfm. Refresh. Problem goes away.

Environment

None

Attachments

1
  • 08 May 2023, 01:02 pm

Activity

Show:

Pothys - MitrahSoft 9 June 2023 at 13:28
Edited

I've checked this issue with lucee version 6.0.0.448-SNAPSHOT & 5.4.0.75-SNAPSHOT. Now The issue has been solved and it works fine

Michael Offner 9 June 2023 at 13:07

test cases passes

Michael Offner 9 June 2023 at 12:22

problem is the static scope does not get flushed in case the base component changes.

when i remove “final“ and change the function in Base to this

public function build() { static[createUniqueID()]=now(); return this; }

it creates a new entry into static with every request, when i now modifiy the the Base code, this entries should all disapear, but they do not.

Michael Offner 9 June 2023 at 12:12

when i add a systemoutput to the static constructor from Base and C, i see that both are executed when the Base component was modified. what of course is a good thing. problem most likely is that C does not reconize the reload of the static scope and becuase of that complain about the change.

Fixed

Details

Assignee

Reporter

Priority

Fix versions

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

Sprint

Affects versions

Created 8 May 2023 at 12:06
Updated 9 June 2023 at 13:30
Resolved 9 June 2023 at 13:30

Flag notifications