|
29 | 29 | import org.eclipse.jdt.core.search.SearchParticipant; |
30 | 30 | import org.eclipse.jdt.core.search.SearchPattern; |
31 | 31 | import org.eclipse.jdt.core.search.SearchRequestor; |
| 32 | +import org.eclipse.jdt.launching.IRuntimeClasspathEntry; |
32 | 33 | import org.eclipse.jdt.launching.JavaRuntime; |
33 | 34 |
|
34 | 35 | import com.microsoft.java.debug.core.Configuration; |
@@ -162,12 +163,34 @@ private static String[][] computeClassPath(IJavaProject javaProject) throws Core |
162 | 163 | } |
163 | 164 | String[][] result = new String[2][]; |
164 | 165 | if (JavaRuntime.isModularProject(javaProject)) { |
165 | | - result[0] = JavaRuntime.computeDefaultRuntimeClassPath(javaProject); |
| 166 | + result[0] = computeDefaultRuntimeClassPath(javaProject); |
166 | 167 | result[1] = new String[0]; |
167 | 168 | } else { |
168 | 169 | result[0] = new String[0]; |
169 | | - result[1] = JavaRuntime.computeDefaultRuntimeClassPath(javaProject); |
| 170 | + result[1] = computeDefaultRuntimeClassPath(javaProject); |
170 | 171 | } |
171 | 172 | return result; |
172 | 173 | } |
| 174 | + |
| 175 | + private static String[] computeDefaultRuntimeClassPath(IJavaProject jproject) throws CoreException { |
| 176 | + IRuntimeClasspathEntry[] unresolved = JavaRuntime.computeUnresolvedRuntimeClasspath(jproject); |
| 177 | + List<String> resolved = new ArrayList<>(unresolved.length); |
| 178 | + for (int i = 0; i < unresolved.length; i++) { |
| 179 | + IRuntimeClasspathEntry entry = unresolved[i]; |
| 180 | + if (entry.getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) { |
| 181 | + IRuntimeClasspathEntry[] entries = JavaRuntime.resolveRuntimeClasspathEntry(entry, jproject); |
| 182 | + for (int j = 0; j < entries.length; j++) { |
| 183 | + |
| 184 | + if (entries[j].getClasspathEntry().isTest()) { |
| 185 | + continue; |
| 186 | + } |
| 187 | + String location = entries[j].getLocation(); |
| 188 | + if (location != null) { |
| 189 | + resolved.add(location); |
| 190 | + } |
| 191 | + } |
| 192 | + } |
| 193 | + } |
| 194 | + return resolved.toArray(new String[resolved.size()]); |
| 195 | + } |
173 | 196 | } |
0 commit comments