Returns directory for incremental compilation cache files.

@param classesDirectory compilation output directory
@return directory for incremental compilation cache files
770476
public static File getCacheDirectory( File classesDirectory )
    {
        String classesDirectoryName = classesDirectory.getName();
        String cacheDirectoryName = classesDirectoryName.replace( TEST_CLASSES, CACHE ).replace( CLASSES, CACHE );
        return new File( classesDirectory.getParentFile(), cacheDirectoryName );
    }
365498
private void findFiles(File directory) throws IOException, ClassNotFoundException {

        File[] files = directory.listFiles(new FilenameFilter() {
            public boolean accept(File dir, String name) {
                return name.endsWith(".class");
            }
        });

        if (files != null) {
            for (File file : files) {
                int current = currentDirectoryPath.length();
                String fileName = file.getCanonicalPath().substring(++current);
                String className = fileName.replace(File.separatorChar, '.').substring(0, fileName.length() - 6);
                tryClass(className);
            }
        }
    }
737722
public static Map<String, LocalResource> createLocalResources(FileSystem fs, String classPathDir) {
		Map<String, LocalResource> localResources = provisionAndLocalizeCurrentClasspath(fs, classPathDir);
		return localResources;
	}
359537
public final static Class<?> getCompiledClass(String className, boolean useCache) throws CompilationException, ClassLoadException {
        try {
            if (! useCache) {
                
                /*String compilationResult = compileClass(className);
                System.out.println("************ compilationResult   " + compilationResult);
                if (compilationResult.contains("cannot read")) {
                    throw new ClassLoadException(compilationResult);
                }
                if (compilationResult.contains("error")) {
                    throw new CompilationException(compilationResult);
                }*/

                DynamicClassLoader dynamicClassLoader = new DynamicClassLoader(DynamicClassFactory.class.getClassLoader());
                return dynamicClassLoader.loadClass(className);
            } else {
                return CACHED_CONTROLLERS.computeIfAbsent(className, WRAP_FORNAME);
            }
        } catch (CompilationException e) {
            throw e; // so the exception doesn't get caught by the more general catch(Exception)
        } catch (Exception e) {
            throw new ClassLoadException(e);
        }
    }
531186
private byte[] getClassDigest(File directory, String name) {
    String baseName = getBaseFileName(name);
    File digestFile = new File(directory, baseName + DIGEST_EXTENSION);
    return getFileContents(digestFile);
  }
400235
protected static function fill_classmap_cache() {
        global $CFG;

        self::$classmap = array();

        self::load_classes('core', "$CFG->dirroot/lib/classes");

        foreach (self::$subsystems as $subsystem => $fulldir) {
            if (!$fulldir) {
                continue;
            }
            self::load_classes('core_'.$subsystem, "$fulldir/classes");
        }

        foreach (self::$plugins as $plugintype => $plugins) {
            foreach ($plugins as $pluginname => $fulldir) {
                self::load_classes($plugintype.'_'.$pluginname, "$fulldir/classes");
            }
        }
        ksort(self::$classmap);
    }
224947
protected File getCorrectOutputDirectory(MavenProject current) {
        final Object obj = current.getContextValue("dependency-check-output-dir");
        if (obj != null && obj instanceof File) {
            return (File) obj;
        }//else we guess
        File target = new File(current.getBuild().getDirectory());
        if (target.getParentFile() != null && "target".equals(target.getParentFile().getName())) {
            target = target.getParentFile();
        }
        return target;
    }
973751
def cache(cache_directory_path):
    """"""
    if not cache_directory_path:
        click.secho(dtool_config.utils.get_cache(
            CONFIG_PATH,
        ))
    else:
        click.secho(dtool_config.utils.set_cache(
            CONFIG_PATH,
            cache_directory_path
        ))
843403
protected function findClassMappingInDirectory($OClass, $directory, $namespace)
    {
        $finder = new Finder();

        if (isset($this->classMap[$OClass])) {
            return $this->classMap[$OClass];
        }

        foreach ($finder->files()->name('*.php')->in($directory) as $file) {
            $class = $this->getClassByPath($file, $namespace);

            if (class_exists($class)) {
                $annotation = $this->getClassAnnotation($class);

                if ($annotation && $annotation->hasMatchingClass($OClass)) {
                    $this->classMap[$OClass] = $class;
                    return $class;
                }
            }
        }

        return null;
    }
237462
private LookupResult findDecompiled(String name, CompilationUnit compilationUnit, GroovyClassLoader loader) {
        ClassNode node = ClassHelper.make(name);
        if (node.isResolved()) {
            return new LookupResult(null, node);
        }

        DecompiledClassNode asmClass = null;
        String fileName = name.replace('.', '/') + ".class";
        URL resource = loader.getResource(fileName);
        if (resource != null) {
            try {
                asmClass = new DecompiledClassNode(AsmDecompiler.parseClass(resource), new AsmReferenceResolver(this, compilationUnit));
                if (!asmClass.getName().equals(name)) {
                    // this may happen under Windows because getResource is case insensitive under that OS!
                    asmClass = null;
                }
            } catch (IOException e) {
                // fall through and attempt other search strategies
            }
        }

        if (asmClass != null) {
            if (isFromAnotherClassLoader(loader, fileName)) {
                return tryAsScript(name, compilationUnit, asmClass);
            }

            return new LookupResult(null, asmClass);
        }
        return null;
    }
