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
iae = expectScriptThrows(IllegalArgumentException.class, () -> exec("/a/; return null;"));
        assertEquals(iae.getMessage(), "not a statement: regex constant [a] with flags [] not used");
        iae = expectScriptThrows(IllegalArgumentException.class, () -> exec("'1'; return null;"));
        assertEquals(iae.getMessage(), "not a statement: string constant [1] not used");
        iae = expectScriptThrows(IllegalArgumentException.class, () -> exec("+1; return null;"));
        assertEquals(iae.getMessage(), "not a statement: result not used from addition operation [+]");
        iae = expectScriptThrows(IllegalArgumentException.class, () -> exec("boolean x; x; return null;"));
        assertEquals(iae.getMessage(), "not a statement: variable [x] not used");
        iae = expectScriptThrows(IllegalArgumentException.class, () -> exec("int[] x = new int[] {1}; x[0]; return null;"));
        assertEquals(iae.getMessage(), "not a statement: result of brace operator not used");
        iae = expectScriptThrows(IllegalArgumentException.class, () -> exec("Integer.MAX_VALUE; return null;"));
        assertEquals(iae.getMessage(), "not a statement: result of dot operator [.] not used");
    }
    public void testInvalidAssignment() {
        IllegalArgumentException iae = expectScriptThrows(IllegalArgumentException.class, () -> exec("1 * 1 = 2; return null;"));
        assertEquals(iae.getMessage(), "invalid assignment: cannot assign a value to multiplication operation [*]");
        iae = expectScriptThrows(IllegalArgumentException.class, () -> exec("boolean x = true; x && false = 2; return null;"));
        assertEquals(iae.getMessage(), "invalid assignment: cannot assign a value to boolean and operation [&&]");
        iae = expectScriptThrows(IllegalArgumentException.class, () -> exec("false = 2; return null;"));
        assertEquals(iae.getMessage(), "invalid assignment: cannot assign a value to boolean constant [false]");
        iae = expectScriptThrows(IllegalArgumentException.class, () -> exec("x() = 1; return null;"));
        assertEquals(iae.getMessage(), "invalid assignment: cannot assign a value to function call [x/0]");
        iae = expectScriptThrows(IllegalArgumentException.class, () -> exec("1 == 1 = 2; return null;"));
        assertEquals(iae.getMessage(), "invalid assignment: cannot assign a value to equals operation [==]");
        iae = expectScriptThrows(IllegalArgumentException.class, () -> exec("boolean x = true; (x ? 1 : 1) = 2; return null;"));
        assertEquals(iae.getMessage(), "invalid assignment: cannot assign a value to conditional operation [?:]");
        iae = expectScriptThrows(IllegalArgumentException.class, () -> exec("1.1 = 1; return null;"));
        assertEquals(iae.getMessage(), "invalid assignment: cannot assign a value to decimal constant [1.1]");
        iae = expectScriptThrows(IllegalArgumentException.class, () -> exec("List x = []; (x ?: []) = 2; return null;"));
        assertEquals(iae.getMessage(), "invalid assignment: cannot assign a value to elvis operation [?:]");