### Eclipse Workspace Patch 1.0
#P org.eclipse.jdt.core
Index: dom/org/eclipse/jdt/core/dom/AST.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java,v
retrieving revision 1.168
diff -u -r1.168 AST.java
--- dom/org/eclipse/jdt/core/dom/AST.java 28 Jul 2011 17:07:33 -0000 1.168
+++ dom/org/eclipse/jdt/core/dom/AST.java 9 Sep 2011 17:11:26 -0000
@@ -1060,7 +1060,6 @@
*
* - the node belongs to a different AST
* - the node already has a parent
- * - a cycle in would be created
*
*/
public ArrayType newArrayType(Type componentType) {
@@ -1071,28 +1070,26 @@
/**
* Creates and returns a new unparented array type node with the given
- * element type and number of dimensions.
+ * element type and number of (additional) dimensions.
*
* Note that if the element type passed in is an array type, the
* element type of the result will not be the same as what was passed in.
*
*
- * @param elementType the element type (never an array type)
+ * @param elementType the element type (can be an array type)
* @param dimensions the number of dimensions, a positive number
* @return a new unparented array type node
* @exception IllegalArgumentException if:
*
* - the node belongs to a different AST
* - the node already has a parent
- * - a cycle in would be created
* - the element type is null
- * - the element type is an array type
* - the number of dimensions is lower than 1
* - the number of dimensions is greater than 1000
*
*/
public ArrayType newArrayType(Type elementType, int dimensions) {
- if (elementType == null || elementType.isArrayType()) {
+ if (elementType == null) {
throw new IllegalArgumentException();
}
if (dimensions < 1 || dimensions > 1000) {
@@ -1386,7 +1383,6 @@
*
* - the node belongs to a different AST
* - the node already has a parent
- * - a cycle in would be created
*
*/
public ExpressionStatement newExpressionStatement(Expression expression) {
@@ -1426,7 +1422,6 @@
*
* - the node belongs to a different AST
* - the node already has a parent
- * - a cycle in would be created
* - the given fragment is null
*
*/
@@ -2271,7 +2266,6 @@
*
* - the node belongs to a different AST
* - the node already has a parent
- * - a cycle in would be created
*
* @since 3.0
*/
@@ -2302,7 +2296,6 @@
*
* - the node belongs to a different AST
* - the node already has a parent
- * - a cycle in would be created
*
*/
public TypeDeclarationStatement
@@ -2355,9 +2348,7 @@
*
* - the node belongs to a different AST
* - the node already has a parent
- * - a cycle in would be created
* - the given fragment is null
- * - a cycle in would be created
*
*/
public VariableDeclarationExpression
@@ -2402,7 +2393,6 @@
*
* - the node belongs to a different AST
* - the node already has a parent
- * - a cycle in would be created
* - the variable declaration fragment is null
*
*/
#P org.eclipse.jdt.core.tests.model
Index: src/org/eclipse/jdt/core/tests/dom/ASTTest.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java,v
retrieving revision 1.71
diff -u -r1.71 ASTTest.java
--- src/org/eclipse/jdt/core/tests/dom/ASTTest.java 28 Jul 2011 17:06:01 -0000 1.71
+++ src/org/eclipse/jdt/core/tests/dom/ASTTest.java 9 Sep 2011 17:11:28 -0000
@@ -2092,6 +2092,24 @@
assertTrue(x.getDimensions() == 5);
assertTrue(x.getElementType().isPrimitiveType());
+ final ArrayType x3 = this.ast.newArrayType(x, 2);
+ assertTrue(x3.getDimensions() == 7);
+
+ try {
+ this.ast.newArrayType(null, 2);
+ } catch(IllegalArgumentException e) {
+ // ignore - expected
+ }
+ try {
+ this.ast.newArrayType(x, 0);
+ } catch(IllegalArgumentException e) {
+ // ignore - expected
+ }
+ try {
+ this.ast.newArrayType(x, 100000);
+ } catch(IllegalArgumentException e) {
+ // ignore - expected
+ }
}
/** @deprecated using deprecated code */