sdedic commented on a change in pull request #2878:
URL: https://github.com/apache/netbeans/pull/2878#discussion_r612175108
##########
File path:
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceServiceImpl.java
##########
@@ -179,27 +180,25 @@
private CompletableFuture<Set<URL>> getTestRootURLs(Project prj) {
final Set<URL> testRootURLs = new HashSet<>();
- List<CompletableFuture<?>> futures = new ArrayList<>();
+ List<FileObject> contained = null;
if (prj != null) {
for (SourceGroup sg :
ProjectUtils.getSources(prj).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA))
{
for (URL url :
UnitTestForSourceQuery.findUnitTests(sg.getRootFolder())) {
testRootURLs.add(url);
}
}
- for (Project containedPrj : ProjectUtils.getContainedProjects(prj,
true)) {
- boolean testRootFound = false;
- for (SourceGroup sg :
ProjectUtils.getSources(containedPrj).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA))
{
+ contained = ProjectUtils.getContainedProjects(prj,
true).stream().map(p -> p.getProjectDirectory()).collect(Collectors.toList());
+ }
+ return server.asyncOpenSelectedProjects(contained).thenApply(projects
-> {
Review comment:
So the change here is first to open the subproject (to load all
metadata), then look for source groups ?
##########
File path:
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java
##########
@@ -1462,10 +1471,12 @@ public void didChange(DidChangeTextDocumentParams
params) {
@Override
public void didClose(DidCloseTextDocumentParams params) {
try {
+ String uri = params.getTextDocument().getUri();
+ upToDateTests.remove(uri);
// the order here is important ! As the file may cease to exist,
it's
// important that the doucment is already gone form the client.
- openedDocuments.remove(params.getTextDocument().getUri());
- FileObject file = fromURI(params.getTextDocument().getUri(), true);
+ openedDocuments.remove(uri);
Review comment:
Sorry to write here, I've just realized that `openedDocuments` may be
used from multiple threads - see l. 1250, called through `getJavaSource()` from
a worker RP. Similar through call to `getSource` at l. 641, 1260. Access to
the Map may need synchronization.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists