Starting with Groovy 4.x, one cannot call interface static methods.
For example, with Groovy 4.0.16:
groovy:000> Random.getDefault().nextInt(10)
ERROR groovy.lang.MissingMethodException:
No signature of method: static java.util.Random.getDefault() is applicable for argument types: () values: []
And the same code with Groovy 3.0.9
groovy:000> Random.getDefault().nextInt(10)
===> 5
Both examples are run on Java 17, where the getDefault() method is part of the JDK, see https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/random/RandomGenerator.html#getDefault()
I found this bug report https://issues.apache.org/jira/browse/GROOVY-8693 but it looks like it has been fixed in Groovy 4 which is really ironic considering the above example.
What am I missing? How can this be fixed?