Not for this change, but I think this might work better as a method on JavaWriter. It knows what's imported and you could ask it to give you a name for a class.