New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to locate class corresponding to inner class entry for Edge$ in owner scalax.collection.GraphBase when compiling with "-Yinline" #77

Closed
manuzhang opened this Issue Jul 28, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@manuzhang

manuzhang commented Jul 28, 2017

Reproducible with the following codes,

import scalax.collection.mutable.{Graph => SGraph}
import scalax.collection.edge.LDiEdge

class Graph[N, E](private val graph: SGraph[N, LDiEdge]) extends Serializable {

  def addVertex(vertex: N): Unit = {
    graph.add(vertex)
  }

  def addEdge(s: N, e: E, t: N): Unit = {
    implicit val edgeCompanion = LDiEdge
    graph.addLEdge(s, t)(e)
  }

  /**
   * ====== ERROR ======
   * Unable to locate class corresponding to inner class entry for Edge$
   * in owner scalax.collection.GraphBase
   */
  private def toEdge(e: graph.EdgeT): (N, E, N) = {
    (e.source, e.label.asInstanceOf[E], e.target)
  }

  /**
   * Map a graph to a new graph, with edge converted to new type
   * Current graph is not changed.
   */
  def mapEdge[NewEdge](fun: (N, E, N) => NewEdge): Graph[N, NewEdge] = {
    val newGraph = new Graph[N, NewEdge](SGraph.empty[N, LDiEdge])
    graph.foreach {
      case n: graph.NodeT => newGraph.addVertex(n.value)
      case e: graph.EdgeT =>
        val (s, p, t) = toEdge(e)
        newGraph.addEdge(s, fun(s, p, t), t)
    }
    newGraph
  }
}

sbt build file

name := "scala-graph-example"

version := "1.0"

scalaVersion := "2.11.8"

libraryDependencies += "org.scala-graph" %% "graph-core" % "1.11.5"

scalacOptions ++= Seq("-Yinline")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment