Skip to content

Compiler Error When Using zinc #78

Description

@carabolic

Error

When using zinc server for incremental builds Peel does not compile due some problem with org/peelframework/core/cli/command/rsync/package$FolderEntry with the following error message:

how can getCommonSuperclass() do its job if different class symbols get the same bytecode-level internal name: org/peelframework/core/cli/command/rsync/package$FolderEntry

This seems to be a know issue of the Scala compiler.

Reproduce

To reproduce this bug, simply start a zinc server with zinc start followed by mvn compile. The compilation might be started twice to trigger this error.

Fix

To fix this we might do one of the following

  1. use a newer scala compiler (>= 2.11.0) or
  2. move the FolderEntry case class from the package object to a utility module.

Full error message:

carabolic ~/D/r/peel$ mvn compile
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 8 modules...
[INFO] Installing Nexus Staging features:
[INFO]   ... total of 8 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] peel
[INFO] peel-archetypes
[INFO] peel-flinkspark-bundle
[INFO] peel-flink-bundle
[INFO] peel-spark-bundle
[INFO] peel-core
[INFO] peel-extensions
[INFO] peel-empty-bundle
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building peel 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- build-helper-maven-plugin:1.7:add-source (add-source) @ peel-parent ---
[INFO] Source directory: /Users/carabolic/Development/repos/peel/src/main/scala added.
[INFO] 
[INFO] --- scala-maven-plugin:3.1.6:compile (scala-compile-first) @ peel-parent ---
[INFO] No sources to compile
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building peel-archetypes 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- build-helper-maven-plugin:1.7:add-source (add-source) @ peel-archetypes ---
[INFO] Source directory: /Users/carabolic/Development/repos/peel/peel-archetypes/src/main/scala added.
[INFO] 
[INFO] --- scala-maven-plugin:3.1.6:compile (scala-compile-first) @ peel-archetypes ---
[INFO] No sources to compile
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building peel-flinkspark-bundle 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- build-helper-maven-plugin:1.7:add-source (add-source) @ peel-flinkspark-bundle ---
[INFO] Source directory: /Users/carabolic/Development/repos/peel/peel-archetypes/peel-flinkspark-bundle/src/main/scala added.
[INFO] 
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ peel-flinkspark-bundle ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 32 resources
[INFO] 
[INFO] --- scala-maven-plugin:3.1.6:compile (scala-compile-first) @ peel-flinkspark-bundle ---
[INFO] No sources to compile
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building peel-flink-bundle 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- build-helper-maven-plugin:1.7:add-source (add-source) @ peel-flink-bundle ---
[INFO] Source directory: /Users/carabolic/Development/repos/peel/peel-archetypes/peel-flink-bundle/src/main/scala added.
[INFO] 
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ peel-flink-bundle ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 30 resources
[INFO] 
[INFO] --- scala-maven-plugin:3.1.6:compile (scala-compile-first) @ peel-flink-bundle ---
[INFO] No sources to compile
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building peel-spark-bundle 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- build-helper-maven-plugin:1.7:add-source (add-source) @ peel-spark-bundle ---
[INFO] Source directory: /Users/carabolic/Development/repos/peel/peel-archetypes/peel-spark-bundle/src/main/scala added.
[INFO] 
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ peel-spark-bundle ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 30 resources
[INFO] 
[INFO] --- scala-maven-plugin:3.1.6:compile (scala-compile-first) @ peel-spark-bundle ---
[INFO] No sources to compile
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building peel-core 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- build-helper-maven-plugin:1.7:add-source (add-source) @ peel-core ---
[INFO] Source directory: /Users/carabolic/Development/repos/peel/peel-core/src/main/scala added.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ peel-core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ peel-core ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- scala-maven-plugin:3.1.6:compile (scala-compile-first) @ peel-core ---
[INFO] Using zinc server for incremental compilation
[info] Compiling 60 Scala sources to /Users/carabolic/Development/repos/peel/peel-core/target/classes...
[error] uncaught exception during compilation: java.lang.AssertionError
java.lang.AssertionError: assertion failed: 
     while compiling: /Users/carabolic/Development/repos/peel/peel-core/src/main/scala/org/peelframework/core/util/shell.scala
        during phase: jvm
     library version: version 2.10.5
    compiler version: version 2.10.5
  reconstructed args: -classpath [!!REDACTED!!] -feature

  last tree to typer: Literal(Constant(java.nio.channels.WritableByteChannel))
              symbol: null
   symbol definition: null
                 tpe: Class(classOf[java.nio.channels.WritableByteChannel])
       symbol owners: 
      context owners: anonymous class anonfun$1 -> package util

== Enclosing template or block ==

Template( // val <local $anonfun>: <notype>, tree.tpe=org.peelframework.core.util.anonfun$1
  "scala.runtime.AbstractFunction0", "scala.Serializable" // parents
  ValDef(
    private
    "_"
    <tpt>
    <empty>
  )
  // 4 statements
  DefDef( // final def apply(): String
    <method> final <triedcooking>
    "apply"
    []
    List(Nil)
    <tpt> // tree.tpe=String
    Apply( // def s(args: Seq): String in class StringContext, tree.tpe=String
      new StringContext(scala.this.Predef.wrapRefArray(Array[String]{"# ", ""}.$asInstanceOf[Array[Object]]()))."s" // def s(args: Seq): String in class StringContext, tree.tpe=(args: Seq)String
      Apply( // implicit def genericWrapArray(xs: Object): collection.mutable.WrappedArray in class LowPriorityImplicits, tree.tpe=collection.mutable.WrappedArray
        scala.this."Predef"."genericWrapArray" // implicit def genericWrapArray(xs: Object): collection.mutable.WrappedArray in class LowPriorityImplicits, tree.tpe=(xs: Object)collection.mutable.WrappedArray
        ArrayValue( // tree.tpe=Array[Object]
          <tpt> // tree.tpe=Object
          List(
            Apply( // final def format(x$1: java.util.Date): String in class DateFormat, tree.tpe=String
              TimeStamps$$anonfun$1.this."dateFormat$1"."format" // final def format(x$1: java.util.Date): String in class DateFormat, tree.tpe=(x$1: java.util.Date)String
              Apply( // def <init>(): java.util.Date in class Date, tree.tpe=java.util.Date
                new java.util.Date."<init>" // def <init>(): java.util.Date in class Date, tree.tpe=()java.util.Date
                Nil
              )
            )
          )
        )
      )
    )
  )
  DefDef( // final def apply(): Object
    <method> final <bridge>
    "apply"
    []
    List(Nil)
    <tpt> // tree.tpe=Object
    Apply( // final def apply(): String, tree.tpe=String
      TimeStamps$$anonfun$1.this."apply" // final def apply(): String, tree.tpe=()String
      Nil
    )
  )
  ValDef( // private[this] val dateFormat$1: java.text.SimpleDateFormat
    private <local> <synthetic> <paramaccessor> <triedcooking>
    "dateFormat$1"
    <tpt> // tree.tpe=java.text.SimpleDateFormat
    <empty>
  )
  DefDef( // def <init>(arg$outer: org.peelframework.core.util.OutputStreamProcessLogger,dateFormat$1: java.text.SimpleDateFormat): org.peelframework.core.util.anonfun$1
    <method> <triedcooking>
    "<init>"
    []
    // 1 parameter list
    ValDef( // $outer: org.peelframework.core.util.OutputStreamProcessLogger
      <param>
      "$outer"
      <tpt> // tree.tpe=org.peelframework.core.util.OutputStreamProcessLogger
      <empty>
    )
    ValDef( // dateFormat$1: java.text.SimpleDateFormat
      <param> <synthetic> <triedcooking>
      "dateFormat$1"
      <tpt> // tree.tpe=java.text.SimpleDateFormat
      <empty>
    )
    <tpt> // tree.tpe=org.peelframework.core.util.anonfun$1
    Block( // tree.tpe=Unit
      // 2 statements
      Assign( // tree.tpe=Unit
        TimeStamps$$anonfun$1.this."dateFormat$1" // private[this] val dateFormat$1: java.text.SimpleDateFormat, tree.tpe=java.text.SimpleDateFormat
        "dateFormat$1" // dateFormat$1: java.text.SimpleDateFormat, tree.tpe=java.text.SimpleDateFormat
      )
      Apply( // def <init>(): scala.runtime.AbstractFunction0 in class AbstractFunction0, tree.tpe=scala.runtime.AbstractFunction0
        TimeStamps$$anonfun$1.super."<init>" // def <init>(): scala.runtime.AbstractFunction0 in class AbstractFunction0, tree.tpe=()scala.runtime.AbstractFunction0
        Nil
      )
      ()
    )
  )
)

