diff options
author | George Fraser <george@fivetran.com> | 2018-12-23 18:43:23 -0800 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2018-12-23 18:43:23 -0800 |
commit | b02d77b86299cb4a74f8db3ed345e6e023172d82 (patch) | |
tree | ef27678f3b8ea799ceedcc2117caad6584b0e36f /src/test/java | |
parent | e4d014e9542b355292487f6dd5ad0ba912c8625f (diff) | |
download | java-language-server-b02d77b86299cb4a74f8db3ed345e6e023172d82.zip |
Reduce use of TreePath
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/org/javacs/JavaCompilerServiceTest.java | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/test/java/org/javacs/JavaCompilerServiceTest.java b/src/test/java/org/javacs/JavaCompilerServiceTest.java index 6023337..d683dba 100644 --- a/src/test/java/org/javacs/JavaCompilerServiceTest.java +++ b/src/test/java/org/javacs/JavaCompilerServiceTest.java @@ -225,15 +225,9 @@ public class JavaCompilerServiceTest { var file = "/GotoDefinition.java"; var refs = compiler.references(resourceUri(file), contents(file), 6, 13, rrp); var stringify = new ArrayList<String>(); - for (var t : refs) { - var unit = t.getCompilationUnit(); - var name = Paths.get(unit.getSourceFile().toUri()).getFileName(); - var trees = compiler.trees(); - var pos = trees.getSourcePositions(); - var lines = unit.getLineMap(); - var start = pos.getStartPosition(unit, t.getLeaf()); - var line = lines.getLineNumber(start); - stringify.add(String.format("%s:%d", name, line)); + for (var r : refs) { + var fileName = Paths.get(r.fromFile).getFileName(); + stringify.add(String.format("%s:%d", fileName, r.startLine)); } assertThat(stringify, hasItem("GotoDefinition.java:3")); assertThat(stringify, not(hasItem("GotoDefinition.java:6"))); |