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 2 commits into from Aug 10, 2016


Copy link

@anatoliykmetyuk anatoliykmetyuk commented Aug 10, 2016

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.

Copy link

eed3si9n commented Aug 10, 2016


@eed3si9n eed3si9n merged commit d98bfd9 into eed3si9n:master Aug 10, 2016
1 check passed
@anatoliykmetyuk anatoliykmetyuk deleted the name-clashes-in-protocol branch Aug 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants