Name clashes in protocol #385

Merged
merged 2 commits into from Aug 10, 2016

Projects

None yet

2 participants

@anatoliykmetyuk
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
Owner

LGTM

@eed3si9n eed3si9n merged commit d98bfd9 into eed3si9n:master Aug 10, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@anatoliykmetyuk anatoliykmetyuk deleted the anatoliykmetyuk: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