use of aQute.bnd.osgi.Clazz in project bnd by bndtools.
the class ClassParserTest method testParameterAnnotation.
public void testParameterAnnotation() throws Exception {
InputStream in = getClass().getResourceAsStream("Test2.jclass");
assertNotNull(in);
Clazz clazz = new Clazz(a, "test", null);
clazz.parseClassFile(in);
Set<PackageRef> set = clazz.getReferred();
assertTrue(set.contains(a.getPackageRef("test")));
assertTrue(set.contains(a.getPackageRef("test/annotations")));
}
use of aQute.bnd.osgi.Clazz in project bnd by bndtools.
the class ClassParserTest method testWildcards.
// public void testImplemented() throws Exception {
// Builder a = new Builder();
// a.addClasspath(new File("bin"));
// a.setProperty("Private-Package", "test");
// a.build();
// Clazz c = a.getClassspace().get("testresources/Implemented.class");
// Set<PackageRef> s = Create.set();
//
// Clazz.getImplementedPackages(s, a, c);
// assertTrue(s.contains( a.getPackageRef("aQute/bnd/service")));
// }
public void testWildcards() throws Exception {
Clazz c = new Clazz(a, "genericstest", null);
c.parseClassFile(getClass().getResourceAsStream("WithGenerics.class"));
System.err.println(c.getReferred());
assertEquals("size ", 5, c.getReferred().size());
assertTrue(c.getReferred().contains(a.getPackageRef("aQute/bnd/osgi")));
assertTrue(c.getReferred().contains(a.getPackageRef("java/util")));
assertTrue(c.getReferred().contains(a.getPackageRef("java/net")));
assertTrue(c.getReferred().contains(a.getPackageRef("java/lang")));
}
use of aQute.bnd.osgi.Clazz in project bnd by bndtools.
the class ClazzTest method testUnusedClassConstant.
/**
* There is an unused class constant in the This actually looks wrong since
*/
public void testUnusedClassConstant() throws Exception {
try (Analyzer a = new Analyzer()) {
Clazz c = new Clazz(a, "", null);
c.parseClassFile(new FileInputStream("testresources/TestWeavingHook.jclass"), new ClassDataCollector() {
});
// TODO test someething here
System.out.println(c.getReferred());
}
}
use of aQute.bnd.osgi.Clazz in project bnd by bndtools.
the class ClazzTest method testModuleInfo.
public void testModuleInfo() throws Exception {
try (Analyzer a = new Analyzer()) {
Clazz c = new Clazz(a, "", null);
c.parseClassFile(new FileInputStream("jar/module-info.jclass"), new ClassDataCollector() {
});
assertTrue(c.isModule());
Set<PackageRef> referred = c.getReferred();
Descriptors d = new Descriptors();
assertFalse(referred.contains(d.getPackageRef("")));
}
}
use of aQute.bnd.osgi.Clazz in project bnd by bndtools.
the class ClazzTest method testAnalyzerCrawlInvokeInterfaceAIOOBException.
public void testAnalyzerCrawlInvokeInterfaceAIOOBException() throws Exception {
try (Analyzer a = new Analyzer()) {
Clazz c = new Clazz(a, "", null);
c.parseClassFile(new FileInputStream("jar/AnalyzerCrawlInvokerInterfaceAIOOBTest.jclass"), new ClassDataCollector() {
});
Set<PackageRef> referred = c.getReferred();
System.out.println(referred);
}
}
Aggregations