I got an unexpected internal NPE when playing with this script.

```
POST _scripts/painless/_execute
{
  "script": {
    "source": """
    return /[^\w]+/.split('abc   def higkln').toArray(String[]::new)
    """
  }
}
```
```
{
  "error" : {
    "root_cause" : [
      {
        "type" : "script_exception",
        "reason" : "compile error",
        "script_stack" : [ ],
        "script" : "\n    return /[^\\w]+/.split('abc   def higkln').toArray(String[]::new)\n    ",
        "lang" : "painless"
      }
    ],
    "type" : "script_exception",
    "reason" : "compile error",
    "script_stack" : [ ],
    "script" : "\n    return /[^\\w]+/.split('abc   def higkln').toArray(String[]::new)\n    ",
    "lang" : "painless",
    "caused_by" : {
      "type" : "null_pointer_exception",
      "reason" : "Cannot read field \"annotations\" because the return value of \"org.elasticsearch.painless.lookup.PainlessLookup.lookupPainlessClass(java.lang.Class)\" is null"
    }
  },
  "status" : 400
}

```
modules/lang-painless/src/main/java/org/elasticsearch/painless/phase/DefaultSemanticAnalysisPhase.java
new IllegalArgumentException(
                            "invalid foreach loop: " + "method [" + typeToCanonicalTypeName(iterableValueType) + ", iterator/0] not found"
                        )
                    );
                }
                semanticScope.putDecoration(userEachNode, new IterablePainlessMethod(method));
            }
            PainlessCast painlessCast = AnalyzerCaster.getLegalCast(location, def.class, type, true, true);
            if (painlessCast != null) {
                semanticScope.putDecoration(userEachNode, new ExpressionPainlessCast(painlessCast));
            }
        } else {
            throw userEachNode.createError(
                new IllegalArgumentException(
                    "invalid foreach loop: "
                        + "cannot iterate over type ["
                        + PainlessLookupUtility.typeToCanonicalTypeName(iterableValueType)
                        + "]."
                )
            );
        }
    }
    /**
     * Visits a declaration block which contains one-to-many declarations.
     */
    @Override
    public void visitDeclBlock(SDeclBlock userDeclBlockNode, SemanticScope semanticScope) {
        for (SDeclaration userDeclarationNode : userDeclBlockNode.getDeclarationNodes()) {
            visit(userDeclarationNode, semanticScope);
        }