Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

groovy static class

Tags:

groovy

What does the 'static' do in this file, sample.groovy?

static class froob {
}

The groovy code compiles fine with 'static' or without it.

like image 620
Bob Herrmann Avatar asked Mar 01 '23 18:03

Bob Herrmann


1 Answers

There is absolutely no difference. The static in this situation is ignored.

To test, I created a groovy class and piped the output of "javap -verbose StaticTest" to a file. Then put "static" before the class def and piped that to a 2nd file. I then diffed the two files. The only differences were those unique ids that are associated with the long class ID that gets generated new for every class.

like image 55
Ted Naleid Avatar answered Mar 13 '23 04:03

Ted Naleid