Skip to content

Commit 004ddb3

Browse files
committed
ensure methods only deleted if defined by enum syntax
1 parent 032ef94 commit 004ddb3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/transform/CompleteJavaEnums.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ class CompleteJavaEnums extends MiniPhase with InfoTransformer { thisPhase =>
115115
private def isJavaEnumValueImpl(cls: Symbol)(using Context): Boolean =
116116
cls.isAnonymousClass
117117
&& ((cls.owner.name eq nme.DOLLAR_NEW) || cls.owner.isAllOf(EnumCase))
118-
&& cls.owner.owner.linkedClass.derivesFromJavaEnum
118+
&& {
119+
val enumCls = cls.owner.owner.linkedClass
120+
enumCls.derivesFromJavaEnum && enumCls.is(Enum)
121+
}
119122

120123
/** 1. If this is an enum class, add $name and $ordinal parameters to its
121124
* parameter accessors and pass them on to the java.lang.Enum constructor.

0 commit comments

Comments
 (0)