TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Engineering NullAway, Uber’s Open Source Tool for Android NullPointerExceptions

4 pointsby myhrvoldover 7 years ago

1 comment

gregjorover 7 years ago
I think something is wrong with the code if null pointers are a big problem in a Java code base.<p>The example in the article shows a class with an exposed nullable member, and a function outside of the class referencing the possibly null member. I know it&#x27;s an example but it&#x27;s a bad practice to expose class variables like that. The only code that should have to check for a null member should be in the class, not scattered all over the code base. The example in the article shows a function referencing a member of a member (x.f). This just looks like very bad OO design and implementation to me.<p>Another approach is to never have null members. Use placeholder objects that have the expected interface but do something reasonable, like logging or reporting the error when referenced. That&#x27;s better than crashing.<p>As an Uber user and programmer I&#x27;m wondering how the Uber mobile client is so complex that the code has so many problems like this that you need to write special tools just to detect them.