title: Java switch statement using class.getSimpleName() gives Constant express required error
body: <p>I'm trying to use class.getSimpleName() for the expression of a switch however it gives me an error: </p>
  
  <blockquote>
    <p>Constant express required</p>
  </blockquote>
  
  <p>I've seen answers suggesting to change the expression variable declarations to have initializers that are compile-time constant expressions. However, this is not possible in this case.</p>
  
  <p>Is there a way to make a switch using class.getSimpleName() without having to hardcode the class names?</p>
  
  <p><strong>Example code</strong></p>
  
  <pre><code>public class ClassA {
     public static final String TAG = ClassA.class.getSimpleName();
     ...
  }
  
  public class ClassB {
    public static final String TAG = ClassB.class.getSimpleName();
    ...
  }
  
  public class SomeOtherClass {
    switch (express) {
       case ClassA.TAG: // Error here
          ...
          break;
       case ClassB.TAG: // and here
          ...
          break;
       default:
          ...
          break;
   }
  </code></pre>