title: Access protected fields of a subclass in a superclass?
body: <p>Is it possible to access a <code>protected</code> member from <code>Subclass</code> in a <code>SuperClass</code> using reflection?</p>
  
  <pre><code>private void accessFields() {
      Field[] fields = this.getClass().getDeclaredFields();
      for(Field field : fields) {
          if(Modifier.isProtected(field.getModifiers()) {
              //Will this always work? Or will get(this) throw an IllegalAccessException?
              Object value = field.get(this);
          }
      }
  }
  </code></pre>
  
  <p>Note that this would be the opposite way of the common <code>protected</code> member access, not the <code>SubClass</code> accesses the <code>protected</code> member, but the <code>SuperClass</code>.</p>