Chris Guzman

Developer Advocate @ Nexmo. I blog about Ruby and Android findings

Read this first

Using Doclava and Gradle to exclude classes from your generated Javadocs

At Nexmo I help out with the Java and Android client libraries. Recently I generated Javadocs for one of our Android client libraries. Usually, Android Studio makes this super easy. It’s as simple as using the “Generate JavaDoc” under the “Tools” menu. But I wouldn’t be writing a blog post if the problem I had to solve was so easy.

Our team wanted to exclude certain classes from the generated java docs. The engineers I was working with had already started that by using the @hide annotation at the top of the classes we wanted excluded. But the problem is when you use Android Studio’s built in Javadoc generation tool, you’ll find that it doesn’t respect @hide! So what to do?

The solution I found is to use Doclava (the original repo can be found on Google Code). Though the repo hasn’t been updated in a while, it still works.

There aren’t a lot of instructions out there how to integrate

Continue reading →

Dealing with TimeZones in Java without Joda Time

I’ve begun working on a java SDK for nexmo’s API. Thanks to the wonders of timezones I had a crappy time (the 24 hour cold I currently have didn’t help).

Mark works in the UK and I work on East Coast time. Only because of our team’s remote nature did we discover that we had failing tests due to timezones. Cue multiple discussions of “I don’t know what’s wrong, it works on my machine!” After noticing the bug we realized the CI didn’t catch it because Travis CI sets the timezones on its containers to UTC time and the bug only appeared off of UTC time.

We want to minimize dependencies so my colleague Mark and I agreed to not use Joda Time. We were definitely asking for trouble. Here’s what I learned today while debugging our tests:

  • java.util.Date.toString() will always print in your timezone
  • java.util.Calendar.toDate() will always print in your timezone
  • java.util.Date doesn’t have

Continue reading →