Search code examples
scalasprayshapeless

Strange output of the Scala compiler in Spray project


I have a mixed Scala/Java Maven project that uses Spray. I compile with Maven and the scala-maven-plugin. I'm using Scala 2.10.4. Maven outputs a lot of meaningless information about Shapeless, a dependency of Spray:

[INFO] Compiling 25 Scala sources and 841 Java sources to /home/david/myproject/WEB- INF/classes...
Nothing <: spray.routing.Directive1[spray.http.Uri]?
true
spray.routing.Directive1[spray.http.Uri] <: shapeless.HList?
false
spray.routing.Directive1[spray.http.Uri] <: L?
false
Nothing <: spray.routing.Directive1[spray.http.Uri]?
true
spray.routing.Directive1[spray.http.Uri] <: shapeless.HList?
false
spray.routing.Directive1[spray.http.Uri] <: L?
false
Unit <: spray.httpx.marshalling.Marshaller[(spray.http.StatusCodes.ServerError, String)]?
false
Unit <: akka.event.LoggingAdapter?
false
Nothing <: spray.routing.Directive0?
true
spray.routing.Directive0 <: shapeless.HList?
false
spray.routing.Directive0 <: L?
false
Nothing <: spray.routing.Directive0?
true
spray.routing.Directive0 <: shapeless.HList?
false
spray.routing.Directive0 <: L?
false
Nothing <: spray.routing.Directive1[java.util.Locale]?
true
spray.routing.Directive1[java.util.Locale] <: shapeless.HList?
false
spray.routing.Directive1[java.util.Locale] <: L?
false
Nothing <: spray.routing.Directive1[java.util.Locale]?
true
spray.routing.Directive1[java.util.Locale] <: shapeless.HList?
false
spray.routing.Directive1[java.util.Locale] <: L?
false
Nothing <: spray.routing.Directive[shapeless.HNil]?
true
spray.routing.Directive[shapeless.HNil] <: shapeless.HList?
false
spray.routing.Directive[shapeless.HNil] <: L?
false
Nothing <: spray.routing.Directive[shapeless.HNil]?
true
spray.routing.Directive[shapeless.HNil] <: shapeless.HList?
false
spray.routing.Directive[shapeless.HNil] <: L?
false
Nothing <: spray.routing.Directive[shapeless.HNil]?
true
spray.routing.Directive[shapeless.HNil] <: shapeless.HList?
false
spray.routing.Directive[shapeless.HNil] <: L?
false
Nothing <: spray.routing.Directive[shapeless.HNil]?
true
spray.routing.Directive[shapeless.HNil] <: shapeless.HList?
false
spray.routing.Directive[shapeless.HNil] <: L?
false
Nothing <: spray.routing.Directive[shapeless.::[fcc.vision.rest.Usuario,shapeless.HNil]]?
true
spray.routing.Directive[shapeless.::[fcc.vision.rest.Usuario,shapeless.HNil]] <: shapeless.HList?
...

This generates a lot of noise, and provides no meaning to me.

What is the purpose of this messages?

They look like internal debug output of the Scala compiler.

Can they be removed?.

UPDATE:

Here is an excerpt of my pom:

<dependencies>
    <dependency>
        <groupId>io.spray</groupId>
        <artifactId>spray-servlet</artifactId>
        <version>1.3.1</version>
    </dependency>
    <dependency>
        <groupId>io.spray</groupId>
        <artifactId>spray-routing</artifactId>
        <version>1.3.1</version>
    </dependency>
    <dependency>
        <groupId>org.json4s</groupId>
        <artifactId>json4s-native_${scala.mayor}</artifactId>
        <version>3.2.9</version>
    </dependency>
    <dependency>
        <groupId>org.scala-lang</groupId>
        <artifactId>scalap</artifactId>
        <version>${scala.mayor}.${scala.menor}</version>
    </dependency>
    <dependency>
        <groupId>com.typesafe.akka</groupId>
        <artifactId>akka-actor_${scala.mayor}</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.scala-lang</groupId>
        <artifactId>scala-library</artifactId>
        <version>${scala.mayor}.${scala.menor}</version>
    </dependency>
</dependencies>
<properties>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <scala.mayor>2.10</scala.mayor>
    <scala.menor>4</scala.menor>
</properties>

Shapeless is brought as a transitive dependency automatically.


Solution

  • This looks like you have -explaintypes enabled in your Scala compiler options. Open your pom.xml and check the <plugin><plugins> entry for scala-maven-scala. See if in <configuration><args> you have <arg>-explaintypes</arg>. These messages can sometimes aid in cleaning up type errors in your code but I find them too annoying to keep them on all the time, just remove the <arg>-explaintypes</arg> and they should go away (check with other team members if they put it there for some reason).