View | Details | Raw Unified | Return to bug 119430
Collapse All | Expand All

(-)batch/org/eclipse/jdt/internal/compiler/batch/ClasspathLocation.java (-5 / +13 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.batch;
11
package org.eclipse.jdt.internal.compiler.batch;
12
12
13
import java.io.File;
14
15
import org.eclipse.jdt.core.compiler.CharOperation;
13
import org.eclipse.jdt.internal.compiler.env.AccessRestriction;
16
import org.eclipse.jdt.internal.compiler.env.AccessRestriction;
14
import org.eclipse.jdt.internal.compiler.env.AccessRuleSet;
17
import org.eclipse.jdt.internal.compiler.env.AccessRuleSet;
15
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
18
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
Lines 29-44 Link Here
29
	 * 
32
	 * 
30
	 * @param qualifiedBinaryFileName
33
	 * @param qualifiedBinaryFileName
31
	 *            tested type specification, formed as:
34
	 *            tested type specification, formed as:
32
	 *            "org/eclipse/jdt/core/JavaCore.class"
35
	 *            "org/eclipse/jdt/core/JavaCore.class"; on systems that
36
	 *            use \ as File.separator, the 
37
	 *            "org\eclipse\jdt\core\JavaCore.class" is accepted as well
33
	 * @return the first access rule which is violated when accessing a given
38
	 * @return the first access rule which is violated when accessing a given
34
	 *         type, or null if none applies
39
	 *         type, or null if none applies
35
	 */
40
	 */
36
	AccessRestriction fetchAccessRestriction(String qualifiedBinaryFileName) {
41
	AccessRestriction fetchAccessRestriction(String qualifiedBinaryFileName) {
37
		if (this.accessRuleSet == null)
42
		if (this.accessRuleSet == null)
38
			return null;
43
			return null;
39
		return this.accessRuleSet
44
		char [] qualifiedTypeName = qualifiedBinaryFileName.
40
					.getViolatedRestriction(
45
			substring(0, qualifiedBinaryFileName.length() - SUFFIX_CLASS.length)
41
						qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length() - SUFFIX_CLASS.length)
46
			.toCharArray(); 
42
						.toCharArray());
47
		if (File.separatorChar == '\\') {
48
			CharOperation.replace(qualifiedTypeName, File.separatorChar, '/');
49
		}
50
		return this.accessRuleSet.getViolatedRestriction(qualifiedTypeName);
43
	}
51
	}
44
}
52
}
(-)compiler/org/eclipse/jdt/internal/compiler/env/AccessRuleSet.java (-8 / +1 lines)
Lines 58-74 Link Here
58
 * Select the first access rule which is violated when accessing a given type, 
58
 * Select the first access rule which is violated when accessing a given type, 
59
 * or null if no 'non accessible' access rule applies.
59
 * or null if no 'non accessible' access rule applies.
60
 * @param targetTypeFilePath the target type file path, formed as: 
60
 * @param targetTypeFilePath the target type file path, formed as: 
61
 * "org/eclipse/jdt/core/JavaCore"; on systems that use '\' as their file 
61
 * "org/eclipse/jdt/core/JavaCore"
62
 * separator, the alternative format: "org\eclipse\jdt\core\JavaCore" is 
63
 * accepted as well; the use of a mix of separators is tolerated but
64
 * discouraged.
65
 * @return the first access restriction that applies if any, null else
62
 * @return the first access restriction that applies if any, null else
66
 */
63
 */
67
public AccessRestriction getViolatedRestriction(char[] targetTypeFilePath) {
64
public AccessRestriction getViolatedRestriction(char[] targetTypeFilePath) {
68
	if (File.separatorChar == '\\') {
69
		targetTypeFilePath = CharOperation.replaceOnCopy(targetTypeFilePath,
70
				File.separatorChar, '/');
71
	}
72
	for (int i = 0, length = this.accessRules.length; i < length; i++) {
65
	for (int i = 0, length = this.accessRules.length; i < length; i++) {
73
		AccessRule accessRule = this.accessRules[i];
66
		AccessRule accessRule = this.accessRules[i];
74
		if (CharOperation.pathMatch(accessRule.pattern, targetTypeFilePath, 
67
		if (CharOperation.pathMatch(accessRule.pattern, targetTypeFilePath, 

Return to bug 119430