Skip to content

Commit 1cc62c8

Browse files
authored
Merge branch 'main' into wenyt/d1
2 parents 296d13c + a209e39 commit 1cc62c8

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @testforstephen @jdneo
1+
* @testforstephen @jdneo @chagong @wenytang-ms

com.microsoft.java.debug.core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<dependency>
4343
<groupId>org.apache.commons</groupId>
4444
<artifactId>commons-lang3</artifactId>
45-
<version>3.6</version>
45+
<version>3.18.0</version>
4646
</dependency>
4747
<dependency>
4848
<groupId>com.google.code.gson</groupId>

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.eclipse.core.runtime.IPath;
3636
import org.eclipse.jdt.core.IJavaProject;
3737
import org.eclipse.jdt.core.IMethod;
38+
import org.eclipse.jdt.core.JavaCore;
3839
import org.eclipse.jdt.core.JavaModelException;
3940
import org.eclipse.jdt.core.search.IJavaSearchConstants;
4041
import org.eclipse.jdt.core.search.IJavaSearchScope;
@@ -100,8 +101,18 @@ private List<ResolutionItem> resolveMainClassCore(List<Object> arguments) {
100101

101102
private List<ResolutionItem> resolveMainClassUnderPaths(List<IPath> parentPaths) {
102103
// Limit to search main method from source code only.
103-
IJavaSearchScope searchScope = SearchEngine.createJavaSearchScope(ProjectUtils.getJavaProjects(),
104-
IJavaSearchScope.REFERENCED_PROJECTS | IJavaSearchScope.SOURCES);
104+
IJavaProject[] projects;
105+
if (parentPaths == null || parentPaths.isEmpty()) {
106+
projects = ProjectUtils.getJavaProjects();
107+
} else {
108+
projects = Stream.of(ProjectUtils.getAllProjects())
109+
.filter(p -> ProjectUtils.isJavaProject(p) && p.getLocation() != null && ResourceUtils.isContainedIn(p.getLocation(), parentPaths))
110+
.map(p -> JavaCore.create(p))
111+
.filter(p -> p.exists())
112+
.toArray(IJavaProject[]::new);
113+
}
114+
IJavaSearchScope searchScope = SearchEngine.createJavaSearchScope(projects,
115+
IJavaSearchScope.SOURCES);
105116
SearchPattern pattern = createMainMethodSearchPattern();
106117
final List<ResolutionItem> res = new ArrayList<>();
107118
SearchRequestor requestor = new SearchRequestor() {

0 commit comments

Comments
 (0)