org.apache.bcel.util.ClassPath Java Examples

The following examples show how to use org.apache.bcel.util.ClassPath. 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 File: CKJM.java    From dacapobench with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
	CommandLineArgs commandLine = new CommandLineArgs(args);
	
	StringBuffer classPathString = new StringBuffer();
	for(String c: commandLine.getClassPath()) {
		if (classPathString.length()!=0)
			classPathString.append(":"+c);
		else
			classPathString.append(c);
	}
	ClassPath.setDefaultClassPath(new ClassPath(classPathString.toString()));
	
	LinkedList<File> fileList = LogFiles.orderedLogFileList(commandLine.getLogFile());
	
	LinkedList<String> classList = makeClassList(fileList,commandLine.getLogged());

	DaCapoOutputHandler output = new DaCapoOutputHandler(commandLine.getOutputStream(),commandLine.getIndividual());
	
	String[] classFileList = makeClassFileList(classList, commandLine.getClassPath());
	
	MetricsFilter.runMetrics(classFileList, output);
	output.reportTotal();
}
 
Example #2
Source File: Repository.java    From commons-bcel with Apache License 2.0 5 votes vote down vote up
/**
 * @return class file object for given Java class by looking on the
 *  system class path; returns null if the class file can't be
 *  found
 */
public static ClassPath.ClassFile lookupClassFile( final String class_name ) {
    try {
        final ClassPath path = repository.getClassPath();
        if (path == null) {
            return null;
        }
        return path.getClassFile(class_name);
    } catch (final IOException e) {
        return null;
    }
}
 
Example #3
Source File: ClassDumper.java    From cloud-opensource-java with Apache License 2.0 4 votes vote down vote up
private static FixedSizeClassPathRepository createClassRepository(List<ClassPathEntry> entries) {
  ClassPath classPath = new LinkageCheckClassPath(entries);
  return new FixedSizeClassPathRepository(classPath);
}
 
Example #4
Source File: FixedSizeClassPathRepository.java    From cloud-opensource-java with Apache License 2.0 4 votes vote down vote up
FixedSizeClassPathRepository(ClassPath path) {
  this(path, 1000);
}
 
Example #5
Source File: FixedSizeClassPathRepository.java    From cloud-opensource-java with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
FixedSizeClassPathRepository(ClassPath path, long maximumSize) {
  super(path);
  loadedClass = CacheBuilder.newBuilder().maximumSize(maximumSize).build();
  this.classFileNames = new HashMap<>();
}
 
Example #6
Source File: FixedSizeClassPathRepositoryTest.java    From cloud-opensource-java with Apache License 2.0 4 votes vote down vote up
@Before
public void setup() throws URISyntaxException, IOException {
  ClassPathEntry path = classPathEntryOfResource("testdata/api-common-1.7.0.jar");
  ClassPath classPath = new LinkageCheckClassPath(Arrays.asList(path));
  repository = new FixedSizeClassPathRepository(classPath, 3);
}
 
Example #7
Source File: URLClassPathRepository.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public ClassPath getClassPath() {
    return new ClassPath(urlClassPath.getClassPath());
}
 
Example #8
Source File: AnalysisCacheToRepositoryAdapter.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public ClassPath getClassPath() {
    throw new UnsupportedOperationException();
}
 
Example #9
Source File: AbstractTestCase.java    From commons-bcel with Apache License 2.0 4 votes vote down vote up
public SyntheticRepository createRepos(final String cpentry)
{
    final ClassPath cp = new ClassPath("target" + File.separator + "testdata"
            + File.separator + cpentry + File.separator);
    return SyntheticRepository.getInstance(cp);
}