Skip to content

Commit

Permalink
simplify code that creates class stream #411
Browse files Browse the repository at this point in the history
  • Loading branch information
codecholeric authored Aug 19, 2020
2 parents 71ebda3 + 2fd7d32 commit e7529b1
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
import java.util.Optional;
import java.util.function.Predicate;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

import com.tngtech.archunit.Internal;
import com.tngtech.archunit.core.MayResolveTypesViaReflection;
import com.tngtech.archunit.core.domain.JavaClass;
import com.tngtech.archunit.core.domain.JavaClasses;
import com.tngtech.archunit.core.importer.ClassFileImporter;
import org.junit.platform.engine.EngineDiscoveryRequest;
import org.junit.platform.engine.ExecutionRequest;
Expand Down Expand Up @@ -143,15 +141,11 @@ private void resolveRequestedUniqueIds(EngineDiscoveryRequest discoveryRequest,
}

private Stream<JavaClass> getContainedClasses(String[] packages) {
return stream(new ClassFileImporter().importPackages(packages));
return new ClassFileImporter().importPackages(packages).stream();
}

private Stream<JavaClass> getContainedClasses(ClasspathRootSelector selector) {
return stream(new ClassFileImporter().importUrl(toUrl(selector.getClasspathRoot())));
}

private Stream<JavaClass> stream(JavaClasses classes) {
return StreamSupport.stream(classes.spliterator(), false);
return new ClassFileImporter().importUrl(toUrl(selector.getClasspathRoot())).stream();
}

private Predicate<JavaClass> isAllowedBy(EngineDiscoveryRequest discoveryRequest) {
Expand Down

0 comments on commit e7529b1

Please sign in to comment.