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

Name clashes in protocol #385

Merged
merged 2 commits into from
Aug 10, 2016

Conversation

anatoliykmetyuk
Copy link
Contributor

Copy-pasting the info on the bug from my previous PR:

Name clashes in protocol.xml

Consider OpenOffice schemata, files dml-main.xsd and sml.xsd. Both define <xsd:complexType name="CT_Table">. When generating them in different packages, protocol.scala generates classes with identical names for both of these types.

This is due to the following code in the compiler/xsd/Lookup.scala:

  def buildFormatterName(namespace: Option[String], name: String): String = {
    val pkg = packageName(namespace, context) getOrElse {""}
    val lastPart = pkg.split('.').reverse.head

    lastPart.capitalize + name + "Format"
  }

So if the package names have the identical last part, there will be a clash.

Since protocol.scala is not supposed to be used directly by the end user and is needed only for the implicits, we decided to use the entire package name to construct these class names. This way, they are much longer, but unambiguous.

@eed3si9n
Copy link
Owner

LGTM

@eed3si9n eed3si9n merged commit d98bfd9 into eed3si9n:master Aug 10, 2016
@anatoliykmetyuk anatoliykmetyuk deleted the name-clashes-in-protocol branch August 12, 2016 11:56
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