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

Collapse All | Expand All

(-)dom/org/eclipse/jdt/core/dom/AST.java (-13 / +3 lines)
Lines 1060-1066 Link Here
1060
	 * <ul>
1060
	 * <ul>
1061
	 * <li>the node belongs to a different AST</li>
1061
	 * <li>the node belongs to a different AST</li>
1062
	 * <li>the node already has a parent</li>
1062
	 * <li>the node already has a parent</li>
1063
	 * <li>a cycle in would be created</li>
1064
	 * </ul>
1063
	 * </ul>
1065
	 */
1064
	 */
1066
	public ArrayType newArrayType(Type componentType) {
1065
	public ArrayType newArrayType(Type componentType) {
Lines 1071-1098 Link Here
1071
1070
1072
	/**
1071
	/**
1073
	 * Creates and returns a new unparented array type node with the given
1072
	 * Creates and returns a new unparented array type node with the given
1074
	 * element type and number of dimensions.
1073
	 * element type and number of (additional) dimensions.
1075
	 * <p>
1074
	 * <p>
1076
	 * Note that if the element type passed in is an array type, the
1075
	 * Note that if the element type passed in is an array type, the
1077
	 * element type of the result will not be the same as what was passed in.
1076
	 * element type of the result will not be the same as what was passed in.
1078
	 * </p>
1077
	 * </p>
1079
	 *
1078
	 *
1080
	 * @param elementType the element type (never an array type)
1079
	 * @param elementType the element type (can be an array type)
1081
	 * @param dimensions the number of dimensions, a positive number
1080
	 * @param dimensions the number of dimensions, a positive number
1082
	 * @return a new unparented array type node
1081
	 * @return a new unparented array type node
1083
	 * @exception IllegalArgumentException if:
1082
	 * @exception IllegalArgumentException if:
1084
	 * <ul>
1083
	 * <ul>
1085
	 * <li>the node belongs to a different AST</li>
1084
	 * <li>the node belongs to a different AST</li>
1086
	 * <li>the node already has a parent</li>
1085
	 * <li>the node already has a parent</li>
1087
	 * <li>a cycle in would be created</li>
1088
	 * <li>the element type is null</li>
1086
	 * <li>the element type is null</li>
1089
	 * <li>the element type is an array type</li>
1090
	 * <li>the number of dimensions is lower than 1</li>
1087
	 * <li>the number of dimensions is lower than 1</li>
1091
	 * <li>the number of dimensions is greater than 1000</li>
1088
	 * <li>the number of dimensions is greater than 1000</li>
1092
	 * </ul>
1089
	 * </ul>
1093
	 */
1090
	 */
1094
	public ArrayType newArrayType(Type elementType, int dimensions) {
1091
	public ArrayType newArrayType(Type elementType, int dimensions) {
1095
		if (elementType == null || elementType.isArrayType()) {
1092
		if (elementType == null) {
1096
			throw new IllegalArgumentException();
1093
			throw new IllegalArgumentException();
1097
		}
1094
		}
1098
		if (dimensions < 1 || dimensions > 1000) {
1095
		if (dimensions < 1 || dimensions > 1000) {
Lines 1386-1392 Link Here
1386
	 * <ul>
1383
	 * <ul>
1387
	 * <li>the node belongs to a different AST</li>
1384
	 * <li>the node belongs to a different AST</li>
1388
	 * <li>the node already has a parent</li>
1385
	 * <li>the node already has a parent</li>
1389
	 * <li>a cycle in would be created</li>
1390
	 * </ul>
1386
	 * </ul>
1391
	 */
1387
	 */
1392
	public ExpressionStatement newExpressionStatement(Expression expression) {
1388
	public ExpressionStatement newExpressionStatement(Expression expression) {
Lines 1426-1432 Link Here
1426
	 * <ul>
1422
	 * <ul>
1427
	 * <li>the node belongs to a different AST</li>
1423
	 * <li>the node belongs to a different AST</li>
1428
	 * <li>the node already has a parent</li>
1424
	 * <li>the node already has a parent</li>
1429
	 * <li>a cycle in would be created</li>
1430
	 * <li>the given fragment is null</li>
1425
	 * <li>the given fragment is null</li>
1431
	 * </ul>
1426
	 * </ul>
1432
	 */
1427
	 */
Lines 2271-2277 Link Here
2271
	 * <ul>
2266
	 * <ul>
2272
	 * <li>the node belongs to a different AST</li>
2267
	 * <li>the node belongs to a different AST</li>
2273
	 * <li>the node already has a parent</li>
2268
	 * <li>the node already has a parent</li>
2274
	 * <li>a cycle in would be created</li>
2275
	 * </ul>
2269
	 * </ul>
2276
	 * @since 3.0
2270
	 * @since 3.0
2277
	 */
2271
	 */
Lines 2302-2308 Link Here
2302
	 * <ul>
2296
	 * <ul>
2303
	 * <li>the node belongs to a different AST</li>
2297
	 * <li>the node belongs to a different AST</li>
2304
	 * <li>the node already has a parent</li>
2298
	 * <li>the node already has a parent</li>
2305
	 * <li>a cycle in would be created</li>
2306
	 * </ul>
2299
	 * </ul>
2307
	 */
2300
	 */
2308
	public TypeDeclarationStatement
2301
	public TypeDeclarationStatement
Lines 2355-2363 Link Here
2355
	 * <ul>
2348
	 * <ul>
2356
	 * <li>the node belongs to a different AST</li>
2349
	 * <li>the node belongs to a different AST</li>
2357
	 * <li>the node already has a parent</li>
2350
	 * <li>the node already has a parent</li>
2358
	 * <li>a cycle in would be created</li>
2359
	 * <li>the given fragment is null</li>
2351
	 * <li>the given fragment is null</li>
2360
	 * <li>a cycle in would be created</li>
2361
	 * </ul>
2352
	 * </ul>
2362
	 */
2353
	 */
2363
	public VariableDeclarationExpression
2354
	public VariableDeclarationExpression
Lines 2402-2408 Link Here
2402
	 * <ul>
2393
	 * <ul>
2403
	 * <li>the node belongs to a different AST</li>
2394
	 * <li>the node belongs to a different AST</li>
2404
	 * <li>the node already has a parent</li>
2395
	 * <li>the node already has a parent</li>
2405
	 * <li>a cycle in would be created</li>
2406
	 * <li>the variable declaration fragment is null</li>
2396
	 * <li>the variable declaration fragment is null</li>
2407
	 * </ul>
2397
	 * </ul>
2408
	 */
2398
	 */
(-)src/org/eclipse/jdt/core/tests/dom/ASTTest.java (+18 lines)
Lines 2092-2097 Link Here
2092
2092
2093
		assertTrue(x.getDimensions() == 5);
2093
		assertTrue(x.getDimensions() == 5);
2094
		assertTrue(x.getElementType().isPrimitiveType());
2094
		assertTrue(x.getElementType().isPrimitiveType());
2095
		final ArrayType x3 = this.ast.newArrayType(x, 2);
2096
		assertTrue(x3.getDimensions() == 7);
2097
		
2098
		try {
2099
			this.ast.newArrayType(null, 2);
2100
		} catch(IllegalArgumentException e) {
2101
			// ignore - expected
2102
		}
2103
		try {
2104
			this.ast.newArrayType(x, 0);
2105
		} catch(IllegalArgumentException e) {
2106
			// ignore - expected
2107
		}
2108
		try {
2109
			this.ast.newArrayType(x, 100000);
2110
		} catch(IllegalArgumentException e) {
2111
			// ignore - expected
2112
		}
2095
	}
2113
	}
2096
2114
2097
	/** @deprecated using deprecated code */
2115
	/** @deprecated using deprecated code */

Return to bug 357259