Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C#, Java, C++] Fixes issue #5399 by always including namespaces #5404

Merged
merged 3 commits into from
Jun 14, 2019

Conversation

lux
Copy link
Contributor

@lux lux commented Jun 13, 2019

Since changing the generated C# method names from GetProperty<T>() to just Property<T>(), there is the potential to more easily generate method names that conflict with class or struct names in the same namespace. This PR modifies BaseGenerator::WrapInNameSpace() to stops omitting the current namespace and always be explicit.

It appears that the same method applies to Java and C++ as well, so those languages are also affected by this change.

A sample schema and sample code that demonstrates the naming conflict can be found here:

https://gist.github.com/lux/af8ca8ebe333c27106b00e13328e7c8e#file-notes-md

@lux
Copy link
Contributor Author

lux commented Jun 13, 2019

Hmm, looks like there's still a problem with how it generates the method name on line 66 of tests/MyGame/Example/Monster.cs as GetTestnestedflatbufferAsMyGame.Example.Monster instead of GetTestnestedflatbufferAsMonster.

Seems like this is happening around line 1182 of src/idl_gen_general.cpp, just need to determine what to change that to.

@aardappel
Copy link
Collaborator

Nice fix! Not sure if its needed for C++, but doesn't hurt I guess.

@aardappel aardappel merged commit a80db85 into google:master Jun 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants