-
Notifications
You must be signed in to change notification settings - Fork 1.1k
error while loading .class file in nightly scalac #20361
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
Comments
@timothyklim can you provide a minimization? Just the error output isn't enough to go on here. |
Yes, please: https://github.com/timothyklim/scala3-issue-20361 |
We'll still need a minimization without dependencies (without depending on Still, @timothyklim the reproduction you sent seems to include a custom The following seems to work correctly: //> using scala 3.5.0-RC1-bin-20240501-e6bc130-NIGHTLY
//> using dep org.jitsi:jitsi-utils:1.0-130-g1473517
import org.jitsi.utils.*
@main def run(): Unit = println("test") Any context for what you're using? It's hard to investigate with what's there. |
Bonus question: what JVM is this supposed to be run on? |
I'm using my custom JDK 22 but tested with JDK 19 (19.0.2) from nixpkgs: |
What about |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
I pushed new commit with official version from maven: timothyklim/scala3-issue-20361@bd2d6d6 there no bazel, no custom patches, no jar in lib/, but the same error. |
If I remove scalac option |
Did you pass |
Yes. This works: //> using scala 3.5.0-RC1-bin-20240501-e6bc130-NIGHTLY
//> using dep org.jitsi:jitsi-utils:1.0-130-g1473517
//> using options -experimental
import org.jitsi.utils.*
@main def run(): Unit = println("test") But with SBT, the same doesn't. import org.jitsi.utils.*
@main def run(): Unit = println("test")
scalaVersion := "3.5.0-RC1-bin-20240501-e6bc130-NIGHTLY"
scalacOptions ++= Seq("-experimental")
libraryDependencies += "org.jitsi" % "jitsi-utils" % "1.0-130-g1473517" output: sbt:dest> run
[info] compiling 1 Scala source to /Users/pchabelski/IdeaProjects/scala-cli-tests/compiler-repro/dest/target/scala-3.5.0-RC1-bin-20240501-e6bc130-NIGHTLY/classes ...
exception caught when loading class module-info: java.lang.AssertionError: assertion failed: attempt to parse java.lang.Object from classfile
error while transforming package <empty> {
final lazy module val repro$package: repro$package = new repro$package()
final module class repro$package() extends Object() {
this: repro$package.type =>
@main def run(): Unit = println("test")
}
final class run() extends Object() {
<static> def main(args: Array[String]): Unit =
try run() catch
{
case error @ _:scala.util.CommandLineParser.ParseError =>
scala.util.CommandLineParser.showError(error)
}
}
}
unhandled exception while running posttyper on /Users/pchabelski/IdeaProjects/scala-cli-tests/compiler-repro/dest/src/main/scala/repro.scala
An unhandled exception was thrown in the compiler.
Please file a crash report here:
https://github.com/scala/scala3/issues/new/choose
For non-enriched exceptions, compile with -Yno-enrich-error-messages.
while compiling: /Users/pchabelski/IdeaProjects/scala-cli-tests/compiler-repro/dest/src/main/scala/repro.scala
during phase: posttyper
mode: Mode(ImplicitsEnabled)
library version: version 2.13.12
compiler version: version 3.5.0-RC1-bin-20240501-e6bc130-NIGHTLY-git-e6bc130
settings: -bootclasspath /Users/pchabelski/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.5.0-RC1-bin-20240501-e6bc130-NIGHTLY/scala3-library_3-3.5.0-RC1-bin-20240501-e6bc130-NIGHTLY.jar:/Users/pchabelski/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar -classpath /Users/pchabelski/IdeaProjects/scala-cli-tests/compiler-repro/dest/target/scala-3.5.0-RC1-bin-20240501-e6bc130-NIGHTLY/classes:/Users/pchabelski/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/jitsi/jitsi-utils/1.0-130-g1473517/jitsi-utils-1.0-130-g1473517.jar:/Users/pchabelski/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar:/Users/pchabelski/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/net/java/dev/jna/jna/5.9.0/jna-5.9.0.jar:/Users/pchabelski/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.9.10/kotlin-stdlib-1.9.10.jar:/Users/pchabelski/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-reflect/1.9.10/kotlin-reflect-1.9.10.jar:/Users/pchabelski/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-common/1.9.10/kotlin-stdlib-common-1.9.10.jar:/Users/pchabelski/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/jetbrains/annotations/13.0/annotations-13.0.jar -d /Users/pchabelski/IdeaProjects/scala-cli-tests/compiler-repro/dest/target/scala-3.5.0-RC1-bin-20240501-e6bc130-NIGHTLY/classes -experimental true
[error] ## Exception when compiling 1 sources to /Users/pchabelski/IdeaProjects/scala-cli-tests/compiler-repro/dest/target/scala-3.5.0-RC1-bin-20240501-e6bc130-NIGHTLY/classes
[error] java.lang.AssertionError: assertion failed: attempt to parse java.lang.Object from classfile
[error] scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
[error] dotty.tools.dotc.core.classfile.ClassfileParser$AbstractConstantPool.getSuperClass(ClassfileParser.scala:175)
[error] dotty.tools.dotc.core.classfile.ClassfileParser.parseParents$1(ClassfileParser.scala:380)
[error] dotty.tools.dotc.core.classfile.ClassfileParser.parseClass(ClassfileParser.scala:395)
[error] dotty.tools.dotc.core.classfile.ClassfileParser.$anonfun$1(ClassfileParser.scala:302)
[error] dotty.tools.dotc.core.classfile.ClassfileParser.run(ClassfileParser.scala:297)
[error] dotty.tools.dotc.core.ClassfileLoader.doComplete(SymbolLoaders.scala:417)
[error] dotty.tools.dotc.core.SymbolLoader.complete(SymbolLoaders.scala:348)
[error] dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:175)
[error] dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
[error] dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
[error] dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:393)
[error] dotty.tools.dotc.core.SymDenotations$SymDenotation.annotations(SymDenotations.scala:231)
[error] dotty.tools.dotc.core.SymDenotations$SymDenotation.hasAnnotation(SymDenotations.scala:245)
[error] dotty.tools.dotc.core.SymUtils.isExperimental(SymUtils.scala:364)
[error] dotty.tools.dotc.typer.Checking$.isNonExperimentalTopLevelDefinition$1(Checking.scala:809)
[error] dotty.tools.dotc.typer.Checking$.nonExperimentalTopLevelDefs$1$$anonfun$1(Checking.scala:817)
[error] scala.collection.Iterator$$anon$10.nextCur(Iterator.scala:594)
[error] scala.collection.Iterator$$anon$10.hasNext(Iterator.scala:608)
[error] scala.collection.IterableOnceOps.foreach(IterableOnce.scala:576)
[error] scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:574)
[error] scala.collection.AbstractIterator.foreach(Iterator.scala:1300)
[error] dotty.tools.dotc.typer.Checking$.markTopLevelDefsAsExperimental$1(Checking.scala:837)
[error] dotty.tools.dotc.typer.Checking$.checkAndAdaptExperimentalImports(Checking.scala:845)
[error] dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transformStats(PostTyper.scala:548)
[error] dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1242)
[error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1613)
[error] dotty.tools.dotc.transform.MacroTransform$Transformer.transform(MacroTransform.scala:42)
[error] dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform(PostTyper.scala:539)
[error] dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:20)
[error] dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:380)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:333)
[error] dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:373)
[error] dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
[error] dotty.tools.dotc.Run.runPhases$1(Run.scala:336)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:384)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:396)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:396)
[error] dotty.tools.dotc.Run.compileSources(Run.scala:282)
[error] dotty.tools.dotc.Run.compile(Run.scala:267)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
[error] dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:141)
[error] dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:193)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:248)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:183)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:211)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:180)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:178)
[error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:464)
[error] sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
[error] sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:419)
[error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:506)
[error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:406)
[error] sbt.internal.inc.Incremental$.apply(Incremental.scala:172)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:488)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:425)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2371)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2321)
[error] sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:31)
[error] sbt.internal.io.Retry$.apply(Retry.scala:47)
[error] sbt.internal.io.Retry$.apply(Retry.scala:29)
[error] sbt.internal.io.Retry$.apply(Retry.scala:24)
[error] sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2319)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error] sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error] sbt.Execute.work(Execute.scala:292)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[error] java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[error] java.base/java.lang.Thread.run(Thread.java:833)
[error]
[error] stack trace is suppressed; run last Compile / compileIncremental for the full output
[error] (Compile / compileIncremental) java.lang.AssertionError: assertion failed: attempt to parse java.lang.Object from classfile
[error] Total time: 0 s, completed May 13, 2024, 2:00:32 PM It's worth noting that removing the |
Compiler version
Problem started from
3.5.0-RC1-bin-20240501-e6bc130-NIGHTLY
version and still present in latest nightly build. As a workaround I'm using3.5.0-RC1-bin-20240429-e2c456f-NIGHTLY
version.Minimized code
The text was updated successfully, but these errors were encountered: