[cdi-dev] [JBoss JIRA] (CDI-332) Broken example for obtaining unmanaged instance

Martin Kouba (JIRA) jira-events at lists.jboss.org
Mon Mar 4 06:14:56 EST 2013


Martin Kouba created CDI-332:
--------------------------------

             Summary: Broken example for obtaining unmanaged instance
                 Key: CDI-332
                 URL: https://issues.jboss.org/browse/CDI-332
             Project: CDI Specification Issues
          Issue Type: Bug
    Affects Versions: 1.1.PFD
            Reporter: Martin Kouba
            Priority: Minor


The example in the spec text and javadoc:
{code}
Unmanaged unmanagedFoo = new Unmanaged(Foo.class);
UnmanagedInstance fooInstance = unManagedFoo.newInstance();
Foo foo = fooInstance.produce().inject().postConstruct();
// Use the foo instance
fooInstance.preDestroy().dispose();
{code}
should be replaced with something like this:
{code}
Unmanaged<Foo> unmanagedFoo = new Unmanaged<Foo>(Foo.class);
UnmanagedInstance<Foo> fooInstance = unmanagedFoo.newInstance();
Foo foo = fooInstance.produce().inject().postConstruct().get();
// Use the foo instance
fooInstance.preDestroy().dispose();
{code}
Note the generics, unManagedFoo -> unmanagedFoo and missing {{get()}}.

--
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


More information about the cdi-dev mailing list