Just found the same problem. This difference can introduce subtle bugs when refactoring groovy code to CompileStatic. 

I suggest to report a bug for that. 

Cheers, Paolo

On Tue, Dec 12, 2017 at 12:45 AM, MG <mgbiz@arscreat.com> wrote:
Hi guys,

just a quick question since we came across it today when testing code that had been converted from dynamic to static Groovy: Is the behavior that statically compiled Groovy throws a NPE when the iterable to be iterated over is null (same as Java), while dynamically compiled Groovy uses the NullObject.iterator(), i.e. does not throw but instead iterates over an empty collection by design ?