Skip to content

Compilation error using ScalaCaseClassRenderer and traits #110

@shishe84

Description

@shishe84

I'm configuring the buildinfo plugin like this at my build.sbt file:

buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion)
buildInfoPackage := "com.mypackage.buildinfo"
buildInfoOptions += BuildInfoOption.Traits("myTraits.MyCustomTrait")
buildInfoObject := "Info"
buildInfoRenderFactory := ScalaCaseClassRenderer.apply

The goal is to have a case class with a Trait so I'd be able to reference to the resulting case class through such Trait.
The problem is that sbt throws a compilation error as the resulting case class looks like this:

case class Info extends myTraits.MyCustomTrait(
  name: String,
  version: String,
  scalaVersion: String,
  sbtVersion: String
) {
}

And the sbt error is:

case classes without a parameter list are not allowed;
[error] use either case objects or case classes with an explicit () as a parameter list.
[error] case class Info extends myTraits.MyCustomTrait(
[error]                ^
[error] one error found
[error] (compile:compileIncremental) Compilation failed

Apparently, the traits names should be added right after the class parameters rather than before.

SBT version: 0.13.8
Scala version: 2.11.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions