Skip to content

Commit

Permalink
Reuse supplied import options in ClassFileImporter.importClasspath()
Browse files Browse the repository at this point in the history
Before this commit, all custom import options were ignored and replaced
with DO_NOT_INCLUDE_ARCHIVES.

From this commit on DO_NOT_INCLUDE_ARCHIVES will be added to the already
supplied import options.

Fixes TNG#296
  • Loading branch information
rweisleder committed Mar 7, 2020
1 parent a220200 commit 670c089
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public JavaClasses importPackagesOf(Collection<Class<?>> classes) {
*/
@PublicAPI(usage = ACCESS)
public JavaClasses importClasspath() {
return importClasspath(new ImportOptions().with(ImportOption.Predefined.DO_NOT_INCLUDE_ARCHIVES));
return importClasspath(importOptions.with(ImportOption.Predefined.DO_NOT_INCLUDE_ARCHIVES));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ public void imports_the_classpath() {
assertThatClasses(javaBaseClasses).doNotContain(ClassFileImporter.class, getClass(), Rule.class);
}

@Test
public void withImportOption_importClasspath() {
JavaClasses classes = new ClassFileImporter().withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS).importClasspath();

assertThatClasses(classes).contain(ClassFileImporter.class);
assertThatClasses(classes).doNotContain(getClass(), Rule.class, String.class);
}

@Test
public void imports_packages() {
JavaClasses classes = new ClassFileImporter().importPackages(
Expand Down

0 comments on commit 670c089

Please sign in to comment.