private void findAllModifiedClasses(String name,
                                      PathImpl sourceDir,
                                      PathImpl classDir,
                                      String sourcePath,
                                      ArrayList<String> sources)
    throws IOException, ClassNotFoundException
  {
    String []list;

    try {
      list = sourceDir.list();
    } catch (IOException e) {
      return;
    }

    for (int i = 0; list != null && i < list.length; i++) {
      if (list[i].startsWith("."))
        continue;

      if (_excludedDirectories.contains(list[i]))
        continue;
      
      PathImpl subSource = sourceDir.lookup(list[i]);

      if (subSource.isDirectory()) {
        findAllModifiedClasses(name + list[i] + "/", subSource,
                               classDir.lookup(list[i]), sourcePath, sources);
      }
      else if (list[i].endsWith(_sourceExt)) {
        int tail = list[i].length() - _sourceExt.length();
        String prefix = list[i].substring(0, tail);
        PathImpl subClass = classDir.lookup(prefix + ".class");

        if (subClass.getLastModified() < subSource.getLastModified()) {
          sources.add(name + list[i]);
        }
      }
    }

    if (! _requireSource)
      return;
    
    try {
      list = classDir.list();
    } catch (IOException e) {
      return;
    }

    for (int i = 0; list != null && i < list.length; i++) {
      if (list[i].startsWith("."))
        continue;

      if (_excludedDirectories.contains(list[i]))
        continue;
      
      PathImpl subClass = classDir.lookup(list[i]);

      if (list[i].endsWith(".class")) {
        String prefix = list[i].substring(0, list[i].length() - 6);
        PathImpl subSource = sourceDir.lookup(prefix + _sourceExt);

        if (! subSource.exists()) {
          String tail = subSource.getTail();
          boolean doRemove = true;

          if (tail.indexOf('$') > 0) {
            String subTail = tail.substring(0, tail.indexOf('$')) + _sourceExt;
            PathImpl subJava = subSource.getParent().lookup(subTail);

            if (subJava.exists())
              doRemove = false;
          }

          if (doRemove) {
            log.finer(L.l("removing obsolete class '{0}'.", subClass.getPath()));

            subClass.remove();
          }
        }
      }
    }
  }
private void findAllModifiedClasses ( String name , PathImpl sourceDir , PathImpl classDir , String sourcePath , ArrayList < String > sources ) throws IOException , ClassNotFoundException { String [ ] list ; try { list = sourceDir . list ( ) ; } catch ( IOException e ) { return ; } for ( int i = 0 ; list != null && i < list . length ; i ++ ) { if ( list [ i ] . startsWith ( "." ) ) continue ; if ( _excludedDirectories . contains ( list [ i ] ) ) continue ; PathImpl subSource = sourceDir . lookup ( list [ i ] ) ; if ( subSource . isDirectory ( ) ) { findAllModifiedClasses ( name + list [ i ] + "/" , subSource , classDir . lookup ( list [ i ] ) , sourcePath , sources ) ; } else if ( list [ i ] . endsWith ( _sourceExt ) ) { int tail = list [ i ] . length ( ) - _sourceExt . length ( ) ; String prefix = list [ i ] . substring ( 0 , tail ) ; PathImpl subClass = classDir . lookup ( prefix + ".class" ) ; if ( subClass . getLastModified ( ) < subSource . getLastModified ( ) ) { sources . add ( name + list [ i ] ) ; } } } if ( ! _requireSource ) return ; try { list = classDir . list ( ) ; } catch ( IOException e ) { return ; } for ( int i = 0 ; list != null && i < list . length ; i ++ ) { if ( list [ i ] . startsWith ( "." ) ) continue ; if ( _excludedDirectories . contains ( list [ i ] ) ) continue ; PathImpl subClass = classDir . lookup ( list [ i ] ) ; if ( list [ i ] . endsWith ( ".class" ) ) { String prefix = list [ i ] . substring ( 0 , list [ i ] . length ( ) - 6 ) ; PathImpl subSource = sourceDir . lookup ( prefix + _sourceExt ) ; if ( ! subSource . exists ( ) ) { String tail = subSource . getTail ( ) ; boolean doRemove = true ; if ( tail . indexOf ( '$' ) > 0 ) { String subTail = tail . substring ( 0 , tail . indexOf ( '$' ) ) + _sourceExt ; PathImpl subJava = subSource . getParent ( ) . lookup ( subTail ) ; if ( subJava . exists ( ) ) doRemove = false ; } if ( doRemove ) { log . finer ( L . l ( "removing obsolete class '{0}'." , subClass . getPath ( ) ) ) ; subClass . remove ( ) ; } } } } }
Returns the classes which need compilation.