### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v retrieving revision 1.100 diff -u -r1.100 BatchCompilerTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 1 Feb 2007 09:49:42 -0000 1.100 +++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 1 Feb 2007 12:24:57 -0000 @@ -285,7 +285,7 @@ ArrayList paths = new ArrayList(Main.DEFAULT_SIZE_CLASSPATH); try { (new Main(new PrintWriter(System.out), new PrintWriter(System.err), true)). - processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, classpathInput, null /* customEncoding */, false /* isSourceOnly */, true /* rejectDestinationPathOnJars*/); + processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, classpathInput, null /* customEncoding */, true /* isSourceOnly */, false /* rejectDestinationPathOnJars*/); } catch (InvalidInputException e) { // e.printStackTrace(); if (expectedError == null) { @@ -5048,20 +5048,22 @@ "incorrect destination path entry: " + cp); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996 -public void _test127_classpath() { +public void test127_classpath() { + String jarFile = OUTPUT_DIR + File.separator + "[squarebracket].jar"; runClasspathTest( - OUTPUT_DIR + File.separator + "[squarebracket].jar", + jarFile, new String[] { - "[squarebracket].jar", null, null, + jarFile, null, null, }, null); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996 -public void _test128_classpath() { +public void test128_classpath() { + String jarFile = OUTPUT_DIR + File.separator + "[square][bracket].jar"; runClasspathTest( - OUTPUT_DIR + File.separator + "[square][bracket].jar", + jarFile, new String[] { - "[square][bracket].jar", null, null, + jarFile, null, null, }, null); } @@ -5113,25 +5115,27 @@ null); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996 -public void _test134_classpath() { +public void test134_classpath() { + String jarFile = OUTPUT_DIR + File.separator + "[squarebracket].jar"; runClasspathTest( - OUTPUT_DIR + File.separator + "[squarebracket].jar[~**/internal/*][-d dir]", + jarFile + "[~**/internal/*][-d " + OUTPUT_DIR + "]", new String[] { - "[squarebracket].jar", "{pattern=**/internal/* (DISCOURAGED)}", "dir", + jarFile, "{pattern=**/internal/* (DISCOURAGED)}", OUTPUT_DIR, }, null); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996 -public void _test135_classpath() { +public void test135_classpath() { + String jarFile = OUTPUT_DIR + File.separator + "[square][bracket].jar"; runClasspathTest( - OUTPUT_DIR + File.separator + "[square][bracket].jar[~**/internal/*][-d dir]", + jarFile + "[~**/internal/*][-d dir]", new String[] { - "[square][bracket].jar", "{pattern=**/internal/* (DISCOURAGED)}", "dir", + jarFile, "{pattern=**/internal/* (DISCOURAGED)}", "dir", }, null); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996 -public void _test136_classpath() { +public void test136_classpath() { String target = OUTPUT_DIR + File.separator + "[a]"; (new File(target)).mkdirs(); runClasspathTest( @@ -5142,7 +5146,7 @@ null); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996 -public void _test137_classpath() { +public void test137_classpath() { String target = OUTPUT_DIR + File.separator + "[a]"; (new File(target)).mkdirs(); runClasspathTest( #P org.eclipse.jdt.core Index: batch/org/eclipse/jdt/internal/compiler/batch/Main.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java,v retrieving revision 1.278 diff -u -r1.278 Main.java --- batch/org/eclipse/jdt/internal/compiler/batch/Main.java 26 Jan 2007 20:44:33 -0000 1.278 +++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java 1 Feb 2007 12:25:06 -0000 @@ -3076,6 +3076,10 @@ ArrayList currentRuleSpecs = new ArrayList(defaultSize); StringTokenizer tokenizer = new StringTokenizer(currentPath, File.pathSeparator + "[]", true); //$NON-NLS-1$ + ArrayList tokens = new ArrayList(); + while (tokenizer.hasMoreTokens()) { + tokens.add(tokenizer.nextToken()); + } // state machine final int start = 0; final int readyToClose = 1; @@ -3094,17 +3098,24 @@ // 'path[-d bin' final int readyToCloseEndingWithDestinationPath = 8; // 'path[-d bin]' 'path[rule][-d bin]' - final int destinatonPathStart = 9; + final int destinationPathStart = 9; // 'path[rule][' + final int bracketOpened = 10; + // '.*[.*' + final int bracketClosed = 11; + // '.*([.*])+' + final int error = 99; int state = start; String token = null; - while (tokenizer.hasMoreTokens() && state != error) { - token = tokenizer.nextToken(); + int cursor = 0, tokensNb = tokens.size(), bracket = -1; + while (cursor < tokensNb && state != error) { + token = (String) tokens.get(cursor++); if (token.equals(File.pathSeparator)) { switch (state) { case start: case readyToCloseOrOtherEntry: + case bracketOpened: break; case readyToClose: case readyToCloseEndingWithRules: @@ -3122,20 +3133,27 @@ throw new InvalidInputException( this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ currentPath)); + case bracketClosed: + cursor = bracket + 1; + state = rulesStart; + break; default: state = error; } } else if (token.equals("[")) { //$NON-NLS-1$ switch (state) { case readyToClose: - state = rulesStart; + bracket = cursor - 1; + case bracketClosed: + state = bracketOpened; break; case readyToCloseEndingWithRules: - state = destinatonPathStart; + state = destinationPathStart; break; case readyToCloseEndingWithDestinationPath: state = rulesStart; break; + case bracketOpened: default: state = error; } @@ -3147,6 +3165,10 @@ case destinationPathReadyToClose: state = readyToCloseEndingWithDestinationPath; break; + case bracketOpened: + state = bracketClosed; + break; + case bracketClosed: default: state = error; } @@ -3178,7 +3200,7 @@ state = rulesReadyToClose; currentRuleSpecs.add(token); break; - case destinatonPathStart: + case destinationPathStart: if (!token.startsWith("-d ")) { //$NON-NLS-1$ state = error; } else { @@ -3186,10 +3208,22 @@ state = destinationPathReadyToClose; } break; + case bracketClosed: + for (int i = bracket; i < cursor ; i++) { + currentClasspathName += (String) tokens.get(i); + } + state = readyToClose; + break; + case bracketOpened: + break; default: state = error; } } + if (state == bracketClosed && cursor == tokensNb) { + cursor = bracket + 1; + state = rulesStart; + } } switch(state) { case readyToCloseOrOtherEntry: @@ -3201,6 +3235,8 @@ customEncoding, currentDestinationPath, isSourceOnly, rejectDestinationPathOnJars); break; + case bracketOpened: + case bracketClosed: default : // we go on anyway if (currentPath.length() != 0) {