jenkinsci / groovy-sandbox

(Deprecated) Compile-time transformer to run Groovy code in a restrictive sandbox
MIT License
123 stars 60 forks source link

[JENKINS-69899] Do not visit EmptyExpression when transforming fields declared using @Field #94

Closed dwnusbaum closed 1 year ago

dwnusbaum commented 1 year ago

See JENKINS-69899.

When @Field is used on a declaration like String foo that does not initialize the variable, the FieldNode created by FieldASTTransformation has an initial value that is EmptyExpression rather than null, which is normally the case when declaring fields in a class without using @Field. This causes issues with 520243213bcd8c81322e8e683daa8d555bb4f484, because we insert a checked cast for EmptyExpression, which ends up breaking class generation.