Skip to content

Commit aaee102

Browse files
authored
Remove duplicate classpath (#223)
* Remove duplicate classpath. * use LinkedHashSet to check duplicate and keep the order.
1 parent dff4ee0 commit aaee102

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveClasspathsHandler.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
package com.microsoft.java.debug.plugin.internal;
1313

1414
import java.util.ArrayList;
15+
import java.util.LinkedHashSet;
1516
import java.util.List;
17+
import java.util.Set;
1618
import java.util.logging.Level;
1719
import java.util.logging.Logger;
1820
import java.util.stream.Collectors;
@@ -177,7 +179,7 @@ private static String[][] computeClassPath(IJavaProject javaProject) throws Core
177179

178180
private static String[] computeDefaultRuntimeClassPath(IJavaProject jproject) throws CoreException {
179181
IRuntimeClasspathEntry[] unresolved = JavaRuntime.computeUnresolvedRuntimeClasspath(jproject);
180-
List<String> resolved = new ArrayList<>(unresolved.length);
182+
Set<String> resolved = new LinkedHashSet<String>();
181183
for (int i = 0; i < unresolved.length; i++) {
182184
IRuntimeClasspathEntry entry = unresolved[i];
183185
if (entry.getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) {
@@ -189,6 +191,7 @@ private static String[] computeDefaultRuntimeClassPath(IJavaProject jproject) th
189191
}
190192
String location = entries[j].getLocation();
191193
if (location != null) {
194+
// remove duplicate classpath
192195
resolved.add(location);
193196
}
194197
}

0 commit comments

Comments
 (0)