Enum name conflicts #386

Merged
merged 3 commits into from Aug 10, 2016

Projects

None yet

2 participants

@anatoliykmetyuk
Contributor

The issue with enum names conflicting with Scala base names turned out to only affect the "Nil" word. So I just added it to the list of Scala names, and also a test to verify the behaviour, since I haven't found one.

@eed3si9n
Owner

LGTM pending Travis

@anatoliykmetyuk
Contributor

I've also included the commit for tests to be executed sequentially.

I tried to run the Travis tests for this PR two times. In both cases, Wsdl11Soap12Test failed, but in different ways.

First time output:

generated tmp/stockquote/stockquote_type1.scala.
generated tmp/explicitheader/explicit_header_example_type1.scala.
generated tmp/explicitheader/explicit_header_example.scala.
generated tmp/explicitheader/xmlprotocol.scala.
generated tmp/scalaxb/scalaxb.scala.
generated tmp/scalaxb/httpclients.scala.
generated tmp/scalaxb/httpclients_dispatch.scala.
generated tmp/scalaxb/soap12.scala.
generated tmp/soapenvelope12/soapenvelope12.scala.
generated tmp/soapenvelope12/soapenvelope12_xmlprotocol.scala.
generated tmp/stockquote/stockquote.scala.
generated tmp/stockquote/xmlprotocol.scala.
generated tmp/scalaxb/scalaxb.scala.
generated tmp/scalaxb/httpclients.scala.
generated tmp/scalaxb/httpclients_dispatch.scala.
generated tmp/scalaxb/soap12.scala.
generated tmp/soapenvelope12/soapenvelope12.scala.
generated tmp/soapenvelope12/soapenvelope12_xmlprotocol.scala.
generated tmp/implicitheader/implicit_header_example_type1.scala.
generated tmp/implicitheader/implicit_header_example.scala.
generated tmp/implicitheader/xmlprotocol.scala.
generated tmp/scalaxb/scalaxb.scala.
generated tmp/scalaxb/httpclients.scala.
generated tmp/scalaxb/httpclients_dispatch.scala.
generated tmp/scalaxb/soap12.scala.
generated tmp/soapenvelope12/soapenvelope12.scala.
generated tmp/soapenvelope12/soapenvelope12_xmlprotocol.scala.
generated tmp/implicitheadermultipart/implicit_header_multiple_part_header_type1.scala.
generated tmp/implicitheadermultipart/implicit_header_multiple_part_header.scala.
generated tmp/implicitheadermultipart/xmlprotocol.scala.
generated tmp/scalaxb/scalaxb.scala.
generated tmp/scalaxb/httpclients.scala.
generated tmp/scalaxb/httpclients_dispatch.scala.
generated tmp/scalaxb/soap12.scala.
generated tmp/soapenvelope12/soapenvelope12.scala.
generated tmp/soapenvelope12/soapenvelope12_xmlprotocol.scala.
tmp/soapenvelope12/soapenvelope12_xmlprotocol.scala:258: error: ':' expected but eof found.
    def parser(node: scala.xml.Node, st
                                       ^
tmp/soapenvelope12/soapenvelope12_xmlprotocol.scala:258: error: ':' expected but eof found.
    def parser(node: scala.xml.Node, st
                                       ^
service: implicitheader.UserEndPoint = implicitheader.XMLProtocol$UserBindings$$anon$3@70cccb8d
res0: Boolean = true
service: implicitheadermultipart.UserEndPoint = implicitheadermultipart.XMLProtocol$UserBindings$$anon$4@18159064
res0: Boolean = true
[info] Wsdl11Soap12Test
[info] ! stockquote.scala file must compile
[error]  RuntimeException: : Error compiling: tmp/stockquote/stockquote_type1.scala,tmp/stockquote/stockquote.scala,tmp/stockquote/xmlprotocol.scala,tmp/scalaxb/scalaxb.scala,tmp/scalaxb/httpclients.scala,tmp/scalaxb/httpclients_dispatch.scala,tmp/scalaxb/soap12.scala,tmp/soapenvelope12/soapenvelope12.scala,tmp/soapenvelope12/soapenvelope12_xmlprotocol.scala  (CompilerMatcher.scala:79)
[error] CompilerMatcher$$anon$2.apply(CompilerMatcher.scala:79)
[error] Wsdl11Soap12Test$$anonfun$1.apply(Wsdl11Soap12Test.scala:22)
[error] Wsdl11Soap12Test$$anonfun$1.apply(Wsdl11Soap12Test.scala:9)
[info] 
[info] + implicitheader.scala file must compile
[info] + implicitheadermultipart.scala file must compile
[info] ! explicitheader.scala file must compile
[error]  RuntimeException: : Error compiling: tmp/explicitheader/explicit_header_example_type1.scala,tmp/explicitheader/explicit_header_example.scala,tmp/explicitheader/xmlprotocol.scala,tmp/scalaxb/scalaxb.scala,tmp/scalaxb/httpclients.scala,tmp/scalaxb/httpclients_dispatch.scala,tmp/scalaxb/soap12.scala,tmp/soapenvelope12/soapenvelope12.scala,tmp/soapenvelope12/soapenvelope12_xmlprotocol.scala  (CompilerMatcher.scala:79)
[error] CompilerMatcher$$anon$2.apply(CompilerMatcher.scala:79)
[error] Wsdl11Soap12Test$$anonfun$4.apply(Wsdl11Soap12Test.scala:194)
[error] Wsdl11Soap12Test$$anonfun$4.apply(Wsdl11Soap12Test.scala:144)
[info] 
[info] 
[info] Total for specification Wsdl11Soap12Test
[info] Finished in 60 ms
[info] 4 examples, 0 failure, 2 errors

Second time output:

generated tmp/stockquote/stockquote_type1.scala.
generated tmp/stockquote/stockquote.scala.
generated tmp/stockquote/xmlprotocol.scala.
generated tmp/scalaxb/scalaxb.scala.
generated tmp/scalaxb/httpclients.scala.
generated tmp/scalaxb/httpclients_dispatch.scala.
generated tmp/scalaxb/soap12.scala.
generated tmp/soapenvelope12/soapenvelope12.scala.
generated tmp/soapenvelope12/soapenvelope12_xmlprotocol.scala.
generated tmp/implicitheader/implicit_header_example_type1.scala.
generated tmp/implicitheader/implicit_header_example.scala.
generated tmp/implicitheader/xmlprotocol.scala.
generated tmp/scalaxb/scalaxb.scala.
generated tmp/scalaxb/httpclients.scala.
generated tmp/scalaxb/httpclients_dispatch.scala.
generated tmp/scalaxb/soap12.scala.
generated tmp/soapenvelope12/soapenvelope12.scala.
generated tmp/soapenvelope12/soapenvelope12_xmlprotocol.scala.
generated tmp/explicitheader/explicit_header_example_type1.scala.
generated tmp/explicitheader/explicit_header_example.scala.
generated tmp/explicitheader/xmlprotocol.scala.
generated tmp/scalaxb/scalaxb.scala.
generated tmp/scalaxb/httpclients.scala.
generated tmp/scalaxb/httpclients_dispatch.scala.
generated tmp/scalaxb/soap12.scala.
generated tmp/soapenvelope12/soapenvelope12.scala.
generated tmp/soapenvelope12/soapenvelope12_xmlprotocol.scala.
generated tmp/implicitheadermultipart/implicit_header_multiple_part_header_type1.scala.
generated tmp/implicitheadermultipart/implicit_header_multiple_part_header.scala.
generated tmp/implicitheadermultipart/xmlprotocol.scala.
generated tmp/scalaxb/scalaxb.scala.
generated tmp/scalaxb/httpclients.scala.
generated tmp/scalaxb/httpclients_dispatch.scala.
generated tmp/scalaxb/soap12.scala.
generated tmp/soapenvelope12/soapenvelope12.scala.
generated tmp/soapenvelope12/soapenvelope12_xmlprotocol.scala.
tmp/scalaxb/soap12.scala:22: error: not found: type HttpClients
trait SoapClients { this: HttpClients =>
                          ^
tmp/scalaxb/httpclients_dispatch.scala:5: error: not found: type HttpClients
trait DispatchHttpClients extends HttpClients {
                                  ^
tmp/scalaxb/httpclients_dispatch.scala:11: error: not found: type HttpClient
  trait DispatchHttpClient extends HttpClient {
                                   ^
tmp/scalaxb/soap12.scala:41: error: not found: value httpClient
      val s = httpClient.request(r map {_.toString} getOrElse {""}, address, headers)
              ^
service: implicitheadermultipart.UserEndPoint = implicitheadermultipart.XMLProtocol$UserBindings$$anon$4@62edffd4
res0: Boolean = true
service: explicitheader.UserEndPoint = explicitheader.XMLProtocol$UserBindings$$anon$2@123ee252
res0: Boolean = true
service: implicitheader.UserEndPoint = implicitheader.XMLProtocol$UserBindings$$anon$3@5b5878c5
res0: Boolean = true
[info] Wsdl11Soap12Test
[info] ! stockquote.scala file must compile
[error]  RuntimeException: : Error compiling: tmp/stockquote/stockquote_type1.scala,tmp/stockquote/stockquote.scala,tmp/stockquote/xmlprotocol.scala,tmp/scalaxb/scalaxb.scala,tmp/scalaxb/httpclients.scala,tmp/scalaxb/httpclients_dispatch.scala,tmp/scalaxb/soap12.scala,tmp/soapenvelope12/soapenvelope12.scala,tmp/soapenvelope12/soapenvelope12_xmlprotocol.scala  (CompilerMatcher.scala:79)
[error] CompilerMatcher$$anon$2.apply(CompilerMatcher.scala:79)
[error] Wsdl11Soap12Test$$anonfun$1.apply(Wsdl11Soap12Test.scala:22)
[error] Wsdl11Soap12Test$$anonfun$1.apply(Wsdl11Soap12Test.scala:9)
[info] 
[info] + implicitheader.scala file must compile
[info] + implicitheadermultipart.scala file must compile
[info] + explicitheader.scala file must compile
[info] 
[info] Total for specification Wsdl11Soap12Test
[info] Finished in 2 ms
[info] 4 examples, 0 failure, 1 error

Note the different errors and different number of failed examples. Note also a particular fragment from the first run:

tmp/soapenvelope12/soapenvelope12_xmlprotocol.scala:258: error: ':' expected but eof found.
    def parser(node: scala.xml.Node, st
                                       ^
tmp/soapenvelope12/soapenvelope12_xmlprotocol.scala:258: error: ':' expected but eof found.
    def parser(node: scala.xml.Node, st

Clearly the line couldn't be written properly. Highly suggests concurrency issues.

From my previous PR:

Tests are executed sequentially

In process of their work, test examples generate files to tmp/ directory. Specs2 executes them in parallel by default, so they write to that directory at the same time. It was OK (more or less), since the tests apparently use different package names and the templates are the same for each test.

Since scalaxb.scala.template now has the placeholder for the name of the protocol package in its code, sharing this file between the examples is no longer possible. Moreover, writing this file in parallel for different examples pumps some junk at the end of that file, preventing it from compiling successfuly.

We have disabled the parallel execution of the test examples for that reason, we did not experience any disastrous performance drops because of it.

@eed3si9n
Owner

Seems like the tests are passing now with the last change.

@eed3si9n eed3si9n merged commit fc30ed7 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:enum-name-conflicts-2 branch Aug 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment