void traverse ( String [ ] args ) { try { args = CommandLine . parse ( args ) ; // Detect @file and load it as a command line. } catch ( java . io . IOException e ) { throw new IllegalArgumentException ( "Problem reading @" + e . getMessage ( ) ) ; } ArgumentIterator argIter = new ArgumentIterator ( Arrays . asList ( args ) ) ; nextArg : while ( argIter . hasNext ( ) ) { String arg = argIter . next ( ) ; if ( arg . startsWith ( "-" ) ) { for ( Option opt : Option . values ( ) ) { if ( opt . processCurrent ( argIter , this ) ) continue nextArg ; } javacArg ( arg ) ; // Does this javac argument take an argument? If so, don't // let it pass on to sjavac as a source root directory. for ( com . sun . tools . javac . main . Option javacOpt : com . sun . tools . javac . main . Option . values ( ) ) { if ( javacOpt . matches ( arg ) ) { boolean takesArgument = javacOpt . hasArg ( ) ; boolean separateToken = ! arg . contains ( ":" ) && ! arg . contains ( "=" ) ; if ( takesArgument && separateToken ) javacArg ( argIter . next ( ) ) ; } } } else { sourceRoots ( Arrays . asList ( Paths . get ( arg ) ) ) ; } } }
Traverses an array of arguments and performs the appropriate callbacks .