use of meghanada.reflect.ClassIndex in project meghanada-server by mopemope.
the class ASMReflectorTest method testReflectAll7.
@Test
public void testReflectAll7() throws Exception {
ASMReflector asmReflector = ASMReflector.getInstance();
Stopwatch stopwatch = Stopwatch.createUnstarted();
{
File jar = getJar("guava");
Map<String, ClassIndex> index = asmReflector.getClassIndexes(jar);
String fqcn = "com.google.common.base.Joiner";
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 testReflectAnnotation1.
@Test
public void testReflectAnnotation1() throws Exception {
ASMReflector asmReflector = ASMReflector.getInstance();
Stopwatch stopwatch = Stopwatch.createUnstarted();
{
String fqcn = "org.junit.Test";
File jar = getJar("junit:junit");
stopwatch.start();
List<MemberDescriptor> memberDescriptors = timeIt(() -> {
Map<String, ClassIndex> index = asmReflector.getClassIndexes(jar);
// Map<ClassIndex, File> index = asmReflector.getClasses(jar);
// index
// .keySet()
// .forEach(
// classIndex -> {
// if (classIndex.isAnnotation) {
// System.out.println("anno: " + classIndex);
// }
// });
final InheritanceInfo info = asmReflector.getReflectInfo(index, fqcn);
return asmReflector.reflectAll(info);
});
System.out.println(stopwatch.stop());
memberDescriptors.forEach(m -> {
System.out.println(m.getDeclaration());
});
assertEquals(2, memberDescriptors.size());
stopwatch.reset();
}
}
use of meghanada.reflect.ClassIndex in project meghanada-server by mopemope.
the class ASMReflectorTest method testReflectAll8.
@Test
public void testReflectAll8() throws Exception {
final ASMReflector asmReflector = ASMReflector.getInstance();
final File file = getTestOutput();
Map<String, ClassIndex> index = asmReflector.getClassIndexes(file);
final String fqcn = "meghanada.Gen4";
final List<MemberDescriptor> memberDescriptors = debugIt(() -> {
final InheritanceInfo info = asmReflector.getReflectInfo(index, fqcn);
return asmReflector.reflectAll(info);
});
memberDescriptors.forEach(md -> {
System.out.println(md.getDeclaringClass() + " # " + md.getDeclaration());
});
}
use of meghanada.reflect.ClassIndex in project meghanada-server by mopemope.
the class ASMReflectorTest method testReflectWithGenerics2.
@Test
public void testReflectWithGenerics2() throws Exception {
ASMReflector asmReflector = ASMReflector.getInstance();
Stopwatch stopwatch = Stopwatch.createUnstarted();
{
String fqcn = "java.util.Enumeration<? extends ZipEntry>";
File jar = getRTJar();
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.getDisplayDeclaration()));
Config config = Config.load();
if (config.isJava8()) {
assertEquals(13, memberDescriptors.size());
} else {
assertEquals(14, memberDescriptors.size());
}
stopwatch.reset();
}
}
use of meghanada.reflect.ClassIndex in project meghanada-server by mopemope.
the class ASMReflectorTest method testGetClasses2.
@Test
public void testGetClasses2() throws Exception {
File jar = getRTJar();
ASMReflector asmReflector = ASMReflector.getInstance();
Map<ClassIndex, File> classIndex = timeIt(() -> asmReflector.getClasses(jar));
Config config = Config.load();
if (config.isJava8()) {
assertEquals(4105, classIndex.size());
} else {
assertEquals(6940, classIndex.size());
}
// classIndex.forEach((i, file) -> System.out.println(i));
}
Aggregations