当前位置: 首页>>代码示例>>Java>>正文


Java ICodeBase类代码示例

本文整理汇总了Java中edu.umd.cs.findbugs.classfile.ICodeBase的典型用法代码示例。如果您正苦于以下问题:Java ICodeBase类的具体用法?Java ICodeBase怎么用?Java ICodeBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ICodeBase类属于edu.umd.cs.findbugs.classfile包,在下文中一共展示了ICodeBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildFindBugsFullJarCodebaseList

import edu.umd.cs.findbugs.classfile.ICodeBase; //导入依赖的package包/类
private LinkedList<WorkListItem> buildFindBugsFullJarCodebaseList() {
    String findbugsFullJar = ClassPathUtil.findCodeBaseInClassPath("findbugs-full.jar",
            SystemProperties.getProperty("java.class.path"));

    LinkedList<WorkListItem> workList = new LinkedList<WorkListItem>();
    if (findbugsFullJar != null) {
        //
        // Found findbugs-full.jar: add it to the aux classpath.
        // (This is a bit weird, since we only want to resolve a subset
        // of its classes.)
        //
        ICodeBaseLocator loc = new FilesystemCodeBaseLocator(findbugsFullJar);
        workList.addLast(new WorkListItem(loc, false, ICodeBase.IN_SYSTEM_CLASSPATH));
    }
    return workList;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:17,代码来源:ClassPathBuilder.java

示例2: addWorkListItemsForClasspath

import edu.umd.cs.findbugs.classfile.ICodeBase; //导入依赖的package包/类
/**
 * Add worklist items from given system classpath.
 * 
 * @param workList
 *            the worklist
 * @param path
 *            a system classpath
 */
private void addWorkListItemsForClasspath(LinkedList<WorkListItem> workList, String path) {
    if (path == null) {
        return;
    }

    StringTokenizer st = new StringTokenizer(path, File.pathSeparator);
    while (st.hasMoreTokens()) {
        String entry = st.nextToken();
        if (DEBUG) {
            System.out.println("System classpath entry: " + entry);
        }
        addToWorkList(workList, new WorkListItem(classFactory.createFilesystemCodeBaseLocator(entry), false,
                ICodeBase.IN_SYSTEM_CLASSPATH));
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:24,代码来源:ClassPathBuilder.java

示例3: addWorkListItemsForExtDir

import edu.umd.cs.findbugs.classfile.ICodeBase; //导入依赖的package包/类
/**
 * Add worklist items from given extensions directory.
 * 
 * @param workList
 *            the worklist
 * @param extDir
 *            an extensions directory
 */
private void addWorkListItemsForExtDir(LinkedList<WorkListItem> workList, String extDir) {
    File dir = new File(extDir);
    File[] fileList = dir.listFiles(new FileFilter() {
        /*
         * (non-Javadoc)
         * 
         * @see java.io.FileFilter#accept(java.io.File)
         */
        public boolean accept(File pathname) {
            String path = pathname.getPath();
            boolean isArchive = Archive.isArchiveFileName(path);
            return isArchive;
        }
    });
    if (fileList == null) {
        return;
    }

    for (File archive : fileList) {
        addToWorkList(workList, new WorkListItem(classFactory.createFilesystemCodeBaseLocator(archive.getPath()), false,
                ICodeBase.IN_SYSTEM_CLASSPATH));
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:32,代码来源:ClassPathBuilder.java

示例4: buildFindBugsFullJarCodebaseList

import edu.umd.cs.findbugs.classfile.ICodeBase; //导入依赖的package包/类
private LinkedList<WorkListItem> buildFindBugsFullJarCodebaseList() {
    String findbugsFullJar = ClassPathUtil.findCodeBaseInClassPath("findbugs-full.jar",
            SystemProperties.getProperty("java.class.path"));

    LinkedList<WorkListItem> workList = new LinkedList<WorkListItem>();
    if (findbugsFullJar != null) {
        //
        // Found findbugs-full.jar: add it to the aux classpath.
        // (This is a bit weird, since we only want to resolve a subset
        // of its classes.)
        //
        ICodeBaseLocator loc = new FilesystemCodeBaseLocator(findbugsFullJar);
        workList.addLast(new WorkListItem(loc, false, ICodeBase.Discovered.IN_SYSTEM_CLASSPATH));
    }
    return workList;
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:17,代码来源:ClassPathBuilder.java

示例5: addWorkListItemsForClasspath

import edu.umd.cs.findbugs.classfile.ICodeBase; //导入依赖的package包/类
/**
 * Add worklist items from given system classpath.
 *
 * @param workList
 *            the worklist
 * @param path
 *            a system classpath
 */
private void addWorkListItemsForClasspath(LinkedList<WorkListItem> workList, String path) {
    if (path == null) {
        return;
    }

    StringTokenizer st = new StringTokenizer(path, File.pathSeparator);
    while (st.hasMoreTokens()) {
        String entry = st.nextToken();
        if (DEBUG) {
            System.out.println("System classpath entry: " + entry);
        }
        addToWorkList(workList, new WorkListItem(classFactory.createFilesystemCodeBaseLocator(entry), false,
                ICodeBase.Discovered.IN_SYSTEM_CLASSPATH));
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:24,代码来源:ClassPathBuilder.java

示例6: addWorkListItemsForExtDir

import edu.umd.cs.findbugs.classfile.ICodeBase; //导入依赖的package包/类
/**
 * Add worklist items from given extensions directory.
 *
 * @param workList
 *            the worklist
 * @param extDir
 *            an extensions directory
 */
private void addWorkListItemsForExtDir(LinkedList<WorkListItem> workList, String extDir) {
    File dir = new File(extDir);
    File[] fileList = dir.listFiles(new FileFilter() {
        /*
         * (non-Javadoc)
         *
         * @see java.io.FileFilter#accept(java.io.File)
         */
        @Override
        public boolean accept(File pathname) {
            String path = pathname.getPath();
            boolean isArchive = Archive.isArchiveFileName(path);
            return isArchive;
        }
    });
    if (fileList == null) {
        return;
    }

    for (File archive : fileList) {
        addToWorkList(workList, new WorkListItem(classFactory.createFilesystemCodeBaseLocator(archive.getPath()), false,
                ICodeBase.Discovered.IN_SYSTEM_CLASSPATH));
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:33,代码来源:ClassPathBuilder.java

示例7: addCodeBase

import edu.umd.cs.findbugs.classfile.ICodeBase; //导入依赖的package包/类
public void addCodeBase(ICodeBase codeBase) {
    if (codeBase.isApplicationCodeBase()) {
        if (!(codeBase instanceof IScannableCodeBase)) {
            throw new IllegalStateException();
        }
        appCodeBaseList.add((IScannableCodeBase) codeBase);
    } else {
        auxCodeBaseList.add(codeBase);
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:11,代码来源:ClassPathImpl.java

示例8: search

import edu.umd.cs.findbugs.classfile.ICodeBase; //导入依赖的package包/类
/**
 * Search list of codebases for named resource.
 *
 * @param codeBaseList
 *            list of codebases to search
 * @param resourceName
 *            name of resourse
 * @return codebase entry for the named resource, or null if the named
 *         resource cannot be found
 */
private ICodeBaseEntry search(List<? extends ICodeBase> codeBaseList, String resourceName) {
    for (ICodeBase codeBase : codeBaseList) {
        ICodeBaseEntry resource = codeBase.lookupResource(resourceName);
        if (resource != null) {
            return resource;
        }
        // Ignore, continue trying other codebases
    }
    return null;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:21,代码来源:ClassPathImpl.java

示例9: dumpCodeBaseList

import edu.umd.cs.findbugs.classfile.ICodeBase; //导入依赖的package包/类
private void dumpCodeBaseList(Iterator<? extends ICodeBase> i, String desc) throws InterruptedException {
    System.out.println("  " + desc + ":");
    while (i.hasNext()) {
        ICodeBase codeBase = i.next();
        System.out.println("    " + codeBase.getCodeBaseLocator().toString());
        if (codeBase.containsSourceFiles()) {
            System.out.println("      * contains source files");
        }
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:11,代码来源:ClassPathBuilder.java

示例10: scanCodebase

import edu.umd.cs.findbugs.classfile.ICodeBase; //导入依赖的package包/类
/**
 * Scan given codebase in order to
 * <ul>
 * <li>check the codebase for nested archives (adding any found to the
 * worklist)
 * <li>build a list of class resources found in the codebase
 * </ul>
 * 
 * @param workList
 *            the worklist
 * @param discoveredCodeBase
 *            the codebase to scan
 * @throws InterruptedException
 */
private void scanCodebase(IClassPath classPath, LinkedList<WorkListItem> workList, DiscoveredCodeBase discoveredCodeBase)
        throws InterruptedException {
    if (DEBUG) {
        System.out.println("Scanning " + discoveredCodeBase.getCodeBase().getCodeBaseLocator());
    }

    IScannableCodeBase codeBase = (IScannableCodeBase) discoveredCodeBase.getCodeBase();

    ICodeBaseIterator i = codeBase.iterator();
    while (i.hasNext()) {
        ICodeBaseEntry entry = i.next();
        if (VERBOSE) {
            System.out.println("Entry: " + entry.getResourceName());
        }

        if (!NO_PARSE_CLASS_NAMES && codeBase.isApplicationCodeBase()
                && DescriptorFactory.isClassResource(entry.getResourceName()) && !(entry instanceof SingleFileCodeBaseEntry)) {
            parseClassName(entry);
        }

        // Note the resource exists in this codebase
        discoveredCodeBase.addCodeBaseEntry(entry);

        // If resource is a nested archive, add it to the worklist
        if (scanNestedArchives && codeBase.isApplicationCodeBase() && Archive.isArchiveFileName(entry.getResourceName())) {
            if (VERBOSE) {
                System.out.println("Entry is an archive!");
            }
            ICodeBaseLocator nestedArchiveLocator = classFactory.createNestedArchiveCodeBaseLocator(codeBase,
                    entry.getResourceName());
            addToWorkList(workList,
                    new WorkListItem(nestedArchiveLocator, codeBase.isApplicationCodeBase(), ICodeBase.NESTED));
        }
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:50,代码来源:ClassPathBuilder.java

示例11: scanJarManifestForClassPathEntries

import edu.umd.cs.findbugs.classfile.ICodeBase; //导入依赖的package包/类
/**
 * Check a codebase for a Jar manifest to examine for Class-Path entries.
 * 
 * @param workList
 *            the worklist
 * @param codeBase
 *            the codebase for examine for a Jar manifest
 * @throws IOException
 */
private void scanJarManifestForClassPathEntries(LinkedList<WorkListItem> workList, ICodeBase codeBase) throws IOException {
    // See if this codebase has a jar manifest
    ICodeBaseEntry manifestEntry = codeBase.lookupResource("META-INF/MANIFEST.MF");
    if (manifestEntry == null) {
        // Do nothing - no Jar manifest found
        return;
    }

    // Try to read the manifest
    InputStream in = null;
    try {
        in = manifestEntry.openResource();
        Manifest manifest = new Manifest(in);

        Attributes mainAttrs = manifest.getMainAttributes();
        String classPath = mainAttrs.getValue("Class-Path");
        if (classPath != null) {
            String[] pathList = classPath.split("\\s+");

            for (String path : pathList) {
                // Create a codebase locator for the classpath entry
                // relative to the codebase in which we discovered the Jar
                // manifest
                ICodeBaseLocator relativeCodeBaseLocator = codeBase.getCodeBaseLocator().createRelativeCodeBaseLocator(path);

                // Codebases found in Class-Path entries are always
                // added to the aux classpath, not the application.
                addToWorkList(workList, new WorkListItem(relativeCodeBaseLocator, false, ICodeBase.IN_JAR_MANIFEST));
            }
        }
    } finally {
        if (in != null) {
            IO.close(in);
        }
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:46,代码来源:ClassPathBuilder.java

示例12: scanCodebase

import edu.umd.cs.findbugs.classfile.ICodeBase; //导入依赖的package包/类
/**
 * Scan given codebase in order to
 * <ul>
 * <li>check the codebase for nested archives (adding any found to the
 * worklist)
 * <li>build a list of class resources found in the codebase
 * </ul>
 *
 * @param workList
 *            the worklist
 * @param discoveredCodeBase
 *            the codebase to scan
 * @throws InterruptedException
 */
private void scanCodebase(IClassPath classPath, LinkedList<WorkListItem> workList, DiscoveredCodeBase discoveredCodeBase)
        throws InterruptedException {
    if (DEBUG) {
        System.out.println("Scanning " + discoveredCodeBase.getCodeBase().getCodeBaseLocator());
    }

    IScannableCodeBase codeBase = (IScannableCodeBase) discoveredCodeBase.getCodeBase();

    ICodeBaseIterator i = codeBase.iterator();
    while (i.hasNext()) {
        ICodeBaseEntry entry = i.next();
        if (VERBOSE) {
            System.out.println("Entry: " + entry.getResourceName());
        }

        if (!NO_PARSE_CLASS_NAMES && codeBase.isApplicationCodeBase()
                && DescriptorFactory.isClassResource(entry.getResourceName()) && !(entry instanceof SingleFileCodeBaseEntry)) {
            parseClassName(entry);
        }

        // Note the resource exists in this codebase
        discoveredCodeBase.addCodeBaseEntry(entry);

        // If resource is a nested archive, add it to the worklist
        if (scanNestedArchives && (codeBase.isApplicationCodeBase() || codeBase instanceof DirectoryCodeBase)
                && Archive.isLibraryFileName(entry.getResourceName())) {
            if (VERBOSE) {
                System.out.println("Entry is an library!");
            }
            ICodeBaseLocator nestedArchiveLocator = classFactory.createNestedArchiveCodeBaseLocator(codeBase,
                    entry.getResourceName());
            addToWorkList(workList, new WorkListItem(nestedArchiveLocator, codeBase.isApplicationCodeBase(),
                    ICodeBase.Discovered.NESTED));
        }
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:51,代码来源:ClassPathBuilder.java

示例13: scanJarManifestForClassPathEntries

import edu.umd.cs.findbugs.classfile.ICodeBase; //导入依赖的package包/类
/**
 * Check a codebase for a Jar manifest to examine for Class-Path entries.
 *
 * @param workList
 *            the worklist
 * @param codeBase
 *            the codebase for examine for a Jar manifest
 * @throws IOException
 */
private void scanJarManifestForClassPathEntries(LinkedList<WorkListItem> workList, ICodeBase codeBase) throws IOException {
    // See if this codebase has a jar manifest
    ICodeBaseEntry manifestEntry = codeBase.lookupResource("META-INF/MANIFEST.MF");
    if (manifestEntry == null) {
        // Do nothing - no Jar manifest found
        return;
    }

    // Try to read the manifest
    InputStream in = null;
    try {
        in = manifestEntry.openResource();
        Manifest manifest = new Manifest(in);

        Attributes mainAttrs = manifest.getMainAttributes();
        String classPath = mainAttrs.getValue("Class-Path");
        if (classPath != null) {
            String[] pathList = classPath.split("\\s+");

            for (String path : pathList) {
                // Create a codebase locator for the classpath entry
                // relative to the codebase in which we discovered the Jar
                // manifest
                ICodeBaseLocator relativeCodeBaseLocator = codeBase.getCodeBaseLocator().createRelativeCodeBaseLocator(path);

                // Codebases found in Class-Path entries are always
                // added to the aux classpath, not the application.
                addToWorkList(workList,
                        new WorkListItem(relativeCodeBaseLocator, false, ICodeBase.Discovered.IN_JAR_MANIFEST));
            }
        }
    } finally {
        if (in != null) {
            IO.close(in);
        }
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:47,代码来源:ClassPathBuilder.java

示例14: getCodeBase

import edu.umd.cs.findbugs.classfile.ICodeBase; //导入依赖的package包/类
public ICodeBase getCodeBase() {
    return null;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:4,代码来源:ClassDataAnalysisEngine.java

示例15: ClassPathImpl

import edu.umd.cs.findbugs.classfile.ICodeBase; //导入依赖的package包/类
public ClassPathImpl() {
    this.appCodeBaseList = new LinkedList<IScannableCodeBase>();
    this.auxCodeBaseList = new LinkedList<ICodeBase>();
    this.codeBaseEntryMap = new HashMap<String, ICodeBaseEntry>();
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:6,代码来源:ClassPathImpl.java


注:本文中的edu.umd.cs.findbugs.classfile.ICodeBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。