Skip to content

Commit 829163c

Browse files
jjuddlrytz
authored andcommitted
Fix #12459: Warn instead of error if TASTy is not in sync with classfile
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."
1 parent 7247dfe commit 829163c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,12 @@ abstract class ClassfileParser(reader: ReusableInstance[ReusableDataReader]) {
12651265
val expectedUUID = new UUID(reader.readUncompressedLong(), reader.readUncompressedLong())
12661266
val tastyUUID = new TastyHeaderUnpickler(TASTYBytes).readHeader()
12671267
if (expectedUUID != tastyUUID) {
1268-
reporter.error(NoPosition, s"Tasty UUID ($tastyUUID) file did not correspond the tasty UUID ($expectedUUID) declared in the classfile $file.")
1268+
loaders.warning(
1269+
NoPosition,
1270+
s"$file is out of sync with its TASTy file. Loaded TASTy file. Try cleaning the project to fix this issue",
1271+
WarningCategory.Other,
1272+
clazz.fullNameString
1273+
)
12691274
}
12701275
TASTYBytes
12711276
}

0 commit comments

Comments
 (0)