title: Creating a Java Enum in Scala
body: <p>My workplace has been experimenting in moving from Java to Scala for some tasks, and it works well for what we're doing. However, some preexisting logging methods expect a <code>java.lang.Enum</code>. The logging method is defined in the (Java) base class, and the subclasses can define their own enums, which the logger will track across all instances in multiple threads/machines.</p>
  
  <p>It works like this in Java:</p>
  
  <pre><code>public class JavaSubClass extends JavaBaseClass {
      enum Counters {
          BAD_THING,
          GOOD_THING
      }
  
      public void someDistributedTask() {
          // some work here
          if(terribleThing) {
              loggingMethod(Counters.BAD_THING)
          } else {
              loggingMethod(Counters.GOOD_THING)
              // more work here
          }
      }
  }
  </code></pre>
  
  <p>Then, when the task has finished, we can see that</p>
  
  <pre><code>BAD_THING: 230
  GOOD_THING: 10345
  </code></pre>
  
  <p>Is there any way to replicate this in Scala, either by creating Java <code>Enum</code>s or converting from <code>Enumeration</code> to <code>Enum</code>? I have tried extending <code>Enum</code> directly, but it seems to be sealed, as I get the error in the console:</p>
  
  <pre><code>error: constructor Enum in class Enum cannot be accessed in object $iw
  Access to protected constructor Enum not permitted because
  enclosing object $iw is not a subclass of 
  class Enum in package lang where target is defined
  </code></pre>