Skip to content

Name clashes in protocol#385

Merged
eed3si9n merged 2 commits into
eed3si9n:masterfrom
anatoliykmetyuk:name-clashes-in-protocol
Aug 10, 2016
Merged

Name clashes in protocol#385
eed3si9n merged 2 commits into
eed3si9n:masterfrom
anatoliykmetyuk:name-clashes-in-protocol

Conversation

@anatoliykmetyuk
Copy link
Copy Markdown
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
Copy Markdown
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