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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (-14 / +206 lines)
Lines 27-34 Link Here
27
27
28
	static {
28
	static {
29
//	TESTS_NAMES = new String[] { "test000" };
29
//	TESTS_NAMES = new String[] { "test000" };
30
//	TESTS_NUMBERS = new int[] { 27 };
30
//	TESTS_NUMBERS = new int[] { 1 };
31
//	TESTS_RANGE = new int[] { 11, -1 };
31
//	TESTS_RANGE = new int[] { 1, -1 };
32
}	
32
}	
33
public BatchCompilerTest(String name) {
33
public BatchCompilerTest(String name) {
34
	super(name);
34
	super(name);
Lines 1537-1549 Link Here
1537
        " (at line 5)\n" + 
1537
        " (at line 5)\n" + 
1538
        "	Warn warn;\n" + 
1538
        "	Warn warn;\n" + 
1539
        "	^^^^\n" + 
1539
        "	^^^^\n" + 
1540
        "Discouraged access: Warn\n" + 
1540
		"Discouraged access: The type Warn is not accessible due to restriction on classpath entry ---OUTPUT_DIR_PLACEHOLDER---/p1\n" + 
1541
        "----------\n" + 
1541
		"----------\n" + 
1542
        "2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java\n" + 
1542
		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java\n" + 
1543
        " (at line 6)\n" + 
1543
		" (at line 6)\n" + 
1544
        "	KO ko;\n" + 
1544
		"	KO ko;\n" + 
1545
        "	^^\n" + 
1545
		"	^^\n" + 
1546
        "Access restriction: KO\n" + 
1546
		"Access restriction: The type KO is not accessible due to restriction on classpath entry ---OUTPUT_DIR_PLACEHOLDER---\n" + 
1547
        "----------\n" + 
1547
        "----------\n" + 
1548
        "3. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java\n" + 
1548
        "3. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java\n" + 
1549
        " (at line 7)\n" + 
1549
        " (at line 7)\n" + 
Lines 2108-2114 Link Here
2108
        " (at line 2)\n" + 
2108
        " (at line 2)\n" + 
2109
        "	public class Y extends p.X {\n" + 
2109
        "	public class Y extends p.X {\n" + 
2110
        "	                       ^^^\n" + 
2110
        "	                       ^^^\n" + 
2111
        "Discouraged access: X\n" + 
2111
        "Discouraged access: The type X is not accessible due to restriction on classpath entry ---OUTPUT_DIR_PLACEHOLDER---/bin1\n" + 
2112
        "----------\n" + 
2112
        "----------\n" + 
2113
        "1 problem (1 warning)",
2113
        "1 problem (1 warning)",
2114
        false);
2114
        false);
Lines 2189-2218 Link Here
2189
		" (at line 3)\n" + 
2189
		" (at line 3)\n" + 
2190
		"	X x1;\n" + 
2190
		"	X x1;\n" + 
2191
		"	^\n" + 
2191
		"	^\n" + 
2192
		"Discouraged access: X<T>\n" + 
2192
		"Discouraged access: The type X<T> is not accessible due to restriction on classpath entry ---OUTPUT_DIR_PLACEHOLDER---/bin1\n" + 
2193
		"----------\n" + 
2193
		"----------\n" + 
2194
		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java\n" + 
2194
		"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java\n" + 
2195
		" (at line 4)\n" + 
2195
		" (at line 4)\n" + 
2196
		"	X<String> x2 = new X<String>();\n" + 
2196
		"	X<String> x2 = new X<String>();\n" + 
2197
		"	^\n" + 
2197
		"	^\n" + 
2198
		"Discouraged access: X<String>\n" + 
2198
		"Discouraged access: The type X<String> is not accessible due to restriction on classpath entry ---OUTPUT_DIR_PLACEHOLDER---/bin1\n" + 
2199
		"----------\n" + 
2199
		"----------\n" + 
2200
		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java\n" + 
2200
		"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java\n" + 
2201
		" (at line 4)\n" + 
2201
		" (at line 4)\n" + 
2202
		"	X<String> x2 = new X<String>();\n" + 
2202
		"	X<String> x2 = new X<String>();\n" + 
2203
		"	               ^^^^^^^^^^^^^^^\n" + 
