private Collection < ? extends ResourceRoot > handleClassPathItems ( final DeploymentUnit deploymentUnit ) { final Set < ResourceRoot > additionalRoots = new HashSet < ResourceRoot > ( ) ; final ArrayDeque < ResourceRoot > toProcess = new ArrayDeque < ResourceRoot > ( ) ; final List < ResourceRoot > resourceRoots = DeploymentUtils . allResourceRoots ( deploymentUnit ) ; toProcess . addAll ( resourceRoots ) ; final Set < ResourceRoot > processed = new HashSet < ResourceRoot > ( resourceRoots ) ; while ( ! toProcess . isEmpty ( ) ) { final ResourceRoot root = toProcess . pop ( ) ; final List < ResourceRoot > classPathRoots = root . getAttachmentList ( Attachments . CLASS_PATH_RESOURCE_ROOTS ) ; for ( ResourceRoot cpRoot : classPathRoots ) { if ( ! processed . contains ( cpRoot ) ) { additionalRoots . add ( cpRoot ) ; toProcess . add ( cpRoot ) ; processed . add ( cpRoot ) ; } } } return additionalRoots ; }
Loops through all resource roots that have been made available transitively via Class - Path entries and adds them to the list of roots to be processed .