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/test/java/org/elasticsearch/painless/WhenThingsGoWrongTests.java
() -> { exec("def x = null; x.intValue(); return null;"); }
        );
        assertEquals(npe.getMessage(), "cannot access method/field [intValue] from a null def reference");
        npe = expectScriptThrows(NullPointerException.class, () -> { exec("def x = [1, null]; for (y in x) y.intValue(); return null;"); });
        assertEquals(npe.getMessage(), "cannot access method/field [intValue] from a null def reference");
        npe = expectScriptThrows(
            NullPointerException.class,
            () -> { exec("def x = [1, 2L, 3.0, 'test', (byte)1, (short)1, (char)1, null]; for (y in x) y.toString(); return null;"); }
        );
        assertEquals(npe.getMessage(), "cannot access method/field [toString] from a null def reference");
    }
    /**
     * Test that the scriptStack looks good. By implication this tests that we build proper "line numbers" in stack trace. These line
     * numbers are really 1 based character numbers.
     */
    public void testScriptStack() {
        for (String type : new String[] { "String", "def   " }) {
            
            ScriptException exception = expectThrows(
                ScriptException.class,
                () -> { exec(type + " x = null; boolean y = x.isEmpty();\n" + "return y;"); }
            );
            
            assertScriptElementColumn(30, exception);
            assertScriptStack(exception, "y = x.isEmpty();\n", "     ^---- HERE");
            assertThat(exception.getCause(), instanceOf(NullPointerException.class));
            
            exception = expectThrows(ScriptException.class, () -> { exec(type + " x = null;\n" + "return x.isEmpty();"); });
            
            assertScriptElementColumn(25, exception);