use of meghanada.reflect.ClassIndex in project meghanada-server by mopemope.
the class ASMReflectorTest method testReflectInner2.
@Test
public void testReflectInner2() throws Exception {
ASMReflector asmReflector = ASMReflector.getInstance();
Stopwatch stopwatch = Stopwatch.createUnstarted();
{
String fqcn = "java.util.Map.Entry";
File jar = getRTJar();
Map<String, ClassIndex> index = asmReflector.getClassIndexes(jar);
final InheritanceInfo info = asmReflector.getReflectInfo(index, fqcn);
System.out.println(info);
stopwatch.start();
List<MemberDescriptor> memberDescriptors = asmReflector.reflectAll(info);
System.out.println(stopwatch.stop());
memberDescriptors.forEach(m -> System.out.println(m.getDisplayDeclaration()));
assertEquals(18, memberDescriptors.size());
stopwatch.reset();
}
}
use of meghanada.reflect.ClassIndex in project meghanada-server by mopemope.
the class ASMReflectorTest method testReflectAll5.
@Test
public void testReflectAll5() throws Exception {
ASMReflector asmReflector = ASMReflector.getInstance();
Stopwatch stopwatch = Stopwatch.createUnstarted();
// Config.load().setDebug();
{
File jar = getRTJar();
// Config.load().setDebug();
String fqcn = "java.util.stream.Stream<java.util.stream.Stream<java.util.List<java.lang.String>>>";
Map<String, ClassIndex> index = asmReflector.getClassIndexes(jar);
final InheritanceInfo info = asmReflector.getReflectInfo(index, fqcn);
System.out.println(info);
stopwatch.start();
List<MemberDescriptor> memberDescriptors1 = asmReflector.reflectAll(info);
System.out.println(stopwatch.stop());
System.out.println(memberDescriptors1.size());
memberDescriptors1.forEach(md -> {
// System.out.println(md.getDeclaration());
// System.out.println(md.declaration);
});
}
}
use of meghanada.reflect.ClassIndex in project meghanada-server by mopemope.
the class ASMReflectorTest method testReflectAll4.
@Test
public void testReflectAll4() throws Exception {
ASMReflector asmReflector = ASMReflector.getInstance();
Stopwatch stopwatch = Stopwatch.createUnstarted();
{
File jar = getRTJar();
String fqcn = "java.util.function.Predicate";
Map<String, ClassIndex> index = asmReflector.getClassIndexes(jar);
final InheritanceInfo info = asmReflector.getReflectInfo(index, fqcn);
System.out.println(info);
stopwatch.start();
List<MemberDescriptor> memberDescriptors = asmReflector.reflectAll(info);
System.out.println(stopwatch.stop());
assertEquals(16, memberDescriptors.size());
memberDescriptors.forEach(memberDescriptor -> System.out.println(memberDescriptor.getDeclaration()));
}
}
use of meghanada.reflect.ClassIndex in project meghanada-server by mopemope.
the class ClassSignatureVisitorTest method testFormalType1.
@Test
public void testFormalType1() throws Exception {
String fqcn = "java.util.Map";
File jar = getRTJar();
ClassSignatureVisitor visitor = doAnalyze(jar, fqcn);
assertEquals("java.util.Map", visitor.getName());
List<String> expected = new ArrayList<>();
expected.add("K");
expected.add("V");
assertEquals(expected, visitor.getTypeParameters());
final ClassIndex index = visitor.getClassIndex();
System.out.println(index.isInterface());
assertEquals(true, index.isInterface());
assertEquals(0, index.getSupers().size());
}
use of meghanada.reflect.ClassIndex in project meghanada-server by mopemope.
the class ClassSignatureVisitorTest method testFormalType2.
@org.junit.Test
public void testFormalType2() throws Exception {
String fqcn = "java.util.List";
File jar = getRTJar();
ClassSignatureVisitor visitor = doAnalyze(jar, fqcn);
assertEquals("java.util.List", visitor.getName());
List<String> expected = new ArrayList<>();
expected.add("E");
assertEquals(expected, visitor.getTypeParameters());
final ClassIndex index = visitor.getClassIndex();
assertEquals(true, index.isInterface());
assertEquals(1, index.getSupers().size());
}
Aggregations