Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 203079 Details for
Bug 357259
[dom] AST#newArrayType(Type, int) should allow array type as argument
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression test
patch_357259.txt (text/plain), 4.54 KB, created by
Olivier Thomann
on 2011-09-09 13:13:04 EDT
(
hide
)
Description:
Proposed fix + regression test
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2011-09-09 13:13:04 EDT
Size:
4.54 KB
patch
obsolete
>### 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 @@ > * <ul> > * <li>the node belongs to a different AST</li> > * <li>the node already has a parent</li> >- * <li>a cycle in would be created</li> > * </ul> > */ > 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. > * <p> > * 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. > * </p> > * >- * @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: > * <ul> > * <li>the node belongs to a different AST</li> > * <li>the node already has a parent</li> >- * <li>a cycle in would be created</li> > * <li>the element type is null</li> >- * <li>the element type is an array type</li> > * <li>the number of dimensions is lower than 1</li> > * <li>the number of dimensions is greater than 1000</li> > * </ul> > */ > 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 @@ > * <ul> > * <li>the node belongs to a different AST</li> > * <li>the node already has a parent</li> >- * <li>a cycle in would be created</li> > * </ul> > */ > public ExpressionStatement newExpressionStatement(Expression expression) { >@@ -1426,7 +1422,6 @@ > * <ul> > * <li>the node belongs to a different AST</li> > * <li>the node already has a parent</li> >- * <li>a cycle in would be created</li> > * <li>the given fragment is null</li> > * </ul> > */ >@@ -2271,7 +2266,6 @@ > * <ul> > * <li>the node belongs to a different AST</li> > * <li>the node already has a parent</li> >- * <li>a cycle in would be created</li> > * </ul> > * @since 3.0 > */ >@@ -2302,7 +2296,6 @@ > * <ul> > * <li>the node belongs to a different AST</li> > * <li>the node already has a parent</li> >- * <li>a cycle in would be created</li> > * </ul> > */ > public TypeDeclarationStatement >@@ -2355,9 +2348,7 @@ > * <ul> > * <li>the node belongs to a different AST</li> > * <li>the node already has a parent</li> >- * <li>a cycle in would be created</li> > * <li>the given fragment is null</li> >- * <li>a cycle in would be created</li> > * </ul> > */ > public VariableDeclarationExpression >@@ -2402,7 +2393,6 @@ > * <ul> > * <li>the node belongs to a different AST</li> > * <li>the node already has a parent</li> >- * <li>a cycle in would be created</li> > * <li>the variable declaration fragment is null</li> > * </ul> > */ >#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 */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 357259
:
203074
| 203079