use of meghanada.reflect.MemberDescriptor in project meghanada-server by mopemope.
the class ASMReflectorTest method testReflectInterface1.
@Test
public void testReflectInterface1() throws Exception {
ASMReflector asmReflector = ASMReflector.getInstance();
Stopwatch stopwatch = Stopwatch.createUnstarted();
{
String fqcn = "com.google.common.eventbus.SubscriberExceptionHandler";
File jar = getJar("guava");
Map<String, ClassIndex> index = asmReflector.getClassIndexes(jar);
final InheritanceInfo info = asmReflector.getReflectInfo(index, fqcn);
stopwatch.start();
List<MemberDescriptor> memberDescriptors = asmReflector.reflectAll(info);
System.out.println(stopwatch.stop());
memberDescriptors.forEach(m -> {
System.out.println(m.getDeclaration());
System.out.println("Return: " + m.getRawReturnType());
});
assertEquals(1, memberDescriptors.size());
stopwatch.reset();
}
}
use of meghanada.reflect.MemberDescriptor in project meghanada-server by mopemope.
the class ASMReflectorTest method testReflectWithGenerics4.
@Test
public void testReflectWithGenerics4() throws Exception {
ASMReflector asmReflector = ASMReflector.getInstance();
Stopwatch stopwatch = Stopwatch.createUnstarted();
{
String fqcn = "com.google.common.cache.CacheBuilder<Object, Object>";
File jar = getJar("guava");
Map<String, ClassIndex> index = asmReflector.getClassIndexes(jar);
final InheritanceInfo info = asmReflector.getReflectInfo(index, fqcn);
stopwatch.start();
List<MemberDescriptor> memberDescriptors = asmReflector.reflectAll(info);
System.out.println(stopwatch.stop());
memberDescriptors.forEach(m -> {
System.out.println(m.getDeclaration());
// System.out.println("Return: " + m.getRawReturnType());
});
assertEquals(61, memberDescriptors.size());
stopwatch.reset();
}
}
use of meghanada.reflect.MemberDescriptor 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.MemberDescriptor 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.MemberDescriptor 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()));
}
}
Aggregations