Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala - Java interop: can Scala emit enums in bytecode for Java to consume?

I have a project that is mixed Java/Scala, it is Java GUI code that makes use of a Scala library. Is there a way to write Scala code such that it will emit Java enums on compile time? The approaches I tried so far (sealed case classes, extend Enumeration) seem to generate normal classes which makes working with them from Java much hairier than straight up enums.

like image 240
Boris Terzic Avatar asked Jul 06 '09 18:07

Boris Terzic


1 Answers

Why can't you write your enum class in Java? Mixed-source (i.e. Java + Scala) projects are perfectly feasible...

like image 82
oxbow_lakes Avatar answered Oct 02 '22 03:10

oxbow_lakes