Skip to content

Commit

Permalink
Inline EmptyScanner into build context
Browse files Browse the repository at this point in the history
EmptyScanner is actually only used (and useful) in the
DefaultBuildContext and should be a private final inner class to not
blow the API that needs to be maintained.

Fix codehaus-plexus#46
  • Loading branch information
Christoph Läubrich committed Nov 23, 2022
1 parent 985c360 commit c2ae670
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 102 deletions.
40 changes: 39 additions & 1 deletion src/main/java/org/codehaus/plexus/build/DefaultBuildContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
Expand Down Expand Up @@ -47,6 +48,7 @@
@Singleton
public class DefaultBuildContext implements BuildContext {

private static final String[] EMPTY_STRING_ARRAY = new String[0];
private final Map<String, Object> contextMap = new ConcurrentHashMap<>();
private final Logger logger = LoggerFactory.getLogger(DefaultBuildContext.class);
/** {@inheritDoc} */
Expand Down Expand Up @@ -93,7 +95,43 @@ public void refresh(File file) {

/** {@inheritDoc} */
public Scanner newDeleteScanner(File basedir) {
return new EmptyScanner(basedir);
return new Scanner() {
@Override
public void addDefaultExcludes() {
}

@Override
public String[] getIncludedDirectories() {
return EMPTY_STRING_ARRAY;
}

@Override
public String[] getIncludedFiles() {
return EMPTY_STRING_ARRAY;
}

@Override
public void scan() {
}

@Override
public void setExcludes(String[] excludes) {
}

@Override
public void setIncludes(String[] includes) {
}

@Override
public File getBasedir() {
return basedir;
}

@Override
public void setFilenameComparator(Comparator<String> comparator) {

}
};
}

/** {@inheritDoc} */
Expand Down
101 changes: 0 additions & 101 deletions src/main/java/org/codehaus/plexus/build/EmptyScanner.java

This file was deleted.

0 comments on commit c2ae670

Please sign in to comment.