Skip to content
Discussion options

You must be logged in to vote

Yes, it seems to have changed in Groovy 5.

class Test {

  static foo = 'bar'
  
  def run(){
    [:].with {
      println foo
    }
  }
}

new Test().run()

That prints 'bar' in Groovy 4 and 'null' in Groovy 5.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jochenberger
Comment options

Answer selected by Vampire
@Vampire
Comment options

Vampire Mar 16, 2026
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants