View | Details | Raw Unified | Return to bug 161996 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (-15 / +19 lines)
Lines 285-291 Link Here
285
	ArrayList paths = new ArrayList(Main.DEFAULT_SIZE_CLASSPATH);
285
	ArrayList paths = new ArrayList(Main.DEFAULT_SIZE_CLASSPATH);
286
	try {
286
	try {
287
		(new Main(new PrintWriter(System.out), new PrintWriter(System.err), true)).
287
		(new Main(new PrintWriter(System.out), new PrintWriter(System.err), true)).
288
			processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, classpathInput, null /* customEncoding */, false /* isSourceOnly */, true /* rejectDestinationPathOnJars*/);
288
			processPathEntries(Main.DEFAULT_SIZE_CLASSPATH, paths, classpathInput, null /* customEncoding */, true /* isSourceOnly */, false /* rejectDestinationPathOnJars*/);
289
	} catch (InvalidInputException e) {
289
	} catch (InvalidInputException e) {
290
		// e.printStackTrace();
290
		// e.printStackTrace();
291
		if (expectedError == null) {
291
		if (expectedError == null) {
Lines 5048-5067 Link Here
5048
		"incorrect destination path entry: " + cp);
5048
		"incorrect destination path entry: " + cp);
5049
}
5049
}
5050
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
5050
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
5051
public void _test127_classpath() {
5051
public void test127_classpath() {
5052
	String jarFile = OUTPUT_DIR + File.separator + "[squarebracket].jar"; 
5052
	runClasspathTest(
5053
	runClasspathTest(
5053
		OUTPUT_DIR + File.separator + "[squarebracket].jar", 
5054
		jarFile, 
5054
		new String[] {
5055
		new String[] {
5055
			"[squarebracket].jar", null, null,
5056
			jarFile, null, null,
5056
		},
5057
		},
5057
		null);
5058
		null);
5058
}
5059
}
5059
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
5060
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
5060
public void _test128_classpath() {
5061
public void test128_classpath() {
5062
	String jarFile = OUTPUT_DIR + File.separator + "[square][bracket].jar";
5061
	runClasspathTest(
5063
	runClasspathTest(
5062
		OUTPUT_DIR + File.separator + "[square][bracket].jar", 
5064
		jarFile, 
5063
		new String[] {
5065
		new String[] {
5064
			"[square][bracket].jar", null, null,
5066
			jarFile, null, null,
5065
		},
5067
		},
5066
		null);
5068
		null);
5067
}
5069
}
Lines 5113-5137 Link Here
5113
		null);
5115
		null);
5114
}
5116
}
5115
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
5117
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
5116
public void _test134_classpath() {
5118
public void test134_classpath() {
5119
	String jarFile = OUTPUT_DIR + File.separator + "[squarebracket].jar";
5117
	runClasspathTest(
5120
	runClasspathTest(
5118
		OUTPUT_DIR + File.separator + "[squarebracket].jar[~**/internal/*][-d dir]", 
5121
		jarFile + "[~**/internal/*][-d " + OUTPUT_DIR + "]", 
5119
		new String[] {
5122
		new String[] {
5120
			"[squarebracket].jar", "{pattern=**/internal/* (DISCOURAGED)}", "dir",
5123
			jarFile, "{pattern=**/internal/* (DISCOURAGED)}", OUTPUT_DIR,
5121
		},
5124
		},
5122
		null);
5125
		null);
5123
}
5126
}
5124
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
5127
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
5125
public void _test135_classpath() {
5128
public void test135_classpath() {
5129
	String jarFile = OUTPUT_DIR + File.separator + "[square][bracket].jar";
5126
	runClasspathTest(
5130
	runClasspathTest(
5127
		OUTPUT_DIR + File.separator + "[square][bracket].jar[~**/internal/*][-d dir]", 
5131
		jarFile + "[~**/internal/*][-d dir]", 
5128
		new String[] {
5132
		new String[] {
5129
			"[square][bracket].jar", "{pattern=**/internal/* (DISCOURAGED)}", "dir",
5133
			jarFile, "{pattern=**/internal/* (DISCOURAGED)}", "dir",
5130
		},
5134
		},
5131
		null);
5135
		null);
5132
}
5136
}
5133
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
5137
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
5134
public void _test136_classpath() {
5138
public void test136_classpath() {
5135
	String target = OUTPUT_DIR + File.separator + "[a]";
5139
	String target = OUTPUT_DIR + File.separator + "[a]";
5136
	(new File(target)).mkdirs();
5140
	(new File(target)).mkdirs();
5137
	runClasspathTest(
5141
	runClasspathTest(
Lines 5142-5148 Link Here
5142
		null);
5146
		null);
5143
}
5147
}
5144
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
5148
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996
5145
public void _test137_classpath() {
5149
public void test137_classpath() {
5146
	String target = OUTPUT_DIR + File.separator + "[a]";
5150
	String target = OUTPUT_DIR + File.separator + "[a]";
5147
	(new File(target)).mkdirs();
5151
	(new File(target)).mkdirs();
5148
	runClasspathTest(
5152
	runClasspathTest(
(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (-6 / +42 lines)
Lines 3076-3081 Link Here
3076
	ArrayList currentRuleSpecs = new ArrayList(defaultSize);
3076
	ArrayList currentRuleSpecs = new ArrayList(defaultSize);
3077
	StringTokenizer tokenizer = new StringTokenizer(currentPath,
3077
	StringTokenizer tokenizer = new StringTokenizer(currentPath,
3078
			File.pathSeparator + "[]", true); //$NON-NLS-1$
3078
			File.pathSeparator + "[]", true); //$NON-NLS-1$
3079
	ArrayList tokens = new ArrayList();
3080
	while (tokenizer.hasMoreTokens()) {
3081
		tokens.add(tokenizer.nextToken());
3082
	}
3079
	// state machine
3083
	// state machine
3080
	final int start = 0; 
3084
	final int start = 0; 
3081
	final int readyToClose = 1;
3085
	final int readyToClose = 1;
Lines 3094-3110 Link Here
3094
	// 'path[-d bin'
3098
	// 'path[-d bin'
3095
	final int readyToCloseEndingWithDestinationPath = 8;
3099
	final int readyToCloseEndingWithDestinationPath = 8;
3096
	// 'path[-d bin]' 'path[rule][-d bin]'
3100
	// 'path[-d bin]' 'path[rule][-d bin]'
3097
	final int destinatonPathStart = 9;
3101
	final int destinationPathStart = 9;
3098
	// 'path[rule]['
3102
	// 'path[rule]['
3103
	final int bracketOpened = 10;
3104
	// '.*[.*'
3105
	final int bracketClosed = 11;
3106
	// '.*([.*])+'
3107
	
3099
	final int error = 99;
3108
	final int error = 99;
3100
	int state = start;
3109
	int state = start;
3101
	String token = null;
3110
	String token = null;
3102
	while (tokenizer.hasMoreTokens() && state != error) {
3111
	int cursor = 0, tokensNb = tokens.size(), bracket = -1;
3103
		token = tokenizer.nextToken();
3112
	while (cursor < tokensNb && state != error) {
3113
		token = (String) tokens.get(cursor++);
3104
		if (token.equals(File.pathSeparator)) {
3114
		if (token.equals(File.pathSeparator)) {
3105
			switch (state) {
3115
			switch (state) {
3106
			case start:
3116
			case start:
3107
			case readyToCloseOrOtherEntry:
3117
			case readyToCloseOrOtherEntry:
3118
			case bracketOpened:
3108
				break;
3119
				break;
3109
			case readyToClose:
3120
			case readyToClose:
3110
			case readyToCloseEndingWithRules:
3121
			case readyToCloseEndingWithRules:
Lines 3122-3141 Link Here
3122
				throw new InvalidInputException(
3133
				throw new InvalidInputException(
3123
					this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ 
3134
					this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ 
3124
						currentPath));
3135
						currentPath));
3136
			case bracketClosed:
3137
				cursor = bracket + 1;
3138
				state = rulesStart;
3139
				break;
3125
			default:
3140
			default:
3126
				state = error;
3141
				state = error;
3127
			}
3142
			}
3128
		} else if (token.equals("[")) { //$NON-NLS-1$
3143
		} else if (token.equals("[")) { //$NON-NLS-1$
3129
			switch (state) {
3144
			switch (state) {
3130
			case readyToClose:
3145
			case readyToClose:
3131
				state = rulesStart;
3146
				bracket = cursor - 1;
3147
			case bracketClosed:
3148
				state = bracketOpened;
3132
				break;
3149
				break;
3133
			case readyToCloseEndingWithRules:
3150
			case readyToCloseEndingWithRules:
3134
				state = destinatonPathStart;
3151
				state = destinationPathStart;
3135
				break;
3152
				break;
3136
			case readyToCloseEndingWithDestinationPath:
3153
			case readyToCloseEndingWithDestinationPath:
3137
				state = rulesStart;
3154
				state = rulesStart;
3138
				break;
3155
				break;
3156
			case bracketOpened:
3139
			default:
3157
			default:
3140
				state = error;
3158
				state = error;
3141
			}
3159
			}
Lines 3147-3152 Link Here
3147
			case destinationPathReadyToClose:
3165
			case destinationPathReadyToClose:
3148
				state = readyToCloseEndingWithDestinationPath;
3166
				state = readyToCloseEndingWithDestinationPath;
3149
				break;
3167
				break;
3168
			case bracketOpened:
3169
				state = bracketClosed;
3170
				break;
3171
			case bracketClosed:
3150
			default:
3172
			default:
3151
				state = error;
3173
				state = error;
3152
			}
3174
			}
Lines 3178-3184 Link Here
3178
				state = rulesReadyToClose;
3200
				state = rulesReadyToClose;
3179
				currentRuleSpecs.add(token);
3201
				currentRuleSpecs.add(token);
3180
				break;
3202
				break;
3181
			case destinatonPathStart:
3203
			case destinationPathStart:
3182
				if (!token.startsWith("-d ")) { //$NON-NLS-1$
3204
				if (!token.startsWith("-d ")) { //$NON-NLS-1$
3183
					state = error;
3205
					state = error;
3184
				} else {
3206
				} else {
Lines 3186-3195 Link Here
3186
					state = destinationPathReadyToClose;
3208
					state = destinationPathReadyToClose;
3187
				}
3209
				}
3188
				break;
3210
				break;
3211
			case bracketClosed:
3212
				for (int i = bracket; i < cursor ; i++) {
3213
					currentClasspathName += (String) tokens.get(i);
3214
				}
3215
				state = readyToClose;
3216
				break;
3217
			case bracketOpened:
3218
				break;
3189
			default:
3219
			default:
3190
				state = error;
3220
				state = error;
3191
			}
3221
			}
3192
		}
3222
		}
3223
		if (state == bracketClosed && cursor == tokensNb) {
3224
			cursor = bracket + 1;
3225
			state = rulesStart;
3226
		}
3193
	}
3227
	}
3194
	switch(state) {
3228
	switch(state) {
3195
		case readyToCloseOrOtherEntry:
3229
		case readyToCloseOrOtherEntry:
Lines 3201-3206 Link Here
3201
				customEncoding, currentDestinationPath, isSourceOnly,
3235
				customEncoding, currentDestinationPath, isSourceOnly,
3202
				rejectDestinationPathOnJars);
3236
				rejectDestinationPathOnJars);
3203
			break;
3237
			break;
3238
		case bracketOpened:
3239
		case bracketClosed:
3204
		default :
3240
		default :
3205
			// we go on anyway
3241
			// we go on anyway
3206
			if (currentPath.length() != 0) {
3242
			if (currentPath.length() != 0) {

Return to bug 161996