@@ -253,19 +253,27 @@ public Element getPreviousChild(Element child) {
253253 public static class NewArray extends Expression {
254254 TypeRef type ;
255255 List <Expression > dimensions = new ArrayList <Expression >();
256+ List <Expression > initialValues = new ArrayList <Expression >();
256257
257258 public NewArray () {}
258259
259- public NewArray (TypeRef type , Expression ... dimensions ) {
260+ public NewArray (TypeRef type , Expression [] dimensions , Expression [] initialValues ) {
260261 setType (type );
261262 setDimensions (Arrays .asList (dimensions ));
263+ setInitialValues (Arrays .asList (initialValues ));
262264 }
263265 public List <Expression > getDimensions () {
264266 return unmodifiableList (dimensions );
265267 }
266268 public void setDimensions (List <Expression > dimensions ) {
267269 changeValue (this , this .dimensions , dimensions );
268270 }
271+ public List <Expression > getInitialValues () {
272+ return unmodifiableList (initialValues );
273+ }
274+ public void setInitialValues (List <Expression > initialValues ) {
275+ changeValue (this , this .initialValues , initialValues );
276+ }
269277 public TypeRef getType () {
270278 return type ;
271279 }
@@ -279,12 +287,18 @@ public void accept(Visitor visitor) {
279287
280288 @ Override
281289 public Element getNextChild (Element child ) {
282- return getNextSibling (dimensions , child );
290+ Element e = getNextSibling (dimensions , child );
291+ if (e == null )
292+ e = getNextSibling (initialValues , child );
293+ return e ;
283294 }
284295
285296 @ Override
286297 public Element getPreviousChild (Element child ) {
287- return getPreviousSibling (dimensions , child );
298+ Element e = getPreviousSibling (dimensions , child );
299+ if (e == null )
300+ e = getPreviousSibling (initialValues , child );
301+ return e ;
288302 }
289303
290304 @ Override
@@ -293,7 +307,9 @@ public boolean replaceChild(Element child, Element by) {
293307 setType ((TypeRef )by );
294308 return true ;
295309 }
296- return replaceChild (dimensions , Expression .class , this , child , by );
310+ return
311+ replaceChild (initialValues , Expression .class , this , child , by ) ||
312+ replaceChild (dimensions , Expression .class , this , child , by );
297313 }
298314
299315 }
0 commit comments