summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorGeorge Fraser <george@fivetran.com>2019-01-06 18:25:28 -0800
committerGeorge Fraser <george@fivetran.com>2019-01-06 18:25:28 -0800
commitdda8cbf25f44af704098eb13147f749322369f58 (patch)
tree0e191eb88158db6d5252d91bd6275019ce47a0f5 /src/test
parentae21ddac94d7124e165af531b77c3a43eadfdbed (diff)
downloadjava-language-server-dda8cbf25f44af704098eb13147f749322369f58.zip
Complete indirect superclasses
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/javacs/CompletionsTest.java10
-rw-r--r--src/test/test-project/workspace/src/org/javacs/example/CompleteIndirectSuper.java17
2 files changed, 27 insertions, 0 deletions
diff --git a/src/test/java/org/javacs/CompletionsTest.java b/src/test/java/org/javacs/CompletionsTest.java
index e00f6c4..4cef1fb 100644
--- a/src/test/java/org/javacs/CompletionsTest.java
+++ b/src/test/java/org/javacs/CompletionsTest.java
@@ -306,6 +306,16 @@ public class CompletionsTest extends CompletionsBase {
assertThat(suggestions, hasItems("length"));
}
+ @Test
+ public void indirectSuper() {
+ var file = "/org/javacs/example/CompleteIndirectSuper.java";
+
+ // a.?
+ var suggestions = insertText(file, 5, 14);
+
+ assertThat(suggestions, hasItems("selfMethod", "super1Method", "super2Method"));
+ }
+
@Ignore // We are now managing imports with FixImports
@Test
public void addImport() {
diff --git a/src/test/test-project/workspace/src/org/javacs/example/CompleteIndirectSuper.java b/src/test/test-project/workspace/src/org/javacs/example/CompleteIndirectSuper.java
new file mode 100644
index 0000000..d26b437
--- /dev/null
+++ b/src/test/test-project/workspace/src/org/javacs/example/CompleteIndirectSuper.java
@@ -0,0 +1,17 @@
+package org.javacs.example;
+
+class CompleteIndirectSuper extends CompleteIndirectSuper1 {
+ static void test(CompleteIndirectSuper self) {
+ self.
+ }
+
+ void selfMethod() { }
+}
+
+class CompleteIndirectSuper1 extends CompleteIndirectSuper2 {
+ void super1Method() { }
+}
+
+class CompleteIndirectSuper2 {
+ void super2Method() { }
+} \ No newline at end of file