Java Code Examples for com.strobel.assembler.metadata.JarTypeLoader

The following examples show how to use com.strobel.assembler.metadata.JarTypeLoader. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: huntbugs   Author: amaembo   File: HuntBugsMojo.java    License: Apache License 2.0 6 votes vote down vote up
private void addDependency(Artifact art, List<ITypeLoader> deps) throws IOException {
    if ("compile".equals(art.getScope())) {
        ArtifactRepository localRepository = session.getLocalRepository();
        File f = localRepository.find(art).getFile();
        if (f != null) {
            Path path = f.toPath();
            if (!quiet) {
                getLog().info("HuntBugs: +dep " + path);
            }
            if (Files.isRegularFile(path) && art.getType().equals("jar")) {
                deps.add(new JarTypeLoader(new JarFile(path.toFile())));
            } else if (Files.isDirectory(path)) {
                deps.add(new ClasspathTypeLoader(path.toString()));
            }
        }
    }
}
 
Example #2
Source Project: huntbugs   Author: amaembo   File: HuntBugs.java    License: Apache License 2.0 5 votes vote down vote up
private ITypeLoader createTypeLoader(Path path) {
    try {
        return Files.isDirectory(path) ? new ClasspathTypeLoader(path.toString()) : new JarTypeLoader(new JarFile(path.toFile()));
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
Example #3
Source Project: huntbugs   Author: amaembo   File: JarRepository.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public ITypeLoader createTypeLoader() {
    return new JarTypeLoader(file);
}