Skip to content

Commit

Permalink
correct wildcard expansion in classpath arguments (#5090)
Browse files Browse the repository at this point in the history
  • Loading branch information
markro49 authored Mar 22, 2022
1 parent 4491846 commit 91ec466
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,12 @@ private String concatenatePaths(List<String> paths) {

/**
* Given a path element that might be a wildcard, return a list of the elements it expands to. If
* the element isn't a wildcard, return a singleton list containing the argument.
* the element isn't a wildcard, return a singleton list containing the argument. Since the
* original argument list is placed after 'com.sun.tools.javac.Main' in the new command line, the
* JVM doesn't do wildcard expansion of jar files in any classpaths in the original argument list.
*
* @param pathElement an element of a classpath
* @return all elements of a classpath with wildcards expanded
*/
private List<String> expandWildcards(String pathElement) {
if (pathElement.equals("*")) {
Expand All @@ -541,6 +546,10 @@ private List<String> jarFiles(String directory) {
if (jarFiles == null) {
return Collections.emptyList();
}
// concat directory with jar file path to give full path
for (int i = 0; i < jarFiles.length; i++) {
jarFiles[i] = directory + jarFiles[i];
}
return Arrays.asList(jarFiles);
}

Expand Down

0 comments on commit 91ec466

Please sign in to comment.