2203
		"	               ^^^^^^^^^^^^^^^\n" + 
2204
		"Discouraged access: X<String>()\n" + 
2204
		"Discouraged access: The constructor X<String>() is not accessible due to restriction on classpath entry ---OUTPUT_DIR_PLACEHOLDER---/bin1\n" + 
2205
		"----------\n" + 
2205
		"----------\n" + 
2206
		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java\n" + 
2206
		"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java\n" + 
2207
		" (at line 4)\n" + 
2207
		" (at line 4)\n" + 
2208
		"	X<String> x2 = new X<String>();\n" + 
2208
		"	X<String> x2 = new X<String>();\n" + 
2209
		"	                   ^\n" + 
2209
		"	                   ^\n" + 
2210
		"Discouraged access: X<String>\n" + 
2210
		"Discouraged access: The type X<String> is not accessible due to restriction on classpath entry ---OUTPUT_DIR_PLACEHOLDER---/bin1\n" + 
2211
		"----------\n" + 
2211
		"----------\n" + 
2212
		"4 problems (4 warnings)",
2212
		"4 problems (4 warnings)",
2213
        false);
2213
        false);
2214
}
2214
}
2215
2215
2216
// check we get appropriate combination of access rules
2217
public void test040(){
2218
	this.runConformTest(
2219
		new String[] {
2220
			"p/X.java",
2221
			"package p;\n" + 
2222
			"/** */\n" + 
2223
			"public class X {\n" + 
2224
			"}",
2225
			"p/Z.java",
2226
			"package p;\n" + 
2227
			"/** */\n" + 
2228
			"public class Z {\n" + 
2229
			"}"			
2230
		},
2231
        "\"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "X.java\""
2232
        + " \"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "Z.java\""
2233
        + " -1.5 -g -preserveAllLocals"
2234
        + " -nowarn"
2235
        + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2236
        "", 
2237
        "",
2238
        true);
2239
	this.runConformTest(
2240
		new String[] {
2241
			"Y.java",
2242
			"/** */\n" + 
2243
			"public class Y {\n" +
2244
			"  p.X x;\n" + 
2245
			"  p.Z z;\n" + 
2246
			"}",
2247
		},
2248
        "\"" + OUTPUT_DIR +  File.separator + "Y.java\""
2249
        + " -1.5 -g -preserveAllLocals"
2250
        + " -cp \"" + OUTPUT_DIR + "[+p/X" + File.pathSeparator + "-p/*]\""
2251
        + " -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
2252
        + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2253
        "", 
2254
		"----------\n" + 
2255
		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/Y.java\n" + 
2256
		" (at line 4)\n" + 
2257
		"	p.Z z;\n" + 
2258
		"	^^^\n" + 
2259
		"Access restriction: The type Z is not accessible due to restriction on classpath entry ---OUTPUT_DIR_PLACEHOLDER---\n" + 
2260
		"----------\n" + 
2261
		"1 problem (1 warning)",
2262
        false);
2263
}
2264
2265
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=124533
2266
// turn off discouraged references warnings
2267
public void test041(){
2268
	this.runConformTest(
2269
		new String[] {
2270
			"p/X.java",
2271
			"package p;\n" + 
2272
			"/** */\n" + 
2273
			"public class X {\n" + 
2274
			"}",
2275
			"p/Z.java",
2276
			"package p;\n" + 
2277
			"/** */\n" + 
2278
			"public class Z {\n" + 
2279
			"}"			
2280
		},
2281
        "\"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "X.java\""
2282
        + " \"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "Z.java\""
2283
        + " -1.5 -g -preserveAllLocals"
2284
        + " -nowarn"
2285
        + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2286
        "", 
2287
        "",
2288
        true);
2289
	this.runConformTest(
2290
		new String[] {
2291
			"Y.java",
2292
			"/** */\n" + 
2293
			"public class Y {\n" +
2294
			"  p.X x;\n" + 
2295
			"  p.Z z;\n" + 
2296
			"}",
2297
		},
2298
        "\"" + OUTPUT_DIR +  File.separator + "Y.java\""
2299
        + " -1.5 -g -preserveAllLocals"
2300
        + " -cp \"" + OUTPUT_DIR + "[~p/X" + File.pathSeparator + "-p/*]\""
2301
        + " -warn:-discouraged -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
2302
        + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2303
        "", 
2304
		"----------\n" + 
2305
		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/Y.java\n" + 
2306
		" (at line 4)\n" + 
2307
		"	p.Z z;\n" + 
2308
		"	^^^\n" + 
2309
		"Access restriction: The type Z is not accessible due to restriction on classpath entry ---OUTPUT_DIR_PLACEHOLDER---\n" + 		
2310
		"----------\n" + 
2311
		"1 problem (1 warning)",
2312
        false);
2313
}
2314
2315
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=124533
2316
// turn off discouraged references warnings
2317
public void test042(){
2318
	this.runConformTest(
2319
		new String[] {
2320
			"p/X.java",
2321
			"package p;\n" + 
2322
			"/** */\n" + 
2323
			"public class X {\n" + 
2324
			"}",
2325
			"p/Z.java",
2326
			"package p;\n" + 
2327
			"/** */\n" + 
2328
			"public class Z {\n" + 
2329
			"}"			
2330
		},
2331
        "\"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "X.java\""
2332
        + " \"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "Z.java\""
2333
        + " -1.5 -g -preserveAllLocals"
2334
        + " -nowarn"
2335
        + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2336
        "", 
2337
        "",
2338
        true);
2339
	this.runConformTest(
2340
		new String[] {
2341
			"Y.java",
2342
			"/** */\n" + 
2343
			"public class Y {\n" +
2344
			"  p.X x;\n" + 
2345
			"  p.Z z;\n" + 
2346
			"}",
2347
		},
2348
        "\"" + OUTPUT_DIR +  File.separator + "Y.java\""
2349
        + " -1.5 -g -preserveAllLocals"
2350
        + " -cp \"" + OUTPUT_DIR + "[~p/X" + File.pathSeparator + "-p/*]\""
2351
        + " -warn:-forbidden -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
2352
        + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2353
        "", 
2354
		"----------\n" + 
2355
		"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/Y.java\n" + 
2356
		" (at line 3)\n" + 
2357
		"	p.X x;\n" + 
2358
		"	^^^\n" + 
2359
		"Discouraged access: The type X is not accessible due to restriction on classpath entry ---OUTPUT_DIR_PLACEHOLDER---\n" + 
2360
		"----------\n" + 
2361
		"1 problem (1 warning)",
2362
        false);
2363
}
2364
2365
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=124533
2366
// turn off discouraged references warnings
2367
public void test043(){
2368
	this.runConformTest(
2369
		new String[] {
2370
			"p/X.java",
2371
			"package p;\n" + 
2372
			"/** */\n" + 
2373
			"public class X {\n" + 
2374
			"}",
2375
			"p/Z.java",
2376
			"package p;\n" + 
2377
			"/** */\n" + 
2378
			"public class Z {\n" + 
2379
			"}"			
2380
		},
2381
        "\"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "X.java\""
2382
        + " \"" + OUTPUT_DIR +  File.separator + "p"  +  File.separator + "Z.java\""
2383
        + " -1.5 -g -preserveAllLocals"
2384
        + " -nowarn"
2385
        + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2386
        "", 
2387
        "",
2388
        true);
2389
	this.runConformTest(
2390
		new String[] {
2391
			"Y.java",
2392
			"/** */\n" + 
2393
			"public class Y {\n" +
2394
			"  p.X x;\n" + 
2395
			"  p.Z z;\n" + 
2396
			"}",
2397
		},
2398
        "\"" + OUTPUT_DIR +  File.separator + "Y.java\""
2399
        + " -1.5 -g -preserveAllLocals"
2400
        + " -cp \"" + OUTPUT_DIR + "[~p/X" + File.pathSeparator + "-p/*]\""
2401
        + " -warn:-discouraged,forbidden -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal"
2402
        + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
2403
        "", 
2404
		"",
2405
        false);
2406
}
2407
2216
public static Class testClass() {
2408
public static Class testClass() {
2217
	return BatchCompilerTest.class;
2409
	return BatchCompilerTest.class;
2218
}
2410
}
(-)batch/org/eclipse/jdt/internal/compiler/batch/messages.properties (-5 / +14 lines)
Lines 96-110 Link Here
96
\    -cp -classpath <directories and zip/jar files separated by {0}>\n\
96
\    -cp -classpath <directories and zip/jar files separated by {0}>\n\
97
\                       specify location for application classes and sources. Each\n\
97
\                       specify location for application classes and sources. Each\n\
98
\                       directory or file can specify access rules for types between\n\
98
\                       directory or file can specify access rules for types between\n\
99
\                       ''['' and '']'' (e.g. [-X.java] to deny access to type X)\n\
99
\                       ''['' and '']'' (e.g. [-X] to forbid access to type X, [~X] to\n\
100
\                       discourage access to type X, [+p/X:-p/*] to forbid access to all\n\
101
\                       types in package p but allow access to p/X)\n\
100
\    -bootclasspath <directories and zip/jar files separated by {0}>\n\
102
\    -bootclasspath <directories and zip/jar files separated by {0}>\n\
101
\                       specify location for system classes. Each directory or file can\n\
103
\                       specify location for system classes. Each directory or file can\n\
102
\                       specify access rules for types between ''['' and '']'' (e.g. [-X.java]\n\
104
\                       specify access rules for types between ''['' and '']''\n\
103
\                       to deny access to type X)\n\
104
\    -sourcepath <directories separated by {0}>\n\
105
\    -sourcepath <directories separated by {0}>\n\
105
\                       specify location for application sources. Each directory can\n\
106
\                       specify location for application sources. Each directory can\n\
106
\                       specify access rules for types between ''['' and '']'' (e.g. [-X.java]\n\
107
\                       specify access rules for types between ''['' and '']''\n\
107
\                       to deny access to type X)\n\
108
\    -extdirs <directories separated by {0}>\n\
108
\    -extdirs <directories separated by {0}>\n\
109
\                       specify location for extension zip/jar files\n\
109
\                       specify location for extension zip/jar files\n\
110
\    -d <dir>           destination directory (if omitted, no directory is created)\n\
110
\    -d <dir>           destination directory (if omitted, no directory is created)\n\
Lines 136-146 Link Here
136
\      constructorName    + method with constructor name\n\
136
\      constructorName    + method with constructor name\n\
137
\      dep-ann              missing @Deprecated annotation\n\
137
\      dep-ann              missing @Deprecated annotation\n\
138
\      deprecation        + deprecation outside deprecated code\n\
138
\      deprecation        + deprecation outside deprecated code\n\
139
\      discouraged        + use of types matching a discouraged access rule\n\
139
\      emptyBlock           undocumented empty block\n\
140
\      emptyBlock           undocumented empty block\n\
140
\      enumSwitch           incomplete enum switch\n\
141
\      enumSwitch           incomplete enum switch\n\
141
\      fieldHiding          field hiding another variable\n\
142
\      fieldHiding          field hiding another variable\n\
142
\      finalBound           type parameter with final bound\n\
143
\      finalBound           type parameter with final bound\n\
143
\      finally            + finally block not completing normally\n\
144
\      finally            + finally block not completing normally\n\
145
\      forbidden          + use of types matching a forbidden access rule\n\
144
\      hiding               macro for fieldHiding, localHiding, typeHiding and maskedCatchBlock\n\
146
\      hiding               macro for fieldHiding, localHiding, typeHiding and maskedCatchBlock\n\
145
\      incomplete-switch    same as enumSwitch\n\
147
\      incomplete-switch    same as enumSwitch\n\
146
\      indirectStatic       indirect reference to static member\n\
148
\      indirectStatic       indirect reference to static member\n\
Lines 214-216 Link Here
214
\    -v -version        print compiler version\n\
216
\    -v -version        print compiler version\n\
215
\    -showversion       print compiler version and continue\n
217
\    -showversion       print compiler version and continue\n
216
218
219
# templates
220
### access restrictions
221
template.restrictedAccess.type = The type {0} is not accessible due to restriction on classpath entry {1}
222
template.restrictedAccess.constructor = The constructor {0} is not accessible due to restriction on classpath entry {1}
223
template.restrictedAccess.field = The field {0} from the type {1} is not accessible due to restriction on classpath entry {2}
224
template.restrictedAccess.method = The method {0} from the type {1} is not accessible due to restriction on classpath entry {2}
225
(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (-1 / +22 lines)
Lines 1920-1925 Link Here
1920
						this.options.put(
1920
						this.options.put(
1921
							CompilerOptions.OPTION_ReportParameterAssignment,
1921
							CompilerOptions.OPTION_ReportParameterAssignment,
1922
							isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
1922
							isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
1923
					} else if (token.equals("discouraged")) { //$NON-NLS-1$
1924
						this.options.put(
1925
							CompilerOptions.OPTION_ReportDiscouragedReference,
1926
							isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
1927
					} else if (token.equals("forbidden")) { //$NON-NLS-1$
1928
						this.options.put(
1929
							CompilerOptions.OPTION_ReportForbiddenReference,
1930
							isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
1923
					} else {
1931
					} else {
1924
						throw new InvalidInputException(Main.bind("configure.invalidWarning", token)); //$NON-NLS-1$
1932
						throw new InvalidInputException(Main.bind("configure.invalidWarning", token)); //$NON-NLS-1$
1925
					}
1933
					}
Lines 2546-2552 Link Here
2546
			}
2554
			}
2547
		}
2555
		}
2548
		if (rulesOK) {
2556
		if (rulesOK) {
2549
			AccessRuleSet accessRuleSet = new AccessRuleSet(accessRules);
2557
			String templates[] = new String[AccessRuleSet.MESSAGE_TEMPLATES_LENGTH];
2558
			templates[0] = Main.bind(
2559
				"template.restrictedAccess.type", //$NON-NLS-1$
2560
				new String[] {"{0}", currentClasspathName}); //$NON-NLS-1$ 
2561
			templates[1] = Main.bind(
2562
				"template.restrictedAccess.constructor", //$NON-NLS-1$
2563
				new String[] {"{0}", currentClasspathName}); //$NON-NLS-1$ 
2564
			templates[2] = Main.bind(
2565
				"template.restrictedAccess.method", //$NON-NLS-1$
2566
				new String[] {"{0}", "{1}", currentClasspathName}); //$NON-NLS-1$ //$NON-NLS-2$ 
2567
			templates[3] = Main.bind(
2568
				"template.restrictedAccess.field", //$NON-NLS-1$
2569
				new String[] {"{0}", "{1}", currentClasspathName}); //$NON-NLS-1$ //$NON-NLS-2$ 
2570
			AccessRuleSet accessRuleSet = new AccessRuleSet(accessRules, templates);
2550
			FileSystem.Classpath currentClasspath = FileSystem
2571
			FileSystem.Classpath currentClasspath = FileSystem
2551
					.getClasspath(currentClasspathName,
2572
					.getClasspath(currentClasspathName,
2552
							customEncoding, 0, accessRuleSet);
2573
							customEncoding, 0, accessRuleSet);
(-)model/org/eclipse/jdt/internal/core/builder/State.java (-2 / +1 lines)
Lines 334-341 Link Here
334
	for (int i = 0; i < AccessRuleSet.MESSAGE_TEMPLATES_LENGTH; i++) {
334
	for (int i = 0; i < AccessRuleSet.MESSAGE_TEMPLATES_LENGTH; i++) {
335
		messageTemplates[i] = in.readUTF();
335
		messageTemplates[i] = in.readUTF();
336
	}
336
	}
337
	AccessRuleSet accessRuleSet = new AccessRuleSet(accessRules);
337
	AccessRuleSet accessRuleSet = new AccessRuleSet(accessRules, messageTemplates);
338
	accessRuleSet.messageTemplates = messageTemplates;
339
	return accessRuleSet;
338
	return accessRuleSet;
340
}
339
}
341
340
(-)search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java (-1 / +1 lines)
Lines 51-57 Link Here
51
	private int threshold;
51
	private int threshold;
52
	
52
	
53
	private IPath[] enclosingProjectsAndJars;
53
	private IPath[] enclosingProjectsAndJars;
54
	public final static AccessRuleSet NOT_ENCLOSED = new AccessRuleSet(null);
54
	public final static AccessRuleSet NOT_ENCLOSED = new AccessRuleSet(null, null);
55
	
55
	
56
public JavaSearchScope() {
56
public JavaSearchScope() {
57
	this(5);
57
	this(5);
(-)model/org/eclipse/jdt/internal/core/ClasspathEntry.java (-15 / +10 lines)
Lines 218-229 Link Here
218
		this.inclusionPatterns = inclusionPatterns;
218
		this.inclusionPatterns = inclusionPatterns;
219
		this.exclusionPatterns = exclusionPatterns;
219
		this.exclusionPatterns = exclusionPatterns;
220
		
220
		
221
		AccessRuleSet ruleSet = createAccessRuleSet(accessRules);
221
		int length;
222
		if (ruleSet != null) {
222
		if (accessRules != null && (length = accessRules.length) > 0) {
223
			// compute message template
223
			AccessRule[] rules = new AccessRule[length];
224
			ruleSet.messageTemplates = getMessageTemplates();
224
			System.arraycopy(accessRules, 0, rules, 0, length);
225
		}
225
			this.accessRuleSet = new AccessRuleSet(rules, getMessageTemplates());
226
		this.accessRuleSet = ruleSet;
226
		}
227
//		else { -- implicit!
228
//			this.accessRuleSet = null;
229
//		}
227
		
230
		
228
		this.combineAccessRules = combineAccessRules;
231
		this.combineAccessRules = combineAccessRules;
229
		this.extraAttributes = extraAttributes;
232
		this.extraAttributes = extraAttributes;
Lines 239-253 Link Here
239
		this.specificOutputLocation = specificOutputLocation;
242
		this.specificOutputLocation = specificOutputLocation;
240
		this.isExported = isExported;
243
		this.isExported = isExported;
241
	}
244
	}
242
	
245
243
	private static AccessRuleSet createAccessRuleSet(IAccessRule[] accessRules) {
244
		int length = accessRules == null ? 0 : accessRules.length;
245
		if (length == 0) return null;
246
		AccessRule[] rules = new AccessRule[length];
247
		System.arraycopy(accessRules, 0, rules, 0, length);
248
		return new AccessRuleSet(rules);
249
	}
250
	
251
	public boolean combineAccessRules() {
246
	public boolean combineAccessRules() {
252
		return this.combineAccessRules;
247
		return this.combineAccessRules;
253
	}
248
	}
(-)compiler/org/eclipse/jdt/internal/compiler/env/AccessRuleSet.java (-7 / +2 lines)
Lines 22-41 Link Here
22
	public String[] messageTemplates;
22
	public String[] messageTemplates;
23
	public static final int MESSAGE_TEMPLATES_LENGTH = 4;
23
	public static final int MESSAGE_TEMPLATES_LENGTH = 4;
24
	
24
	
25
	
26
	public AccessRuleSet(AccessRule[] accessRules) {
27
		this(accessRules, null);
28
	}
29
	
30
	/**
25
	/**
31
	 * Make a new set of access rules.
26
	 * Make a new set of access rules.
32
	 * @param accessRules the access rules to be contained by the new set
27
	 * @param accessRules the access rules to be contained by the new set
33
	 * @param messageTemplates a Sting[4] array specifying the messages for type, 
28
	 * @param messageTemplates a Sting[4] array specifying the messages for type, 
34
	 * constructor, method and field access violation; each should contain as many
29
	 * constructor, method and field access violation; each should contain as many
35
	 * placeholders as expected by the respective access violation message (that is,
30
	 * placeholders as expected by the respective access violation message (that is,
36
	 * one for type and constructor, two for method and field).
31
	 * one for type and constructor, two for method and field); replaced by a
32
	 * default value if null.
37
	 */
33
	 */
38
	// TODO (maxime) move to better support
39
	public AccessRuleSet(AccessRule[] accessRules, String[] messageTemplates) {
34
	public AccessRuleSet(AccessRule[] accessRules, String[] messageTemplates) {
40
		this.accessRules = accessRules;
35
		this.accessRules = accessRules;
41
		if (messageTemplates != null && messageTemplates.length == MESSAGE_TEMPLATES_LENGTH)
36
		if (messageTemplates != null && messageTemplates.length == MESSAGE_TEMPLATES_LENGTH)

Return to bug 124533