Skip to content

Commit 857549f

Browse files
Generate ACC_ENUM flags for Java enums
1 parent 5aa8d91 commit 857549f

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ class BTypesFromSymbols[I <: BackendInterface](val int: I) extends BTypes {
223223
if (sym.hasEnumFlag) ACC_ENUM else 0,
224224
if (sym.isVarargsMethod) ACC_VARARGS else 0,
225225
if (sym.isSynchronized) ACC_SYNCHRONIZED else 0,
226-
if (sym.isDeprecated) asm.Opcodes.ACC_DEPRECATED else 0
226+
if (sym.isDeprecated) asm.Opcodes.ACC_DEPRECATED else 0,
227+
if (sym.isEnum) asm.Opcodes.ACC_ENUM else 0
227228
)
228229
}
229230

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ abstract class BackendInterface extends BackendInterfaceDefinitions {
512512
def isJavaDefaultMethod: Boolean
513513
def isClassConstructor: Boolean
514514
def isSerializable: Boolean
515+
def isEnum: Boolean
515516

516517
/**
517518
* True for module classes of modules that are top-level or owned only by objects. Module classes

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
703703
def shouldEmitForwarders: Boolean =
704704
(sym is Flags.Module) && sym.isStatic
705705
def isJavaEntryPoint: Boolean = CollectEntryPoints.isJavaEntryPoint(sym)
706+
def isEnum = sym.is(Flags.Enum, butNot = Flags.Case) && sym.info.parents.exists(p => p.typeSymbol == defn.JEnumClass)
706707

707708
def isClassConstructor: Boolean = toDenot(sym).isClassConstructor
708709
def isSerializable: Boolean = toDenot(sym).isSerializable

0 commit comments

Comments
 (0)