private WorkUnitProcessor<ClasspathEntryWorkUnit> newClasspathEntryWorkUnitProcessor(
            final Set<ClasspathElement> openedClasspathElementsSet,
            final Queue<Entry<Integer, ClasspathElement>> toplevelClasspathEltOrder) {
        return new WorkUnitProcessor<ClasspathEntryWorkUnit>() {
            @Override
            public void processWorkUnit(final ClasspathEntryWorkUnit workUnit,
                    final WorkQueue<ClasspathEntryWorkUnit> workQueue, final LogNode log)
                    throws InterruptedException {
                try {
                    // Create a ClasspathElementZip or ClasspathElementDir for each entry in the classpath
                    ClasspathElement classpathElt;
                    try {
                        classpathElt = classpathEntryToClasspathElementSingletonMap.get(workUnit.rawClasspathEntry,
                                log);
                    } catch (final NullSingletonException e) {
                        throw new IOException("Cannot get classpath element for classpath entry "
                                + workUnit.rawClasspathEntry + " : " + e);
                    }

                    // Only run open() once per ClasspathElement (it is possible for there to be
                    // multiple classpath elements with different non-canonical paths that map to
                    // the same canonical path, i.e. to the same ClasspathElement)
                    if (openedClasspathElementsSet.add(classpathElt)) {
                        // Check if the classpath element is valid (classpathElt.skipClasspathElement
                        // will be set if not). In case of ClasspathElementZip, open or extract nested
                        // jars as LogicalZipFile instances. Read manifest files for jarfiles to look
                        // for Class-Path manifest entries. Adds extra classpath elements to the work
                        // queue if they are found.
                        classpathElt.open(workQueue, log);

                        // Create a new tuple consisting of the order of the new classpath element
                        // within its parent, and the new classpath element.
                        // N.B. even if skipClasspathElement is true, still possibly need to scan child
                        // classpath elements (so still need to connect parent to child here)
                        final SimpleEntry<Integer, ClasspathElement> classpathEltEntry = //
                                new SimpleEntry<>(workUnit.orderWithinParentClasspathElement, classpathElt);
                        if (workUnit.parentClasspathElement != null) {
                            // Link classpath element to its parent, if it is not a toplevel element
                            workUnit.parentClasspathElement.childClasspathElementsIndexed.add(classpathEltEntry);
                        } else {
                            // Record toplevel elements
                            toplevelClasspathEltOrder.add(classpathEltEntry);
                        }
                    }
                } catch (final IOException | SecurityException e) {
                    if (log != null) {
                        log.log("Skipping invalid classpath element " + workUnit.rawClasspathEntry.getKey() + " : "
                                + e);
                    }
                }
            }
        };
    }
private WorkUnitProcessor < ClasspathEntryWorkUnit > newClasspathEntryWorkUnitProcessor ( final Set < ClasspathElement > openedClasspathElementsSet , final Queue < Entry < Integer , ClasspathElement > > toplevelClasspathEltOrder ) { return new WorkUnitProcessor < ClasspathEntryWorkUnit > ( ) { @ Override public void processWorkUnit ( final ClasspathEntryWorkUnit workUnit , final WorkQueue < ClasspathEntryWorkUnit > workQueue , final LogNode log ) throws InterruptedException { try { ClasspathElement classpathElt ; try { classpathElt = classpathEntryToClasspathElementSingletonMap . get ( workUnit . rawClasspathEntry , log ) ; } catch ( final NullSingletonException e ) { throw new IOException ( "Cannot get classpath element for classpath entry " + workUnit . rawClasspathEntry + " : " + e ) ; } if ( openedClasspathElementsSet . add ( classpathElt ) ) { classpathElt . open ( workQueue , log ) ; final SimpleEntry < Integer , ClasspathElement > classpathEltEntry = new SimpleEntry < > ( workUnit . orderWithinParentClasspathElement , classpathElt ) ; if ( workUnit . parentClasspathElement != null ) { workUnit . parentClasspathElement . childClasspathElementsIndexed . add ( classpathEltEntry ) ; } else { toplevelClasspathEltOrder . add ( classpathEltEntry ) ; } } } catch ( final IOException | SecurityException e ) { if ( log != null ) { log . log ( "Skipping invalid classpath element " + workUnit . rawClasspathEntry . getKey ( ) + " : " + e ) ; } } } } ; }
Create a WorkUnitProcessor for opening traditional classpath entries (which are mapped to
{@link ClasspathElementDir} or {@link ClasspathElementZip} -- {@link ClasspathElementModule is handled
separately}).

@param openedClasspathElementsSet
the opened classpath elements set
@param toplevelClasspathEltOrder
the toplevel classpath elt order
@return the work unit processor