Skip to content

Instantly share code, notes, and snippets.

@adamcameron
Last active August 20, 2021 15:48
Show Gist options
  • Save adamcameron/282be2ce74724fa740eafda3f37479cb to your computer and use it in GitHub Desktop.
Save adamcameron/282be2ce74724fa740eafda3f37479cb to your computer and use it in GitHub Desktop.
Demonstrating one cannot have a static final method in Lucee or ColdFusion
// C2.cfc
component {
public static final string function g() {
return getFunctionCalledName();
}
}
function keyword is missing in FUNCTION declaration.
The CFML compiler was processing:
A script statement beginning with public on line 4, column 5.
The error occurred in C:/apps/ColdFusion/2021/cfusion/wwwroot/public/test/final/C2.cfc: line 4
2 : component {
3 :
4 : public static final string function g() {
5 : return getFunctionCalledName();
6 : }
Missing [;] or [line feed] after expression
The Error Occurred in
/var/www/public/nonWheelsTests/final/C2.cfc: line 4
2: component {
3:
4: public static final string function g() {
5: return getFunctionCalledName();
6: }
<cfscript>
// testC2.cfm
writeDump(C2::g())
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment