Issue Type: Bug Bug
Affects Versions: 2.0.3.Final
Assignee: Jozef Hartinger
Created: 26/Aug/13 11:26 AM
Description:

Weld fails to create beans for types that are defined as anonymous classes:

...
Caused by: org.jboss.weld.exceptions.IllegalArgumentException: WELD-001456 Argument bean must not be null
	at org.jboss.weld.util.Preconditions.checkArgumentNotNull(Preconditions.java:40)
	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:752)
	at org.jboss.weld.util.ForwardingBeanManager.getReference(ForwardingBeanManager.java:61)
	at org.jboss.weld.bean.builtin.BeanManagerProxy.getReference(BeanManagerProxy.java:72)
	at org.jboss.forge.furnace.container.cdi.services.ExportedInstanceImpl$1.call(ExportedInstanceImpl.java:55)
	at org.jboss.forge.furnace.util.ClassLoaders.executeIn(ClassLoaders.java:34)
	at org.jboss.forge.furnace.container.cdi.services.ExportedInstanceImpl.get(ExportedInstanceImpl.java:63)
	... 116 more

This can be reproduced via the attached projects. But this is the code snippit causing failure:


   @Test
   public void testCreateProject() throws Exception
   {
      final AtomicBoolean projectSet = new AtomicBoolean(false);
      ListenerRegistration<ProjectListener> registration = projectFactory.addProjectListener(new ProjectListener()
      {
         @Override
         public void projectCreated(Project project)
         {
            projectSet.set(true);
         }
      });
      Assert.assertNotNull("Should not have returned a null listener registration", registration);
      Project project = projectFactory.createTempProject();
      registration.removeListener();
      Assert.assertNotNull(project);
      Assert.assertTrue("Listener was not called", projectSet.get());
   }

If this anonymous class is commented out of the test case, Weld does not fail due to bean construction failure.

Project: Weld
Priority: Major Major
Reporter: Lincoln Baxter III
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira