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

Collapse All | Expand All

(-)antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java (-3 / +24 lines)
Lines 458-474 Link Here
458
458
459
		//access rules are expected in the same order as the classpath, but there could
459
		//access rules are expected in the same order as the classpath, but there could
460
		//be elements in the classpath not in the access rules or access rules not in the classpath
460
		//be elements in the classpath not in the access rules or access rules not in the classpath
461
		for (int i = 0; i < pathElements.length; i++) {
461
		for (int i = 0, max = pathElements.length; i < max; i++) {
462
			if (i > 0)
462
			if (i > 0)
463
				result.append(File.pathSeparatorChar);
463
				result.append(File.pathSeparatorChar);
464
			result.append(pathElements[i]);
464
			String pathElement = pathElements[i];
465
			result.append(pathElement);
465
			//the rules list is [path, rule, path, rule, ...]
466
			//the rules list is [path, rule, path, rule, ...]
466
			for (int j = nextRule; j < rulesLength; j += 2) {
467
			for (int j = nextRule; j < rulesLength; j += 2) {
467
				if (pathElements[i].endsWith(rules[j])) {
468
				String rule = rules[j];
469
				if (pathElement.endsWith(rule)) {
468
					result.append(rules[j + 1]);
470
					result.append(rules[j + 1]);
469
					nextRule = j + 2;
471
					nextRule = j + 2;
470
					break;
472
					break;
471
				}
473
				}
474
				// if the path doesn't match, it could be due to a trailing file separatorChar in the rule
475
				if (rule.endsWith(File.separator)) {
476
					// rule ends with the File.separator, but pathElement might not
477
					// otherwise it would match on the first endsWith
478
					int ruleLength = rule.length();
479
					if (pathElement.regionMatches(false, pathElement.length() - ruleLength + 1, rule, 0, ruleLength - 1)) {
480
						result.append(rules[j + 1]);
481
						nextRule = j + 2;
482
						break;
483
					}
484
				} else if (pathElement.endsWith(File.separator)) {
485
					// rule doesn't end with the File.separator, but pathElement might
486
					int ruleLength = rule.length();
487
					if (pathElement.regionMatches(false, pathElement.length() - ruleLength - 1, rule, 0, ruleLength)) {
488
						result.append(rules[j + 1]);
489
						nextRule = j + 2;
490
						break;
491
					}
492
				}
472
			}
493
			}
473
		}
494
		}
474
495

Return to bug 106631