Skip to content
This repository was archived by the owner on Jul 13, 2025. It is now read-only.

Fix enum imports#2430

Merged
andreamlin merged 2 commits intogoogleapis:masterfrom
andreamlin:enum_imports
Nov 14, 2018
Merged

Fix enum imports#2430
andreamlin merged 2 commits intogoogleapis:masterfrom
andreamlin:enum_imports

Conversation

@andreamlin
Copy link
Copy Markdown
Contributor

@andreamlin andreamlin commented Nov 14, 2018

Fixes #2431.

e.g. The com.google...Book.Rating import is a compile time error, since the member is referenced as Book.Rating.

An alternative is to keep the import as is, but then reference the inner member as Rating. That is a lesser alternative, because there could be multiple Rating inner entities from different classes, and there would be type clashes.

@andreamlin
Copy link
Copy Markdown
Contributor Author

PTAL

Copy link
Copy Markdown
Contributor

@pongad pongad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good with me. Though I think we should get rid of duplicate import statements. We can do that in follow up PR though.

@andreamlin andreamlin merged commit e72072a into googleapis:master Nov 14, 2018
@andreamlin andreamlin deleted the enum_imports branch November 14, 2018 20:21
private TypeName getEnumTypeName(ProtoElement elem) {
String packageName = getProtoElementPackage(elem);
String shortName = getShortName(elem);
String importName = packageName + "." + shortName.substring(0, shortName.indexOf("."));

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@andreamlin andreamlin restored the enum_imports branch November 19, 2018 19:19
andreamlin added a commit to andreamlin/toolkit that referenced this pull request Nov 19, 2018
andreamlin added a commit to andreamlin/toolkit that referenced this pull request Nov 27, 2018
@andreamlin andreamlin deleted the enum_imports branch December 8, 2018 00:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants