Submitter Capybara James sent The Daily WTF a small Java snippet: after checking that dto.getAssetModelUUID() has length (among other conditions), the code returns Optional.ofNullable(dto) — even though dto was just dereferenced and therefore demonstrably cannot be null.

On its own, the line is merely ugly rather than catastrophic: it simply skips the syntactic sugar and boxes a value that needed no nullable wrapper. The real problem is context. The pattern repeats throughout the entire codebase, and even methods that never return nullable types wrap and unwrap Optionals anyway. Optional has become a talisman scattered through the code to ward off null reference exceptions.

Does the charm work? Not really — the code remains buggy and error-prone. Will it ever be fixed? Probably not in this lifetime.