You probably need to tell it to rip as many of those out as possible (and replace them with null annotations).
I've noticed LLMs sometimes pick a documented anti-pattern (passing Optional around in Java is not recommended), then amplify it (like a human might).
That's because LLMs suck.