Improve handling of moniker import/exports and the JDK#227
Conversation
Previously, when a Maven package re-defined a class from the JDK then lsif-java would emit an export against the JDK instead of the Maven package. This caused problems with navigation to the JDK on Sourcegraph because there were multiple repositories that exported monikers against the `jdk/8` packageInformation node. Now, only the JDK repo should export monikers for the JDK repo.
Previously, there was a small risk that lsif-java would export symbols against the JDK when indexing non-JDK packages like com.google.gwt:gwt-user:2.9.0, which contain source files for `java.lang.String` but don't define `java/lang/String.class`. This commit, adds a special case for the JDK so that monikers for JDK symbols are always imported when indexing non-JDK repos.
|
Just so I understand correctly, will this mean that definitions of jdk classes in non jdk repos will have an import moniker attached to them instead of an export moniker? How does that behaviour work in sourcegraph? Im assuming go-to-def on the "shadowed" definition will bring you to the jdk definition instead, which would seem reasonable, and go-to-def on references to the shadowed symbol will also bring you to the jdk definition instead? The only way to find the shadowed definitions then are via find references. Does this sound right? |
|
I haven't validated the answers below but will answer with my intuition about the expected behavior.
Correct, that's my intuition as well.
Correct, the shadow definition will only appear as a reference. |
See individual commits for details. Related issue https://github.com/sourcegraph/sourcegraph/issues/21058