Search in sources :

Example 1 with InvalidDescriptor

use of org.eclipse.ceylon.langtools.classfile.Descriptor.InvalidDescriptor in project ceylon by eclipse.

the class ClassFileScanner method scan.

public void scan(ModuleInfo moduleInfo) throws IOException {
    PathFilter pathFilter = null;
    if (moduleInfo != null && moduleInfo.getFilter() != null) {
        pathFilter = PathFilterParser.parse(moduleInfo.getFilter());
    }
    try (ZipFile zf = new ZipFile(jarFile)) {
        Enumeration<? extends ZipEntry> entries = zf.entries();
        while (entries.hasMoreElements()) {
            ZipEntry entry = entries.nextElement();
            if (entry.isDirectory() || !entry.getName().toLowerCase().endsWith(".class"))
                continue;
            if (pathFilter != null && !pathFilter.accept(entry.getName()))
                continue;
            try (InputStream is = zf.getInputStream(entry)) {
                try {
                    ClassFile classFile = ClassFile.read(is);
                    isPublicApi = false;
                    checkPublicApi(classFile);
                } catch (ConstantPoolException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (InvalidDescriptor e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
}
Also used : PathFilter(org.eclipse.ceylon.model.cmr.PathFilter) ClassFile(org.eclipse.ceylon.langtools.classfile.ClassFile) ZipFile(java.util.zip.ZipFile) InputStream(java.io.InputStream) ZipEntry(java.util.zip.ZipEntry) ConstantPoolException(org.eclipse.ceylon.langtools.classfile.ConstantPoolException) InvalidDescriptor(org.eclipse.ceylon.langtools.classfile.Descriptor.InvalidDescriptor)

Aggregations

InputStream (java.io.InputStream)1 ZipEntry (java.util.zip.ZipEntry)1 ZipFile (java.util.zip.ZipFile)1 ClassFile (org.eclipse.ceylon.langtools.classfile.ClassFile)1 ConstantPoolException (org.eclipse.ceylon.langtools.classfile.ConstantPoolException)1 InvalidDescriptor (org.eclipse.ceylon.langtools.classfile.Descriptor.InvalidDescriptor)1 PathFilter (org.eclipse.ceylon.model.cmr.PathFilter)1