[weld-issues] [JBoss JIRA] Updated: (WELD-873) Injections not working for certain bean methods

Pete Muir (JIRA) jira-events at lists.jboss.org
Fri Mar 25 06:44:45 EDT 2011


     [ https://issues.jboss.org/browse/WELD-873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pete Muir updated WELD-873:
---------------------------

    Description: 
Given a class 

{code}
@RequestScoped
@Named
public class Foo implements Map<String, ResourceBundle>, Serializable
{
   @Inject
   BeanManager beanManager;

   public int size()
   {
      // TODO Auto-generated method stub
      return 0;
   }

   public boolean isEmpty()
   {
      // TODO Auto-generated method stub
      return false;
   }

   public boolean containsKey(Object key)
   {
      // TODO Auto-generated method stub
      return false;
   }

   public boolean containsValue(Object value)
   {
      // TODO Auto-generated method stub
      return false;
   }

   public ResourceBundle get(Object key)
   {
      if (beanManager == null)
      {
         throw new NullPointerException();
      }
      return null;
   }

   public ResourceBundle put(String key, ResourceBundle value)
   {
      // TODO Auto-generated method stub
      return null;
   }

   public ResourceBundle remove(Object key)
   {
      // TODO Auto-generated method stub
      return null;
   }

   public void putAll(Map<? extends String, ? extends ResourceBundle> m)
   {
      // TODO Auto-generated method stub

   }

   public void clear()
   {
      // TODO Auto-generated method stub

   }

   public Set<String> keySet()
   {
      // TODO Auto-generated method stub
      return null;
   }

   public Collection<ResourceBundle> values()
   {
      // TODO Auto-generated method stub
      return null;
   }

   public Set<java.util.Map.Entry<String, ResourceBundle>> entrySet()
   {
      // TODO Auto-generated method stub
      return null;
   }

}
{code}

The following test fails

{code}
@RunWith(Arquillian.class)
public class StrangeTest
{
   @Inject
   Foo foo;

   @Deployment
   public static Archive<?> deploy()
   {
      return ShrinkWrap.create(BeanArchive.class).addClass(Foo.class);
   }

   @Test
   public void testAccess()
   {
      Assert.assertNull(foo.get("bleh"));
   }
   
}
{code}

  was:
Given a class 

@RequestScoped
@Named
public class Foo implements Map<String, ResourceBundle>, Serializable
{
   @Inject
   BeanManager beanManager;

   public int size()
   {
      // TODO Auto-generated method stub
      return 0;
   }

   public boolean isEmpty()
   {
      // TODO Auto-generated method stub
      return false;
   }

   public boolean containsKey(Object key)
   {
      // TODO Auto-generated method stub
      return false;
   }

   public boolean containsValue(Object value)
   {
      // TODO Auto-generated method stub
      return false;
   }

   public ResourceBundle get(Object key)
   {
      if (beanManager == null)
      {
         throw new NullPointerException();
      }
      return null;
   }

   public ResourceBundle put(String key, ResourceBundle value)
   {
      // TODO Auto-generated method stub
      return null;
   }

   public ResourceBundle remove(Object key)
   {
      // TODO Auto-generated method stub
      return null;
   }

   public void putAll(Map<? extends String, ? extends ResourceBundle> m)
   {
      // TODO Auto-generated method stub

   }

   public void clear()
   {
      // TODO Auto-generated method stub

   }

   public Set<String> keySet()
   {
      // TODO Auto-generated method stub
      return null;
   }

   public Collection<ResourceBundle> values()
   {
      // TODO Auto-generated method stub
      return null;
   }

   public Set<java.util.Map.Entry<String, ResourceBundle>> entrySet()
   {
      // TODO Auto-generated method stub
      return null;
   }

}

The following test fails

@RunWith(Arquillian.class)
public class StrangeTest
{
   @Inject
   Foo foo;

   @Deployment
   public static Archive<?> deploy()
   {
      return ShrinkWrap.create(BeanArchive.class).addClass(Foo.class);
   }

   @Test
   public void testAccess()
   {
      Assert.assertNull(foo.get("bleh"));
   }
   
}



> Injections not working for certain bean methods
> -----------------------------------------------
>
>                 Key: WELD-873
>                 URL: https://issues.jboss.org/browse/WELD-873
>             Project: Weld
>          Issue Type: Bug
>            Reporter: Nicklas Karlsson
>
> Given a class 
> {code}
> @RequestScoped
> @Named
> public class Foo implements Map<String, ResourceBundle>, Serializable
> {
>    @Inject
>    BeanManager beanManager;
>    public int size()
>    {
>       // TODO Auto-generated method stub
>       return 0;
>    }
>    public boolean isEmpty()
>    {
>       // TODO Auto-generated method stub
>       return false;
>    }
>    public boolean containsKey(Object key)
>    {
>       // TODO Auto-generated method stub
>       return false;
>    }
>    public boolean containsValue(Object value)
>    {
>       // TODO Auto-generated method stub
>       return false;
>    }
>    public ResourceBundle get(Object key)
>    {
>       if (beanManager == null)
>       {
>          throw new NullPointerException();
>       }
>       return null;
>    }
>    public ResourceBundle put(String key, ResourceBundle value)
>    {
>       // TODO Auto-generated method stub
>       return null;
>    }
>    public ResourceBundle remove(Object key)
>    {
>       // TODO Auto-generated method stub
>       return null;
>    }
>    public void putAll(Map<? extends String, ? extends ResourceBundle> m)
>    {
>       // TODO Auto-generated method stub
>    }
>    public void clear()
>    {
>       // TODO Auto-generated method stub
>    }
>    public Set<String> keySet()
>    {
>       // TODO Auto-generated method stub
>       return null;
>    }
>    public Collection<ResourceBundle> values()
>    {
>       // TODO Auto-generated method stub
>       return null;
>    }
>    public Set<java.util.Map.Entry<String, ResourceBundle>> entrySet()
>    {
>       // TODO Auto-generated method stub
>       return null;
>    }
> }
> {code}
> The following test fails
> {code}
> @RunWith(Arquillian.class)
> public class StrangeTest
> {
>    @Inject
>    Foo foo;
>    @Deployment
>    public static Archive<?> deploy()
>    {
>       return ShrinkWrap.create(BeanArchive.class).addClass(Foo.class);
>    }
>    @Test
>    public void testAccess()
>    {
>       Assert.assertNull(foo.get("bleh"));
>    }
>    
> }
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the weld-issues mailing list