639660
private void listDirectory(File directory,
                               RelativeDirectory subdirectory,
                               Set<JavaFileObject.Kind> fileKinds,
                               boolean recurse,
                               ListBuffer<JavaFileObject> resultList) {
        File d = subdirectory.getFile(directory);
        if (!caseMapCheck(d, subdirectory))
            return;

        File[] files = d.listFiles();
        if (files == null)
            return;

        if (sortFiles != null)
            Arrays.sort(files, sortFiles);

        for (File f: files) {
            String fname = f.getName();
            if (f.isDirectory()) {
                if (recurse && SourceVersion.isIdentifier(fname)) {
                    listDirectory(directory,
                                  new RelativeDirectory(subdirectory, fname),
                                  fileKinds,
                                  recurse,
                                  resultList);
                }
            } else {
                if (isValidFile(fname, fileKinds)) {
                    JavaFileObject fe =
                        new RegularFileObject(this, fname, new File(d, fname));
                    resultList.append(fe);
                }
            }
        }
    }
1109352
@Override
    public DecompilationResult decompileClassFile(Path rootDir, Path classFilePath, Path outputDir)
                throws DecompilationException
    {
        Checks.checkDirectoryToBeRead(rootDir.toFile(), "Classes root dir");
        File classFile = classFilePath.toFile();
        Checks.checkFileToBeRead(classFile, "Class file");
        Checks.checkDirectoryToBeFilled(outputDir.toFile(), "Output directory");

        log.info("Decompiling .class '" + classFilePath + "' to '" + outputDir + "' from: '" + rootDir + "'");

        String name = classFilePath.normalize().toAbsolutePath().toString().substring(rootDir.toAbsolutePath().toString().length() + 1);
        final String typeName = StringUtils.removeEnd(name, ".class");// .replace('/', '.');

        DecompilationResult result = new DecompilationResult();
        try
        {
            DecompilerSettings settings = getDefaultSettings(outputDir.toFile());
            this.procyonConf.setDecompilerSettings(settings); // TODO: This is horrible mess.

            final ITypeLoader typeLoader = new CompositeTypeLoader(new WindupClasspathTypeLoader(rootDir.toString()), new ClasspathTypeLoader());
            WindupMetadataSystem metadataSystem = new WindupMetadataSystem(typeLoader);
            File outputFile = this.decompileType(settings, metadataSystem, typeName);
            result.addDecompiled(Collections.singletonList(classFilePath.toString()), outputFile.getAbsolutePath());
        }
        catch (Throwable e)
        {
            DecompilationFailure failure = new DecompilationFailure("Error during decompilation of "
                        + classFilePath.toString() + ":\n    " + e.getMessage(), Collections.singletonList(name), e);
            log.severe(failure.getMessage());
            result.addFailure(failure);
        }

        return result;
    }
43282
public static File getFileFromDirectoryInClassPath(String fileName, String classPath) {

		Collection<String> paths = StringSupport.split(classPath, ";:", false);

		for(String singlePath : paths) {
			File dir = new File(singlePath);
			if (dir.isDirectory()) {
				File file = new File(singlePath + '/' + fileName);
				if (file.exists()) {
					return file;
				}
			}
		}
		return null;
	}
871592
public static ClassLoader[] getClassLoaders(ClassLoader... classLoaders) {

		if (classLoaders != null && classLoaders.length > 0) {
			return classLoaders;
		}

		final ClassLoader ctxClassLoader = Thread.currentThread()
				.getContextClassLoader();
		final ClassLoader staticClassLoader = ClassLoaderUtils.class
				.getClassLoader();

		if (ctxClassLoader == null) {
			if (staticClassLoader == null) {
				return new ClassLoader[] {};
			} else {
				return new ClassLoader[] { staticClassLoader };
			}
		} else {
			if (staticClassLoader == null) {
				return new ClassLoader[] { ctxClassLoader };
			} else {
				return new ClassLoader[] { ctxClassLoader, staticClassLoader };
			}
		}
	}
244186
public static void main(String[] args) {
    ClassCache cache = new ClassCache();
    Iterator<String> packages = cache.packages();
    List<String> sorted = new ArrayList<>();
    while (packages.hasNext())
      sorted.add(packages.next());
    Collections.sort(sorted);
    for (String key: sorted)
      System.out.println(key + ": " + cache.getClassnames(key).size());
  }
193408
public static Iterator<String> iterateClassnames(final File parentDirectory,
                                                   final Iterator<File> classFileIterator) {
    return new Iterator<String>(){

      @Override
      public boolean hasNext() {
        return classFileIterator == null ? false : classFileIterator.hasNext();
      }

      @Override
      public String next() {
        final File classFile = classFileIterator.next();
        try {
          // possible returns null
          return extractClassNameFromFile(parentDirectory, classFile);
        } catch (final IOException e) {
          throw new RuntimeException(e.getMessage());
        }
      }

      @Override
      public void remove() {
        classFileIterator.remove();
      }
    };
  }
627559
List<String> listCompiledClasses(final File classFolder) {
        List<String> classNames = new ArrayList<String>();
        if (!classFolder.exists()) {
            getLog().info("Class folder does not exist; skipping scan");
            return classNames;
        }
        final String extension = ".class";
        final DirectoryScanner directoryScanner = new DirectoryScanner();
        directoryScanner.setBasedir(classFolder);
        directoryScanner.setIncludes(new String[] { "**" + File.separator + "*" + extension });
        directoryScanner.scan();
        String[] files = directoryScanner.getIncludedFiles();

        String className;
        for (String file : files) {
            className = file.substring(0, file.length() - extension.length()).replace(File.separator, ".");
            classNames.add(className);
        }

        return classNames;
    }