Implement a new design based on a Java compiler plugin that generates SemanticDB#85
Merged
olafurpg merged 6 commits intosourcegraph:mainfrom Feb 11, 2021
Merged
Conversation
The next commits add a new implementation.
Strum355
reviewed
Feb 11, 2021
Comment on lines
+16
to
+26
| private static String bytesToHex(byte[] bytes) { | ||
| char[] hexChars = new char[bytes.length * 2]; | ||
| int j = 0; | ||
| while (j < bytes.length) { | ||
| int v = bytes[j] & 0xFF; | ||
| hexChars[j * 2] = HEX_ARRAY[v >>> 4]; | ||
| hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F]; | ||
| j += 1; | ||
| } | ||
| return new String(hexChars); | ||
| } |
Contributor
There was a problem hiding this comment.
I think this could be replaced with javax.xml.bind.DataTypeConverter.printHexBinary but no big deal
Contributor
Author
There was a problem hiding this comment.
IntelliJ says this class exists in rt.jar but I can't find it in my Java home
❯ jar tf jre/lib/rt.jar | grep javax.xml.bind.DataTypeConverter
<empty>
❯ javap -cp jre/lib/rt.jar javax.xml.bind.DataTypeConverter
Error: class not found: javax.xml.bind.DataTypeConverter
❯ javap -cp lib/tools.jar javax.xml.bind.DataTypeConverter
Error: class not found: javax.xml.bind.DataTypeConverter
Strum355
approved these changes
Feb 11, 2021
Contributor
Strum355
left a comment
There was a problem hiding this comment.
Nothing obvious stands out, LGTM
good stuff 👍
36 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR removes most of the contents from the original repo and introduces a new architecture for lsif-java.
In a nutshell, the new implementation includes a Java compiler plugin that generates one SemanticDB file for every
*.javasource file. After compilation completes, the SemanticDB files are processed to produce LSIF.The updated readme includes more details about the benefits of this new design.
You can try out the new precise code intelligence from the link below. Observe that navigating to a method name
app()goes to the precise implementation even if there are many classes that implement methods with the same nameapp().https://sourcegraph.com/github.com/sourcegraph/lsif-java@3cab1b8/-/blob/tests/minimized/src/main/java/minimized/MinimizedJavaMain.java#L13
There are still several known bugs like the incorrect highlighting in this "Find references" request
The combined diff in this PR is large, but the Java compiler plugin implementation is only 745 lines of code if you exclude the generated protobuf definitions. The bulk of the diff comes from the new "snapshot testing" infrastructure to index a corpus of the https://github.com/airbnb/epoxy library.