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
Fix #415: Report usage positions of missing definitions when linking #2069
Fix #415: Report usage positions of missing definitions when linking #2069
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool :)
extends RuntimeException(msg) | ||
with NoStackTrace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a reason for NoStackTrace
here. NoStackTrace
is useful for exceptions thrown in non-failure paths, which must therefore be fast to initialize. This is not the case here.
Perhaps you wanted to avoid the stack trace to be displayed in the sbt shell? If that's the case, then there is a better solution: the sbt plugin should catch the exception and wrap it in a MessageOnlyException
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, consider extending Exception
rather than RuntimeException
. Or better: don't we have a generic LinkingException
somewhere? If not, maybe we should define one.
…hen linking (scala-native#2069) This commit adds aggregation of missing definitions with their usage positions when performing the reachability analysis. Previously, when some definition was missing, we would result in a single exception without any context. Now, we get a list of all the missing definitions, with the places of their usage. For example: [error] Found 2 missing definitions while linking [error] Not found Top(java.time.Instant$) [error] at <project_dir>/javalib/src/main/scala/java/nio/file/attribute/FileTime.scala:9 [error] Not found Top(java.util.Locale$) [error] at <project_dir>/javalib/src/main/scala/java/lang/String.scala:11 [error] at <project_dir>/javalib/src/main/scala/java/lang/String.scala:43 [error] at <project_dir>/javalib/src/main/scala/java/text/DateFormatSymbols.scala:28 [error] at <project_dir>/javalib/src/main/scala/java/text/DecimalFormat.scala:60 [error] at <project_dir>/javalib/src/main/scala/java/util/Formatter.scala:6 [error] at <project_dir>/javalib/src/main/scala/java/util/Formatter.scala:45 [error] at <project_dir>/javalib/src/main/scala/java/util/Formatter.scala:53 [error] stack trace is suppressed; run last tests / Test / nativeLink for the full output [error] (tests / Test / nativeLink) scala.scalanative.linker.Reach$ReachabilityFailureException: Undefined definitions found in reachability phase
…hen linking (scala-native#2069) This commit adds aggregation of missing definitions with their usage positions when performing the reachability analysis. Previously, when some definition was missing, we would result in a single exception without any context. Now, we get a list of all the missing definitions, with the places of their usage. For example: [error] Found 2 missing definitions while linking [error] Not found Top(java.time.Instant$) [error] at <project_dir>/javalib/src/main/scala/java/nio/file/attribute/FileTime.scala:9 [error] Not found Top(java.util.Locale$) [error] at <project_dir>/javalib/src/main/scala/java/lang/String.scala:11 [error] at <project_dir>/javalib/src/main/scala/java/lang/String.scala:43 [error] at <project_dir>/javalib/src/main/scala/java/text/DateFormatSymbols.scala:28 [error] at <project_dir>/javalib/src/main/scala/java/text/DecimalFormat.scala:60 [error] at <project_dir>/javalib/src/main/scala/java/util/Formatter.scala:6 [error] at <project_dir>/javalib/src/main/scala/java/util/Formatter.scala:45 [error] at <project_dir>/javalib/src/main/scala/java/util/Formatter.scala:53 [error] stack trace is suppressed; run last tests / Test / nativeLink for the full output [error] (tests / Test / nativeLink) scala.scalanative.linker.Reach$ReachabilityFailureException: Undefined definitions found in reachability phase
This PR adds aggregation of missing definitions with their usage positions when performing static reachability phase.
Currently, when some definition is missing, we would result in a single exception due to usage of
Map.apply
which does not contain any greater context.Thanks to this PR we would get list of all missing definitions with places of their usage, eg.:
Resolves #415