Skip to content

Commit

Permalink
Fix #12459: Warn instead of error if TASTy is not in sync with classfile
Browse files Browse the repository at this point in the history
This updates Scala 2.13 to match the current behavior in Scala 3 when
TASTy is not in sync with classfile, which is to print a warning and
suggest cleaning instead of erroring. The same change for Scala 3 happened
in the following pull request:
scala/scala3#9125

The Scala 3 change was made as a result of the following issue:
scala/scala3#8839

The commit message from the Scala 3 fix is as follows:
> Only warn if TASTy is not in sync with classfile
>
> If they are not in sync, we warn and suggest to clean.
> We assume that the TASTy is up to date (arbitrary choise) and load it regardless.
> This way we are resiliant to the failiure if the loaded class API did not change or
> did not have an impact on the code we are compiling."
  • Loading branch information
jjudd authored and lrytz committed Sep 14, 2021
1 parent 7247dfe commit 829163c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,12 @@ abstract class ClassfileParser(reader: ReusableInstance[ReusableDataReader]) {
val expectedUUID = new UUID(reader.readUncompressedLong(), reader.readUncompressedLong())
val tastyUUID = new TastyHeaderUnpickler(TASTYBytes).readHeader()
if (expectedUUID != tastyUUID) {
reporter.error(NoPosition, s"Tasty UUID ($tastyUUID) file did not correspond the tasty UUID ($expectedUUID) declared in the classfile $file.")
loaders.warning(
NoPosition,
s"$file is out of sync with its TASTy file. Loaded TASTy file. Try cleaning the project to fix this issue",
WarningCategory.Other,
clazz.fullNameString
)
}
TASTYBytes
}
Expand Down

0 comments on commit 829163c

Please sign in to comment.