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
* Checks: type validation
     */
    @Override
    public void visitFunctionRef(EFunctionRef userFunctionRefNode, SemanticScope semanticScope) {
        ScriptScope scriptScope = semanticScope.getScriptScope();
        Location location = userFunctionRefNode.getLocation();
        String symbol = userFunctionRefNode.getSymbol();
        String methodName = userFunctionRefNode.getMethodName();
        boolean read = semanticScope.getCondition(userFunctionRefNode, Read.class);
        Class<?> type = scriptScope.getPainlessLookup().canonicalTypeNameToType(symbol);
        TargetType targetType = semanticScope.getDecoration(userFunctionRefNode, TargetType.class);
        Class<?> valueType;
        boolean isInstanceReference = "this".equals(symbol);
        if (isInstanceReference || type != null) {
            if (semanticScope.getCondition(userFunctionRefNode, Write.class)) {
                throw userFunctionRefNode.createError(
                    new IllegalArgumentException(
                        "invalid assignment: cannot assign a value to function reference [" + symbol + ":" + methodName + "]"
                    )
                );
            }
            if (read == false) {
                throw userFunctionRefNode.createError(
                    new IllegalArgumentException("not a statement: function reference [" + symbol + ":" + methodName + "] not used")
                );
            }
            if (isInstanceReference) {
                semanticScope.setCondition(userFunctionRefNode, InstanceCapturingFunctionRef.class);
            }
            if (targetType == null) {