title: Using a supertype parameter of specific enum classes
body: <p>I have two parser classes, and I want to throw an exception when parsing fails.
  I want to use the same exception, ParserException, which I'd like could accept the field name which caused the failure. I thought to use enums, but I think I don't have the topic completely clear. </p>
  
  <p><strong>How do I declare fieldName in the ParserException class?</strong> enum, as far as I understand, should be the supertype for ParserA.Fields and ParserB.Fields, but is not accepted. </p>
  
  <p>Please note that <strong>the two enum classes contain a different set of enums</strong>, i.e. they are not the same class.</p>
  
  <pre><code>public class ParserA {
  
   public enum Fields {
    A_FIRST_FIELD
    A_SECOND_FIELD
   }
  
  
   public void parse() {
    ... 
   throw ParserException(Fields.A_FIRST_FIELD);  
   }
  
  }
  
  public class ParserB {
  
   public enum Fields {
    B_FIRST_FIELD
    B_SECOND_FIELD
   }
  
   public void parse() {
    ... 
    throw ParserException(Fields.B_FIRST_FIELD);  
   }
  
  }
  
  
  
  // Parser error
  public class ParserException extends Exception {
  
   enum fieldName; // ????? what goes here?
  
  
   public ParserException(enum e) {
    this.fieldName = e;
   }
  
   public enum getFieldName() {  // ?????? how do I do something like this?
    return fieldName;
   }
  
  }
  </code></pre>