-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Improve error message for mismatched tasty versions, allow configuration of header unpickler #18828
Improve error message for mismatched tasty versions, allow configuration of header unpickler #18828
Conversation
it would be good to backport the content of the messages, however the |
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.
Great tests!
i"""TASTy file ${tastyFile.canonicalPath} is broken, reading aborted with ${e.getClass} | ||
| ${Option(e.getMessage).getOrElse("")}""" | ||
if (ctx.debug) e.printStackTrace() | ||
throw IOException(message) |
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.
Let's keep the cause, here:
throw IOException(message) | |
throw IOException(message, e) |
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.
ClassfileParser also does not keep the cause
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.
Meh ... OK.
classRoot.classSymbol.rootTreeOrProvider = unpickler | ||
moduleRoot.classSymbol.rootTreeOrProvider = unpickler | ||
checkTastyUUID(tastyFile, tastyBytes) | ||
catch case e: RuntimeException => |
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.
Why RuntimeException
and not Exception
or NonFatal
?
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.
its what the ClassfileParser does, i.e. what TASTy unpicking used to do before we did the TASTy-first classpath change
// - backwards incompatible major, in which case the library should be recompiled by the minimum stable minor | ||
// version supported by this compiler | ||
// - any experimental in an older minor, in which case the library should be recompiled by the stable | ||
// compiler in the same minor. | ||
// - older experimental in the same minor, in which case the compiler is also experimental, and the library | ||
// should be recompiled by the current compiler | ||
// - forward incompatible, in which case the compiler must be upgraded to the same version as the file. |
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.
💯
c73c612
to
88dd1ca
Compare
@sjrd I tweaked the first line of the message because it was repetitive when combined with the additional text added in SymbolLoaders when reporting the error. |
@bishabosha Do you want a review by someone else? If yes can you assign them, please? |
I was wondering if this might be controversial |
fixes #18427
Adds configuration ability to
TastyHeaderUnpickler
, why?tasty-core
is intended to be a generic library, so for its error messages to suddenly assume the consumer is a scala compiler would be a breaking change, so we instead by default use a generic configuration (the old "tooling" style) and allow to plug-in a "scala compiler" configurationAlso the configuration allows us to easily test the content of error messages.
see #18828 (comment) for backporting considerations
Release Notes
Scala 3.4 improves the error message when a signature from the classpath comes from an incompatible TASTy version. It has improved readability and provides a more useful diagnostic of what a user can do to fix the problem.
Sample error 1 (reading old experimental tasty):
Sample error 2 (reading newer stable scala):