== Expanded type of tree ==

ConstantType(value = Constant(java.nio.channels.WritableByteChannel))

how can getCommonSuperclass() do its job if different class symbols get the same bytecode-level internal name: org/peelframework/core/cli/command/rsync/package$FolderEntry
    at scala.tools.nsc.backend.jvm.GenASM$JBuilder.javaName(GenASM.scala:548)
    at scala.tools.nsc.backend.jvm.GenASM$JBuilder.addInnerClasses(GenASM.scala:637)
    at scala.tools.nsc.backend.jvm.GenASM$JMirrorBuilder.genMirrorClass(GenASM.scala:2978)
    at scala.tools.nsc.backend.jvm.GenASM$AsmPhase.run(GenASM.scala:114)
    at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1583)
    at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1557)
    at scala.tools.nsc.Global$Run.compileSources(Global.scala:1553)
    at scala.tools.nsc.Global$Run.compile(Global.scala:1662)
    at xsbt.CachedCompiler0.run(CompilerInterface.scala:116)
    at xsbt.CachedCompiler0.run(CompilerInterface.scala:95)
    at xsbt.CompilerInterface.run(CompilerInterface.scala:26)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:101)
    at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)
    at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)
    at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:97)
    at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:97)
    at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:97)
    at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:162)
    at sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:96)
    at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:139)
    at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:86)
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:38)
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:36)
    at sbt.inc.IncrementalCommon.cycle(IncrementalCommon.scala:31)
    at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:39)
    at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:38)
    at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:66)
    at sbt.inc.Incremental$.compile(Incremental.scala:38)
    at sbt.inc.IncrementalCompile$.apply(Compile.scala:26)
    at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:153)
    at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70)
    at com.typesafe.zinc.Compiler.compile(Compiler.scala:201)
    at com.typesafe.zinc.Compiler.compile(Compiler.scala:183)
    at com.typesafe.zinc.Compiler.compile(Compiler.scala:174)
    at com.typesafe.zinc.Main$.run(Main.scala:98)
    at com.typesafe.zinc.Nailgun$.zinc(Nailgun.scala:93)
    at com.typesafe.zinc.Nailgun$.nailMain(Nailgun.scala:82)
    at com.typesafe.zinc.Nailgun.nailMain(Nailgun.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.martiansoftware.nailgun.NGSession.run(NGSession.java:280)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] peel ............................................... SUCCESS [  2.091 s]
[INFO] peel-archetypes .................................... SUCCESS [  0.067 s]
[INFO] peel-flinkspark-bundle ............................. SUCCESS [  1.033 s]
[INFO] peel-flink-bundle .................................. SUCCESS [  0.514 s]
[INFO] peel-spark-bundle .................................. SUCCESS [  0.274 s]
[INFO] peel-core .......................................... FAILURE [ 31.706 s]
[INFO] peel-extensions .................................... SKIPPED
[INFO] peel-empty-bundle .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 37.475 s
[INFO] Finished at: 2016-02-23T14:28:41+01:00
[INFO] Final Memory: 16M/107M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.1.6:compile (scala-compile-first) on project peel-core: Execution scala-compile-first of goal net.alchim31.maven:scala-maven-plugin:3.1.6:compile failed. CompileFailed -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :peel-core

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions