`String.toString` just returns `this`, so you could remove the `instanceof` check and cast after you ensure it's non-`null`.