title: Why doesn't JAXB allow annotations on getters that all pull from the same member variable?
body: <p>Why does example A work, while example B throws a "JAXB annotation is placed on a method that is not a JAXB property" exception?</p>
  
  <p>I'm using JAX-WS with Spring MVC.</p>
  
  <p><strong>Example A</strong></p>
  
  <pre><code>package com.casanosa2.permissions;
  
  import javax.xml.bind.annotation.XmlAccessType;
  import javax.xml.bind.annotation.XmlAccessorType;
  import javax.xml.bind.annotation.XmlElement;
  import javax.xml.bind.annotation.XmlType;
  
  @XmlAccessorType(XmlAccessType.PROPERTY)
  @XmlType(name = "FooXMLMapper")
  public class FooXMLMapper implements IFoo {
  
   @XmlElement
   private final boolean propA;
  
   @XmlElement
   private final boolean propB;
  
   public FooMapper(IFoo foo) {
    propA = foo.getPropA()
    propB = foo.getPropB()
   }
  
   public FooMapper() {
    propA = false;
    propB = false;
   }
  
   @Override
   public boolean getPropA() {
    return propA;
   }
  
   @Override
   public boolean getPropB() {
    return propB;
   }
  }
  </code></pre>
  
  <p><strong>Example B</strong></p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.PROPERTY)
  @XmlType(name = "FooXMLMapper")
  public class FooXMLMapper {
  
   private final IFoo foo;
  
   public FooMapper() {
    foo = new IFoo() {
  
     @Override
     public boolean getPropA() {
      return false;
     }
  
     @Override
     public boolean getPropB() {
      return false;
     }
  
    };
   }
  
   public FooXMLMapper(IFoo foo) {
    this.foo = foo;
   }
  
   @XmlElement
   public boolean getPropA() {
    return foo.getPropA();
   }
  
   @XmlElement
   public boolean getPropB() {
    return foo.getPropB();
   }
  }
  </code></pre>