title: Java private method hiding public accessors
body: <p>I have a class like this:</p>
  
  <pre><code>import java.util.List;
  import java.util.String;
  import javax.xml.bind.annotation.XmlType;
  
  @XmlType
  public class Foo {
      private List&lt;Foo&gt; compound;
      private String bar; 
  
      // private method used internally to know 
      // if this is a compound instance
      private boolean isCompound() {
         return compound != null &amp;&amp; compound.size() != 0;
      }
  
      // public setter for compound instance var
      public void setCompound(List&lt;Foo&gt; compound) {
          this.compound = compound;
      }
  
      // public getter for compound instance var
      public List&lt;Foo&gt; getCompound() {
          return compound;
      }
  
      public void setBar(String bar) {
          this.bar = bar;
      }
  
      public String getBar() {
          return bar;
      }
  }
  </code></pre>
  
  <p>In normal use, this class behaves as you would expect. The methods <code>getCompound</code> and <code>setCompound</code> get and set the compound list. However, I'm using this class as an object that's passed in a web service built using JAX-WS. When the JAX-WS compiler sees this class, it ignores the <code>setCompound</code> and <code>getCompound</code> accessors, and the only property that appears in the XSD is <code>bar</code>.</p>
  
  <p>After banging my head against the wall for most of the day, I decided to try changing the name of the private method <code>isCompound</code> to <code>isACompound</code> and suddenly everything worked as you'd expect. JAX-WS created the correct schema for the <code>compound</code> property.</p>
  
  <p>What seems to be happening is that JAX-WS is seeing the <code>isCompound</code> method (even though it's private) and treating it as a getter with no corresponding setter and therefore ignoring the real public accessors for <code>compound</code>.</p>
  
  <p>Is there anything in the Java Bean specification that says you can't have a private <code>is&lt;Something&gt;</code> method where <code>&lt;something&gt;</code> is also the name of a non-boolean property, which also has its own accessors? Surely anything using reflection on the class should simply ignore private methods?</p>