sdedic edited a comment on pull request #2650:
URL: https://github.com/apache/netbeans/pull/2650#issuecomment-756782805


   Now why the tests are different: the testsuite actually makes **one LSP 
connection per test case**. In our view of how the `Source` cache should behave 
for a LSP server, all those clients (e.g. multiple `vscode` instances) would 
share the cache: at the end of the day, requests to the same `FileObject` will 
point to the same place on the disk, so the project environment is the same 
(well, hypothetically two clients with different sets of libraries or JDK 
requirements may come in, but the LSP server is far from such complexities).
   
   I've even prototyped such global cache for `Source` objects, see 
https://github.com/sdedic/incubator-netbeans/tree/prototype/lsp-client-session-sources:
 all the `Source` objects received the true global `Lookup` as their context. 
But it turned out, that some code in NetBeans still invokes `Source.create()` 
without any context information, thus passing the effective request-specfic 
Lookup to the factory (which is OK), and compares *that specific Lookup* to the 
returned Source's context ... which is a bug.
   
   As explained above, the check should have checked whether the returned 
`Source`'s contex is  is "compatible" (allowed, ..) in the calling context. And 
Parsing API simply does not have information to do that check - pure identity 
check is far too strict.
   
   Uff.
   So many words for a one-liner fix.


----------------------------------------------------------------
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

Reply via email to