diff --git a/sootup.java.bytecode/src/main/java/sootup/java/bytecode/inputlocation/PathBasedAnalysisInputLocation.java b/sootup.java.bytecode/src/main/java/sootup/java/bytecode/inputlocation/PathBasedAnalysisInputLocation.java index ee36143a737..e247066692b 100644 --- a/sootup.java.bytecode/src/main/java/sootup/java/bytecode/inputlocation/PathBasedAnalysisInputLocation.java +++ b/sootup.java.bytecode/src/main/java/sootup/java/bytecode/inputlocation/PathBasedAnalysisInputLocation.java @@ -129,8 +129,10 @@ public static PathBasedAnalysisInputLocation create( @Nonnull List bodyInterceptors, @Nonnull Collection ignoredPaths) { - if(ignoredPaths.stream().anyMatch( ignoPath -> path.toString().startsWith(ignoPath.toString()) )){ - throw new IllegalArgumentException("The Path for the AnalysisInputLocation is in the ignored paths."); + if (ignoredPaths.stream() + .anyMatch(ignoPath -> path.toString().startsWith(ignoPath.toString()))) { + throw new IllegalArgumentException( + "The Path for the AnalysisInputLocation is in the ignored paths."); } if (Files.isDirectory(path)) { @@ -162,10 +164,11 @@ Collection walkDirectory( final String moduleInfoFilename = JavaModuleIdentifierFactory.MODULE_INFO_FILE + ".class"; try (final Stream walk = Files.walk(dirPath)) { return walk.filter( - filePath -> PathUtils.hasExtension(filePath, handledFileType) + filePath -> + PathUtils.hasExtension(filePath, handledFileType) && !filePath.toString().endsWith(moduleInfoFilename) - && ignoredPaths.stream().noneMatch(p -> filePath.toString().startsWith(p.toString())) - ) + && ignoredPaths.stream() + .noneMatch(p -> filePath.toString().startsWith(p.toString()))) .flatMap( p -> { final String fullyQualifiedName = fromPath(dirPath, p); diff --git a/sootup.java.bytecode/src/test/java/sootup/java/bytecode/inputlocation/MultiReleaseJarAnalysisInputLocationTest.java b/sootup.java.bytecode/src/test/java/sootup/java/bytecode/inputlocation/MultiReleaseJarAnalysisInputLocationTest.java index d64ff97d256..909e0fb5ed3 100644 --- a/sootup.java.bytecode/src/test/java/sootup/java/bytecode/inputlocation/MultiReleaseJarAnalysisInputLocationTest.java +++ b/sootup.java.bytecode/src/test/java/sootup/java/bytecode/inputlocation/MultiReleaseJarAnalysisInputLocationTest.java @@ -32,7 +32,6 @@ import java.util.List; import java.util.Optional; import java.util.stream.Collectors; - import org.junit.Assert; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -91,17 +90,15 @@ public void multiReleaseJar() { "/de/upb/sse/multirelease/Main.class", view_8.getClass(classType2).get().getClassSource().getSourcePath().toString()); // assert that method is correctly resolved to base - MethodSubSignature printBodyMethodSubSig = getIdentifierFactory() + MethodSubSignature printBodyMethodSubSig = + getIdentifierFactory() .getMethodSubSignature( - "printVersion", - getIdentifierFactory().getType("void"), - Collections.emptyList()); + "printVersion", getIdentifierFactory().getType("void"), Collections.emptyList()); Assert.assertTrue( view_8 .getClass(classType) .get() - .getMethod( - printBodyMethodSubSig) + .getMethod(printBodyMethodSubSig) .get() .getBody() .toString() @@ -128,8 +125,7 @@ public void multiReleaseJar() { view_10 .getClass(classType) .get() - .getMethod( - printBodyMethodSubSig) + .getMethod(printBodyMethodSubSig) .get() .getBody() .toString() @@ -151,16 +147,24 @@ public void multiReleaseJar() { "/de/upb/sse/multirelease/Main.class", view_max.getClass(classType2).get().getClassSource().getSourcePath().toString()); - // getClasses - List collectedClassesWPrintBody9 = view_9.getClasses().stream().map(c -> c.getMethod(printBodyMethodSubSig)).filter(Optional::isPresent).map(m -> m.get().getBody().toString()).collect(Collectors.toList()); + List collectedClassesWPrintBody9 = + view_9.getClasses().stream() + .map(c -> c.getMethod(printBodyMethodSubSig)) + .filter(Optional::isPresent) + .map(m -> m.get().getBody().toString()) + .collect(Collectors.toList()); assertEquals(1, collectedClassesWPrintBody9.size()); assertTrue(collectedClassesWPrintBody9.get(0).contains("java 9")); - List collectedClassesWPrintBody10 = view_10.getClasses().stream().map(c -> c.getMethod(printBodyMethodSubSig)).filter(Optional::isPresent).map(m -> m.get().getBody().toString()).collect(Collectors.toList()); + List collectedClassesWPrintBody10 = + view_10.getClasses().stream() + .map(c -> c.getMethod(printBodyMethodSubSig)) + .filter(Optional::isPresent) + .map(m -> m.get().getBody().toString()) + .collect(Collectors.toList()); assertEquals(1, collectedClassesWPrintBody10.size()); assertTrue(collectedClassesWPrintBody10.get(0).contains("java 10")); - } @Test