Skip to content

exception caught when loading class C: Cyclic reference involving class C #10888

Closed
@kostaskougios

Description

@kostaskougios

Minimized code

scala file failing to compile:

import com.badlogic.gdx.graphics.g2d.ParticleEffectPool

case class DrawParticleEffect(effect: ParticleEffectPool)

mill build file build.sc, use this to fetch the ParticleEffectPool class which causes the issue :

import Deps._
import mill._
import mill.scalalib._
import mill.scalalib.scalafmt._

object `gdx-lib` extends Common {
  override def ivyDeps = Agg(
    Gdx.Core,
    Gdx.Backend,
    Gdx.Native,
    Gdx.Controllers
  )
}

trait Common extends SbtModule with ScalafmtModule {
  override def scalaVersion = Deps.ScalaVersion

  override def scalacOptions = Seq("-deprecation", "-feature", "-unchecked")
}

object Deps {
  val ScalaVersion = "3.0.0-M3"

  object Gdx {
    private val Version = "1.9.12"
    val Core = ivy"com.badlogicgames.gdx:gdx:$Version"
    val Backend = ivy"com.badlogicgames.gdx:gdx-backend-lwjgl3:$Version"
    val BackendHeadless = ivy"com.badlogicgames.gdx:gdx-backend-headless:$Version"
    val Native = ivy"com.badlogicgames.gdx:gdx-platform:$Version;classifier=natives-desktop"
    val Controllers = ivy"com.badlogicgames.gdx:gdx-controllers-lwjgl3:$Version"
  }
}

use mill __.compile to compile and get the error.

Output

[info] Compiling 1 Scala source to /home/ariskk/temp/scala3issue/out/gdx-lib/compile/dest/classes ...
exception caught when loading class ParticleEffectPool: Cyclic reference involving class ParticleEffectPool
[error] -- [E046] Cyclic Error: /home/ariskk/temp/scala3issue/gdx-lib/src/main/scala/games/lib/draw/DrawParticleEffect.scala:8:81 
[error] 8 |case class DrawParticleEffect(renderPriority: Float, x: Float, y: Float, effect: ParticleEffectPool, scaleFactor: Float = 1) {}
[error]   |                                                                                 ^
[error]   |                       Cyclic reference involving class ParticleEffectPool
[error] one error found

Expectation

This should compile. It compiles ok with scala 2.13.4 but it could be a class file issue from the gdx library.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions