title: JAXB Adapter is not picked up
body: <p>I have a pojo item that I need to serialize.
  Primitives of pojo have a "logical null"    (when primitive equals to some specific value it's null).<br>
  The requirement of serialization is to return it as null, therefor I must create adapters where I wrapp primitives with objects and in case, the primitive is "null" set the object to null.</p>
  
  <p>The problem is that adapter is not picked up. The wiring is done via package-info.</p>
  
  <p>Object:</p>
  
  <pre><code>@XmlRootElement
  public class Item {
      String name;
      int id;
      long price;
  
      public String getName() {
          return name;
      }
      public void setName(String name) {
          this.name = name;
      }
      public int getId() {
          return id;
      }
      public void setId(int id) {
          this.id = id;
      }
      public long getPrice() {
          return price;
      }
      public void setPrice(long price) {
          this.price = price;
      }
  
  
      @XmlTransient
      public boolean isIdNull(){
          return id==-99888899;
      }
      @XmlTransient
      public boolean isPriceNull(){
          return price==-1775445454544L;
      }
  </code></pre>
  
  <p>This is the wrapper class with adapter.</p>
  
  <pre><code>@XmlType(name = "item")
  public class ItemAdapterWrapper {
  
      String name;
      Integer id;
      Long price;
  
      @XmlElement
      public Integer getId() {
          return id;
      }
  
      public void setId(Integer id) {
          this.id = id;
      }
  
      @XmlElement
      public Long getPrice() {
          return price;
      }
  
      public void setPrice(Long price) {
          this.price = price;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      @XmlElement
      public String getName() {
          return name;
      }
  
      public static class ItemAdapter extends XmlAdapter&lt;ItemAdapterWrapper, Item&gt; {
  
          @Override
          public Item unmarshal(ItemAdapterWrapper v) throws Exception {
              if (v == null) {
                  return null;
              }
  
              Item item = new Item();
  
              if (v.getName() != null)
                  item.setName(v.getName());
  
              if (v.getPrice() != null)
                  item.setPrice(v.getPrice());
  
              if (v.getId() != null)
                  item.setId(v.getId());
  
              return item;
          }
  
          @Override
          public ItemAdapterWrapper marshal(Item v) throws Exception {
              if (v == null) {
                  return null;
              }
  
              ItemAdapterWrapper ItemAdapterWrapper = new ItemAdapterWrapper();
  
              if (!v.isIdNull()) {
                  ItemAdapterWrapper.setId(v.getId());
              }
  
              if (!v.isPriceNull()) {
                  ItemAdapterWrapper.setPrice(v.getPrice());
              }
  
              ItemAdapterWrapper.setName(v.getName());
  
              return ItemAdapterWrapper;
          }
  
      }
  </code></pre>
  
  <p>package-info.java:</p>
  
  <pre><code>    @XmlJavaTypeAdapters({
          @javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter(value=ItemAdapterWrapper.ItemAdapter.class, type=Item.class) })  
  package org.datatypes;
  </code></pre>
  
  <p>All are in same package.
  When I try to marshal:</p>
  
  <pre><code>Item item = new Item();
  item.setName("XXX");
  item.setId(4);
  
  StringWriter output = new StringWriter();
  JAXBContext context = JAXBContext.newInstance(Item.class);
  Marshaller m = context.createMarshaller();
  m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
  m.marshal(item, output);
  System.out.println(output.toString());
  </code></pre>
  
  <p>Adapter class is not triggered (I set breakpoints) and original Item is getting serialized.</p>
  
  <p>What did I miss?</p>
  
  <p>It's not like the existing question, as I don't have annotation over pojo, and I use package-info.</p>