PT #164474609: Light TypeDescriptorData and caching super, sub-types

This commit is contained in:
BoykoAlex
2019-03-08 11:26:00 -05:00
parent ee67cf914d
commit 91d9838fff
32 changed files with 5932 additions and 633 deletions

View File

@@ -36,6 +36,7 @@ import org.springframework.ide.vscode.commons.java.IType;
import org.springframework.ide.vscode.commons.jdtls.JdtLsIndex;
import org.springframework.ide.vscode.commons.protocol.STS4LanguageClient;
import org.springframework.ide.vscode.commons.protocol.java.TypeData;
import org.springframework.ide.vscode.commons.protocol.java.TypeDescriptorData;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@@ -51,9 +52,9 @@ public class JdtLsIndexTest {
return gson.fromJson(new FileReader(jsonFile), TypeData.class);
}
private List<String> loadJsonSearchTypeResults(String fileName) throws Exception {
private List<TypeDescriptorData> loadJsonSearchTypeResults(String fileName) throws Exception {
File jsonFile = new File(JdtLsIndexTest.class.getResource("/java-data-json/" + fileName).toURI());
Type listType = new TypeToken<List<String>>(){}.getType();
Type listType = new TypeToken<List<TypeDescriptorData>>(){}.getType();
return gson.fromJson(new FileReader(jsonFile), listType);
}
@@ -138,9 +139,9 @@ public class JdtLsIndexTest {
}));
// Some valid URI necessary for URI#toString() to succeed
JdtLsIndex index = new JdtLsIndex(client, URI.create(System.getProperty("java.io.tmpdir")));
List<Tuple2<String, Double>> results = index.fuzzySearchTypes("util.Map", true, false).collectSortedList((o1, o2) -> o2.getT2().compareTo(o1.getT2())).block();
String type = results.get(0).getT1();
assertEquals("io.netty.util.Mapping", type);
List<Tuple2<IType, Double>> results = index.fuzzySearchTypes("util.Map", true, false).collectSortedList((o1, o2) -> o2.getT2().compareTo(o1.getT2())).block();
IType type = results.get(0).getT1();
assertEquals("io.netty.util.Mapping", type.getFullyQualifiedName());
}
@Test