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
);
                    }
                } else if (prefixValueType != null && prefixValueType.valueType() == def.class) {
                    TargetType targetType = userDotNode.isNullSafe() ? null : semanticScope.getDecoration(userDotNode, TargetType.class);
                    valueType = targetType == null || semanticScope.getCondition(userDotNode, Explicit.class)
                        ? def.class
                        : targetType.targetType();
                    if (write) {
                        semanticScope.setCondition(userDotNode, DefOptimized.class);
                    }
                } else {
                    Class<?> prefixType;
                    String prefixCanonicalTypeName;
                    boolean isStatic;
                    if (prefixValueType != null) {
                        prefixType = prefixValueType.valueType();
                        prefixCanonicalTypeName = prefixValueType.getValueCanonicalTypeName();
                        isStatic = false;
                    } else if (prefixStaticType != null) {
                        prefixType = prefixStaticType.staticType();
                        prefixCanonicalTypeName = prefixStaticType.getStaticCanonicalTypeName();
                        isStatic = true;
                    } else {
                        throw userDotNode.createError(new IllegalStateException("value required: instead found no value"));
                    }
                    PainlessField field = semanticScope.getScriptScope()
                        .getPainlessLookup()
                        .lookupPainlessField(prefixType, isStatic, index);
                    if (field == null) {
                        PainlessMethod getter;