E160: Java Enum Parent Args

This error occurs when a class extends java.lang.Enum without providing the required constructor arguments (name and ordinal).

The java.lang.Enum constructor requires two arguments: a String name and an Int ordinal. When manually extending java.lang.Enum (which is only allowed with -source:3.0-migration), these arguments must be provided.

Note: In modern Scala 3, you should use the enum keyword instead of manually extending java.lang.Enum.


Example

final class MyEnum extends java.lang.Enum[MyEnum]

Error

-- [E160] Type Error: example.scala:1:12 ---------------------------------------
1 |final class MyEnum extends java.lang.Enum[MyEnum]
  |            ^
  |not enough arguments for constructor Enum: (name: String, ordinal: Int): Enum[MyEnum]

Solution

// Use Scala 3 enum syntax instead (recommended)
enum MyEnum {
  case Value1, Value2
}