Skip to content

Conversation

@Friendseeker
Copy link
Contributor

@Friendseeker Friendseeker commented Dec 20, 2024

c.c. #10905 (comment)

We explicitly catch the exception, as in

lazy val callback2 =
try callback.asInstanceOf[AnalysisCallback2]
catch { case _: NoClassDefFoundError => null}

@SethTisue

@scala-jenkins scala-jenkins added this to the 2.13.17 milestone Dec 20, 2024
@SethTisue SethTisue modified the milestones: 2.13.17, 2.13.16 Dec 20, 2024
@SethTisue SethTisue added prio:hi high priority (used only by core team, only near release time) internal not resulting in user-visible changes (build changes, tests, internal cleanups) labels Dec 20, 2024
@SethTisue
Copy link
Member

(labeled "internal" since the problem it addresses never appeared in a release)

@Friendseeker Friendseeker changed the title Fix NoClassDefFoundError when using old zinc version Fix NoClassDefFoundError when using old zinc version [ci: last-only] Dec 20, 2024
@SethTisue
Copy link
Member

SethTisue commented Dec 21, 2024

Is there some way we can prevent this from recurring in the future?

("this" = accidentally depending on some too-new API)

@Friendseeker
Copy link
Contributor Author

Friendseeker commented Dec 21, 2024

Is there some way we can prevent this from recurring in the future?

("this" = accidentally depending on some too-new API)

Maybe we can add exactly one build to scala community builds with an old sbt version? So every other builds in community builds run with latest sbt version but the one build does not.

@lrytz
Copy link
Member

lrytz commented Dec 22, 2024

Thank you!

@SethTisue SethTisue force-pushed the NoClassDefFoundError-callback3-fix branch from 94471e3 to 6507958 Compare December 22, 2024 16:33
Copy link
Member

@SethTisue SethTisue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give the question of avoiding recurrence some thought in the new year.

@SethTisue SethTisue enabled auto-merge December 22, 2024 16:34
@SethTisue SethTisue merged commit f44badf into scala:2.13.x Dec 22, 2024
2 of 3 checks passed
@Friendseeker Friendseeker deleted the NoClassDefFoundError-callback3-fix branch December 22, 2024 19:41
@SethTisue
Copy link
Member

This doesn't seem to fix the problem in the Scala Native repo, I still get

[error] ## Exception when compiling 65 sources to /Users/tisue/scala-native/nscplugin/.2.13/target/scala-2.13/classes
[error] java.lang.NoClassDefFoundError: xsbti/AnalysisCallback3
[error] scala.tools.xsbt.ZincCompiler.callback3Opt$lzycompute(CallbackGlobal.scala:90)
[error] scala.tools.xsbt.ZincCompiler.callback3Opt(CallbackGlobal.scala:90)
[error] scala.tools.xsbt.ZincCompiler.getSourceFile(CallbackGlobal.scala:93)
[error] scala.tools.nsc.Global$Run.$anonfun$compileFiles$1(Global.scala:1651)
[error] scala.tools.nsc.Global$Run.compileFiles(Global.scala:1651)
[error] scala.tools.xsbt.CachedCompiler0.run(CompilerBridge.scala:176)
[error] scala.tools.xsbt.CachedCompiler0.run(CompilerBridge.scala:139)

this is from a clean checkout of scala-native with (on JDK 17) set ThisBuild / resolvers += "int" at "https://scala-ci.typesafe.com/artifactory/scala-integration/" then ++2.13.16-bin-1f34012! then Test/compile

@SethTisue
Copy link
Member

SethTisue commented Dec 22, 2024

Oh, I bet it's because Try only catches scala.util.control.NonFatal throwables...! But NoClassDefFoundError is an Error and those are considered fatal

@Friendseeker
Copy link
Contributor Author

Oh, I bet it's because Try only catches scala.util.control.NonFatal throwables...! But NoClassDefFoundError is an Error and those are considered fatal

Thanks for the observation! Making another PR right now.

SethTisue added a commit to SethTisue/scala that referenced this pull request Dec 22, 2024
@SethTisue
Copy link
Member

I've just submitted #10966

SethTisue added a commit to SethTisue/scala that referenced this pull request Dec 23, 2024
SethTisue added a commit to SethTisue/scala that referenced this pull request Jan 6, 2025
@SethTisue
Copy link
Member

I've verified that #10966 fixes the problem as originally reported in the Scala Native repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal not resulting in user-visible changes (build changes, tests, internal cleanups) prio:hi high priority (used only by core team, only near release time)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants