Skip to content

Commit 09db4b8

Browse files
Backport "Fail early & more clearly on shaded-broken classfiles" to 3.5.2 (#21464)
Backports #21262 to the 3.5.2 branch. PR submitted by the release tooling. [skip ci]
2 parents 4de574b + 5a7cc67 commit 09db4b8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala

+4-1
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,10 @@ class ClassfileParser(
11631163
// attribute isn't, this classfile is a compilation artifact.
11641164
return Some(NoEmbedded)
11651165

1166-
if (scan(tpnme.ScalaSignatureATTR) && scan(tpnme.RuntimeVisibleAnnotationATTR)) {
1166+
if (scan(tpnme.ScalaSignatureATTR)) {
1167+
if !scan(tpnme.RuntimeVisibleAnnotationATTR) then
1168+
report.error(em"No RuntimeVisibleAnnotations in classfile with ScalaSignature attribute: ${classRoot.fullName}")
1169+
return None
11671170
val attrLen = in.nextInt
11681171
val nAnnots = in.nextChar
11691172
var i = 0

0 commit comments

Comments
 (0)