Skip to content

Commit 3c93c5c

Browse files
committed
Make class initialisers private. Otherwise they break GenBCode.
GenBCode checks if class already has static initialiser, the check is fooled if class inherited a static initialisers.
1 parent de45fa1 commit 3c93c5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/dotty/tools/dotc/transform/MoveStatics.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class MoveStatics extends MiniPhaseTransform with SymTransformer { thisTransform
4242
val newBodyWithStaticConstr =
4343
if (staticFields.nonEmpty) {
4444
/* do NOT put Flags.JavaStatic here. It breaks .enclosingClass */
45-
val staticCostructor = ctx.newSymbol(orig.symbol, Names.STATIC_CONSTRUCTOR, Flags.Synthetic | Flags.Method, MethodType(Nil, defn.UnitType))
45+
val staticCostructor = ctx.newSymbol(orig.symbol, Names.STATIC_CONSTRUCTOR, Flags.Synthetic | Flags.Method | Flags.Private, MethodType(Nil, defn.UnitType))
4646
staticCostructor.addAnnotation(Annotation(defn.ScalaStaticAnnot))
4747
staticCostructor.entered
4848

0 commit comments

Comments
 (0)