Issue/semantic highlight class cast exception 1001925

Should we backport 659080269a13e2c4d3e11ad094d65e92dbf75fdc to 3.0.x?