No. If `userId` is null, this is illegal. You meant

    return userId == null ? "anonymous" : User.get(userId).getDisplayName();

To see this kind of mistake, ensure the parameter of `User.get(String)` is marked `@Nonnull`. Then make `userId` in this class `@CheckForNull` (see its constructor). Then run FindBugs. (Depending on which IDE you use, you may be able to configure it to run FindBugs directly in the editor as you work.)