use of aQute.bnd.osgi.Clazz in project bnd by bndtools.
the class ClassParserTest method testGeneratedClass.
public void testGeneratedClass() throws Exception {
InputStream in = getClass().getResourceAsStream("XDbCmpXView.clazz");
assertNotNull(in);
Clazz clazz = new Clazz(a, "test", null);
clazz.parseClassFile(in);
clazz.getReferred();
}
use of aQute.bnd.osgi.Clazz in project bnd by bndtools.
the class ClassParserTest method testLargeClass2.
public static void testLargeClass2() throws IOException {
try {
URL url = new URL("jar:file:jar/ecj_3.2.2.jar!/org/eclipse/jdt/internal/compiler/parser/Parser.class");
InputStream in = url.openStream();
assertNotNull(in);
Clazz clazz = new Clazz(a, "test", null);
clazz.parseClassFile(in);
} catch (Exception e) {
e.printStackTrace();
fail();
}
}
use of aQute.bnd.osgi.Clazz in project bnd by bndtools.
the class ClassParserTest method testLargeClass.
/**
* This class threw an exception because we were using skip instead of
* skipBytes. skip is not guaranteed to real skip the amount of bytes, not
* even if there are still bytes left. It seems to be able to stop skipping
* if it is at the end of a buffer or so :-( Idiots. The
* DataInputStream.skipBytes works correctly.
*
* @throws IOException
*/
public void testLargeClass() throws IOException {
InputStream in = getClass().getResourceAsStream("Parser.jclass");
assertNotNull(in);
try {
Clazz clazz = new Clazz(a, "test", null);
clazz.parseClassFile(in);
} catch (Exception e) {
e.printStackTrace();
fail();
}
}
use of aQute.bnd.osgi.Clazz in project bnd by bndtools.
the class ClassParserTest method testCodehauseGROOVY_6169.
/**
* https://jira.codehaus.org/browse/GROOVY-6169 There are several components
* involved here, but the symptoms point to the Groovy compiler. Gradle uses
* BND to populate the OSGi 'Import-Package' manifest header. The import
* from Groovy source is lost and does not appear in the OSGi manifest. This
* causes problems when deploying the bundle to OSGi. There's a repro
* package attached. It includes two Gradle projects, one using Java, one
* using Groovy. They use the same source file contents, but with different
* file types. They produce different manifest files, one that imports slf4j
* and one that doesn't. You can tweak the build.gradle to use different
* Groovy releases. I first discovered this problem using v1.8.7, but saw
* the same results with v1.8.9. The problem was apparently fixed in v2.1,
* using a groovy-all-2.1.0 a correct manifest file is created.
*/
public static void testCodehauseGROOVY_6169() throws Exception {
Clazz c = new Clazz(a, "foo", new FileResource(IO.getFile("jar/BugReproLoggerGroovy189.jclass")));
c.parseClassFile();
assertTrue(c.getReferred().contains(a.getPackageRef("org.slf4j")));
}
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")));
}
Aggregations