Skip to content
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

ClassNotFoundException when running a program compiled with CC Scala 2 library #19845

Closed
Linyxus opened this issue Mar 1, 2024 · 0 comments · Fixed by #19849
Closed

ClassNotFoundException when running a program compiled with CC Scala 2 library #19845

Linyxus opened this issue Mar 1, 2024 · 0 comments · Fixed by #19849
Labels
area:experimental:cc Capture checking related itype:bug
Milestone

Comments

@Linyxus
Copy link
Contributor

Linyxus commented Mar 1, 2024

Compiler version

main

Minimized code

class Foo extends Seq[Int]:
  def iterator: Iterator[Int] = ???
  def apply(i: Int): Int = 0
  def length: Int = 0

object Test {
  def main(args: Array[String]): Unit = {
    val foo: Foo = new Foo()
  }
}

Output

Exception in thread "main" java.lang.NoClassDefFoundError: scala/collection/FreeSeqFactory
	at Test$.main(xml.scala:8)
	at Test.main(xml.scala)
Caused by: java.lang.ClassNotFoundException: scala.collection.FreeSeqFactory
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
	... 2 more
@Linyxus Linyxus added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 1, 2024
@Linyxus Linyxus added area:experimental:cc Capture checking related and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 1, 2024
Linyxus added a commit that referenced this issue Mar 2, 2024
FreeSeqFactory was a construction to demonstrate type safety for certain
iterableFactory.from calls where we rely in the fact that for all Seqs
iterableFactory has an eager implementation of from.

While that shows that we _can_ make it typesafe, it does not work at
runtime as a drop-in replacement for stdlib since of course stdlib does
not have a FreeSeqFactory.

This commit drops FreeSeqFactory and adds three unsafeAssumePure calls
instead, with explanations.

Fixes #19845
@Kordyjan Kordyjan added this to the 3.4.2 milestone Mar 28, 2024
@Kordyjan Kordyjan modified the milestones: 3.4.2, 3.5.0 May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:experimental:cc Capture checking related itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants