This repository was archived by the owner on Aug 27, 2026. It is now read-only.
Repository navigation
[generator] Replace hyphens in managed names. - #498
Merged
Merged
Conversation
jonpryor
reviewed
Oct 7, 2019
jpobst
force-pushed
the
managedname-hyphens
branch
from
October 8, 2019 14:23
39b5bb5 to
af815ec
Compare
jpobst
force-pushed
the
managedname-hyphens
branch
from
October 8, 2019 14:40
af815ec to
f30a430
Compare
jonpryor
pushed a commit
that referenced
this pull request
Oct 9, 2019
Context: #464 Context: 7a309c4 Use of [Kotlin][0] can result in some "weird" method names and parameter names in Java bytecode, in particular names which contain spaces: // Kotlin abstract class Example { public fun `method spaces`(`parameter spaces`: Double) { } } Run that through `kotlinc` and `javap`, and...there's a parameter name with spaces! $ kotlinc -java-parameters hello.kt $ javap Example.class Classfile Example.class ... public abstract class Example ... public final void method spaces(double); ... MethodParameters: Name Flags parameter spaces ...which is a sure fire way to confuse things. Update `XmlApiImporter.EnsureValidIdentifier()` so that it uses `IdentifierValidator.CreateValidIdentifier()` (7a309c4) to turn potentially invalid strings such as `method spaces` into valid C# identifiers such as `method_spaces`, which also ensures that method names and constructor names are appropriately fixed. Additionally, update `XmlApiImporter.CreateParameter()` so that it now uses `EnsureValidIdentifier()`, ensuring it is consistent with method and constructor name correction. [0]: https://kotlinlang.org
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context: #464 issues 1 and 2.
Kotlin allows hyphens in class/member names. Replace them with underscores for the managed name so we generate valid C# names.