eed3si9n / scalaxb

scalaxb is an XML data binding tool for Scala.

Home Page:http://scalaxb.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation error "not found: value p1" (p2, p3..)

barryoneill opened this issue · comments

When trying to use sbt-scalaxb:1.7.3 (or any number of previous versions thereof), I am getting the below compilation error when compiling generated sources for this XSD

 09:15:29 ~/code/scalaxb-problem> sbt ";clean;test"   
                                                                                                                                
[info] Loading settings for project global-plugins from plugins.sbt,metals.sbt ...
[info] Loading global plugins from /Users/barryoneill/.sbt/1.0/plugins
[info] Loading settings for project scalaxb-problem-build from plugins.sbt ...
[info] Loading project definition from /Users/barryoneill/code/scalaxb-problem/project
[info] Loading settings for project root from build.sbt ...
[info] Set current project to scalaxb-problem (in build file:/Users/barryoneill/code/scalaxb-problem/)
[success] Total time: 0 s, completed Jan 9, 2020, 9:15:35 AM
WARN  [2020-01-09 09:15:35,539] module: CommonTypes.xsd imports common.xsd but no schema with that name was compiled together.
WARN  [2020-01-09 09:15:35,540] module: Warning: CommonTypes.xsd includes external/ISOCountryCodeType-V2006.xsd but no schema with that name was compiled together.
generated /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/CommonTypes.scala.
generated /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala.
generated /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/src_managed/main/sbt-scalaxb/scalaxb/scalaxb.scala.
[info] Compiling 3 Scala sources to /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/classes ...
[error] /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala:440:100: not found: value p1
[error]       case node: scala.xml.Node => Right(generated.Complexu46StringTypeu46ItemDimension(Seq.concat(p1.toList,
[error]                                                                                                    ^
[error] /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala:441:9: not found: value p2
[error]         p2.toList,
[error]         ^
[error] /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala:442:9: not found: value p3
[error]         p3.toList,
[error]         ^
[error] /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala:443:9: not found: value p4
[error]         p4.toList,
[error]         ^
[error] /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala:444:9: not found: value p5
[error]         p5.toList,
[error]         ^
[error] /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala:445:9: not found: value p6
[error]         p6.toList,
[error]         ^
[error] /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala:446:9: not found: value p7
[error]         p7.toList),
[error]         ^
[error] /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala:473:97: not found: value p1
[error]       case node: scala.xml.Node => Right(generated.Complexu46StringTypeu46ItemWeight(Seq.concat(p1.toList,
[error]                                                                                                 ^
[error] /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala:474:9: not found: value p2
[error]         p2.toList,
[error]         ^
[error] /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala:475:9: not found: value p3
[error]         p3.toList),
[error]         ^
[error] /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala:942:65: value map is not a member of generated.Operation_type
[error]         case ("@operation_type", _) => if (__obj.operation_type.map(x => x.toString).mkString(" ") != "Add") attr = scala.xml.Attribute(__scope.getPrefix(null), "operation_type", __obj.operation_type.map(x => x.toString).mkString(" "), attr)
[error]                                                                 ^
[error] /Users/barryoneill/code/scalaxb-problem/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala:942:201: value map is not a member of generated.Operation_type
[error]         case ("@operation_type", _) => if (__obj.operation_type.map(x => x.toString).mkString(" ") != "Add") attr = scala.xml.Attribute(__scope.getPrefix(null), "operation_type", __obj.operation_type.map(x => x.toString).mkString(" "), attr)
[error]                                                                                                                                                                                                         ^
[error] 12 errors found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 6 s, completed Jan 9, 2020, 9:15:40 AM

Note: this xsd includes other xsd definitions, but the problem occurs with or without the dependent files, so I'm excluding them for simplicity.

I have attached the generated sources.

scalaxb-problem-sources.zip

Other info
Scala 2.12.10

Some investigation shows that if you remove mixed="true" on both

  • Complex.StringType.ItemDimension
  • Complex.StringType.ItemWeight

the not found: value p{N} errors go away, but the value map is not a member of errors remain.

@barryoneill Thanks for the detailed report.