Skip to content

Commit 32e43f7

Browse files
committed
Check never emit non-final fields in traits
1 parent 70041d2 commit 32e43f7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler/src/dotty/tools/backend/jvm/BCodeSkelBuilder.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ trait BCodeSkelBuilder extends BCodeHelpers {
231231
val javagensig = getGenericSignature(f, claszSymbol)
232232
val flags = javaFieldFlags(f)
233233

234+
assert(!f.isStaticMember || !claszSymbol.isInterface || !f.isMutable,
235+
s"interface $claszSymbol cannot have non-final static field $f")
236+
234237
val jfield = new asm.tree.FieldNode(
235238
flags,
236239
f.javaSimpleName.toString,

0 commit comments

Comments
 (0)