Better error when java_import'ing names with ::. See #2075.

Thanks to @byteit101 for the patch!