static String[] removeWrapperArgs(String[] args) {
        String[] out = new String[args.length];
        // The first source path index is remembered
        // here. So that all following can be concatenated to it.
        int source_path = -1;
        // The same for class path.
        int class_path = -1;
        // And module path.
        int module_path = -1;
        int j = 0;
        for (int i = 0; i<args.length; ++i) {
            if (args[i].equals("-src") ||
                args[i].equals("-x") ||
                args[i].equals("-i") ||
                args[i].equals("-xf") ||
                args[i].equals("-if") ||
                args[i].equals("-copy") ||
                args[i].equals("-tr") ||
                args[i].equals("-j")) {
                // Just skip it and skip following value
                i++;
            } else if (args[i].startsWith("--server:")) {
                // Just skip it.
            } else if (args[i].startsWith("--log=")) {
                // Just skip it.
            } else if (args[i].equals("--permit-unidentified-artifacts")) {
                // Just skip it.
            } else if (args[i].equals("--permit-sources-without-package")) {
                // Just skip it.
            } else if (args[i].equals("--compare-found-sources")) {
                // Just skip it and skip verify file name
                i++;
            } else if (args[i].equals("-sourcepath")) {
                if (source_path == -1) {
                    source_path = j;
                    out[j] = args[i];
                    out[j+1] = args[i+1];
                    j+=2;
                    i++;
                } else {
                    // Skip this and its argument, but
                    // append argument to found sourcepath.
                    out[source_path+1] = out[source_path+1]+File.pathSeparatorChar+args[i+1];
                    i++;
                }
            } else if (args[i].equals("-classpath") || args[i].equals("-cp")) {
                if (class_path == -1) {
                    class_path = j;
                    out[j] = args[i];
                    out[j+1] = args[i+1];
                    j+=2;
                    i++;
                } else {
                    // Skip this and its argument, but
                    // append argument to found sourcepath.
                    out[class_path+1] = out[class_path+1]+File.pathSeparatorChar+args[i+1];
                    i++;
                }
            } else if (args[i].equals("-modulepath")) {
                if (module_path == -1) {
                    module_path = j;
                    out[j] = args[i];
                    out[j+1] = args[i+1];
                    j+=2;
                    i++;
                } else {
                    // Skip this and its argument, but
                    // append argument to found sourcepath.
                    out[module_path+1] = out[module_path+1]+File.pathSeparatorChar+args[i+1];
                    i++;
                }
             } else {
                // Copy argument.
                out[j] = args[i];
                j++;
            }
        }
        String[] ret = new String[j];
        System.arraycopy(out, 0, ret, 0, j);
        return ret;
    }
static String [ ] removeWrapperArgs ( String [ ] args ) { String [ ] out = new String [ args . length ] ; int source_path = - 1 ; int class_path = - 1 ; int module_path = - 1 ; int j = 0 ; for ( int i = 0 ; i < args . length ; ++ i ) { if ( args [ i ] . equals ( "-src" ) || args [ i ] . equals ( "-x" ) || args [ i ] . equals ( "-i" ) || args [ i ] . equals ( "-xf" ) || args [ i ] . equals ( "-if" ) || args [ i ] . equals ( "-copy" ) || args [ i ] . equals ( "-tr" ) || args [ i ] . equals ( "-j" ) ) { i ++ ; } else if ( args [ i ] . startsWith ( "--server:" ) ) { } else if ( args [ i ] . startsWith ( "--log=" ) ) { } else if ( args [ i ] . equals ( "--permit-unidentified-artifacts" ) ) { } else if ( args [ i ] . equals ( "--permit-sources-without-package" ) ) { } else if ( args [ i ] . equals ( "--compare-found-sources" ) ) { i ++ ; } else if ( args [ i ] . equals ( "-sourcepath" ) ) { if ( source_path == - 1 ) { source_path = j ; out [ j ] = args [ i ] ; out [ j + 1 ] = args [ i + 1 ] ; j += 2 ; i ++ ; } else { out [ source_path + 1 ] = out [ source_path + 1 ] + File . pathSeparatorChar + args [ i + 1 ] ; i ++ ; } } else if ( args [ i ] . equals ( "-classpath" ) || args [ i ] . equals ( "-cp" ) ) { if ( class_path == - 1 ) { class_path = j ; out [ j ] = args [ i ] ; out [ j + 1 ] = args [ i + 1 ] ; j += 2 ; i ++ ; } else { out [ class_path + 1 ] = out [ class_path + 1 ] + File . pathSeparatorChar + args [ i + 1 ] ; i ++ ; } } else if ( args [ i ] . equals ( "-modulepath" ) ) { if ( module_path == - 1 ) { module_path = j ; out [ j ] = args [ i ] ; out [ j + 1 ] = args [ i + 1 ] ; j += 2 ; i ++ ; } else { out [ module_path + 1 ] = out [ module_path + 1 ] + File . pathSeparatorChar + args [ i + 1 ] ; i ++ ; } } else { out [ j ] = args [ i ] ; j ++ ; } } String [ ] ret = new String [ j ] ; System . arraycopy ( out , 0 , ret , 0 , j ) ; return ret ; }
Remove smart javac wrapper arguments, before feeding
the args to the plain javac.