[shrinkwrap-issues] [JBoss JIRA] Commented: (SHRINKWRAP-260) Anti-pattern use of getPackage

Aslak Knutsen (JIRA) jira-events at lists.jboss.org
Tue Mar 15 12:43:45 EDT 2011


    [ https://issues.jboss.org/browse/SHRINKWRAP-260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12588073#comment-12588073 ] 

Aslak Knutsen commented on SHRINKWRAP-260:
------------------------------------------

Workarounds/alternatives exists:

addPackage(String) <-- this is what addPackage(Package) will end up as

or addPackage(Class.getPackage()) <-- to force load (to some extent refactor safe)

Should addPackage(Package) be removed? The above refactor safe example can be rewritten as addPackage(Class.getPackage().getName())

> Anti-pattern use of getPackage
> ------------------------------
>
>                 Key: SHRINKWRAP-260
>                 URL: https://issues.jboss.org/browse/SHRINKWRAP-260
>             Project: ShrinkWrap
>          Issue Type: Bug
>            Reporter: Carlo de Wolf
>
> ClassContainer.addPackage suffers from an anti-pattern, because Package.getPackage returns null if no classes have been loaded from that package yet.
> As an example see org.jboss.jsfunit.arquillian.JSFUnitApplicationArchiveProcessor.

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


More information about the shrinkwrap-issues mailing list