001    /* This file was generated with JastAdd2 (http://jastadd.org) version R20130213 */
002    package AST;
003    
004    import java.util.HashSet;
005    import java.io.File;
006    import java.util.*;
007    import beaver.*;
008    import java.util.ArrayList;
009    import java.util.zip.*;
010    import java.io.*;
011    import java.io.FileNotFoundException;
012    import java.util.Collection;
013    /**
014     * @production AnonymousDecl : {@link ClassDecl} ::= <span class="component">{@link Modifiers}</span> <span class="component">&lt;ID:String&gt;</span> <span class="component">[SuperClassAccess:{@link Access}]</span> <span class="component">Implements:{@link Access}*</span> <span class="component">{@link BodyDecl}*</span>;
015     * @ast node
016     * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/java.ast:70
017     */
018    public class AnonymousDecl extends ClassDecl implements Cloneable {
019      /**
020       * @apilevel low-level
021       */
022      public void flushCache() {
023      }
024      /**
025       * @apilevel internal
026       */
027      public void flushCollectionCache() {
028      }
029      /**
030       * @apilevel internal
031       */
032      @SuppressWarnings({"unchecked", "cast"})
033      public AnonymousDecl clone() throws CloneNotSupportedException {
034        AnonymousDecl node = (AnonymousDecl)super.clone();
035        node.isCircular_visited = -1;
036        node.isCircular_computed = false;
037        node.isCircular_initialized = false;
038        node.getSuperClassAccessOpt_computed = false;
039        node.getSuperClassAccessOpt_value = null;
040        node.getImplementsList_computed = false;
041        node.getImplementsList_value = null;
042        node.in$Circle(false);
043        node.is$Final(false);
044        return node;
045      }
046    /**
047     * @apilevel internal
048     */
049      @SuppressWarnings({"unchecked", "cast"})
050    public AnonymousDecl copy() {
051      
052      try {
053        AnonymousDecl node = (AnonymousDecl) clone();
054        node.parent = null;
055        if(children != null)
056          node.children = (ASTNode[]) children.clone();
057        
058        return node;
059      } catch (CloneNotSupportedException e) {
060        throw new Error("Error: clone not supported for " + getClass().getName());
061      }
062      
063    }/**
064     * Create a deep copy of the AST subtree at this node.
065     * The copy is dangling, i.e. has no parent.
066     * @return dangling copy of the subtree at this node
067     * @apilevel low-level
068     */
069      @SuppressWarnings({"unchecked", "cast"})
070    public AnonymousDecl fullCopy() {
071      
072      AnonymousDecl tree = (AnonymousDecl) copy();
073      if (children != null) {
074        for (int i = 0; i < children.length; ++i) {
075                    switch (i) {
076                    case 3:
077                      tree.children[i] = new Opt();
078                      continue;
079                    case 4:
080                      tree.children[i] = new List();
081                      continue;
082                    }
083          ASTNode child = (ASTNode) children[i];
084          if(child != null) {
085            child = child.fullCopy();
086            tree.setChild(child, i);
087          }
088        }
089      }
090      return tree;
091      
092    }  /**
093       * @ast method 
094       * @aspect GenerateClassfile
095       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/GenerateClassfile.jrag:355
096       */
097      public boolean clear() {
098        for(int i = 0; i < getNumChild(); i++)
099          getChild(i).clear();
100        setParent(null);
101        flushCache();
102        return true;
103      }
104      /**
105       * @ast method 
106       * 
107       */
108      public AnonymousDecl() {
109        super();
110    
111    
112      }
113      /**
114       * Initializes the child array to the correct size.
115       * Initializes List and Opt nta children.
116       * @apilevel internal
117       * @ast method
118       * @ast method 
119       * 
120       */
121      public void init$Children() {
122        children = new ASTNode[4];
123        setChild(new List(), 1);
124        setChild(new Opt(), 2);
125        setChild(new List(), 3);
126      }
127      /**
128       * @ast method 
129       * 
130       */
131      public AnonymousDecl(Modifiers p0, String p1, List<BodyDecl> p2) {
132        setChild(p0, 0);
133        setID(p1);
134        setChild(p2, 1);
135      }
136      /**
137       * @ast method 
138       * 
139       */
140      public AnonymousDecl(Modifiers p0, beaver.Symbol p1, List<BodyDecl> p2) {
141        setChild(p0, 0);
142        setID(p1);
143        setChild(p2, 1);
144      }
145      /**
146       * @apilevel low-level
147       * @ast method 
148       * 
149       */
150      protected int numChildren() {
151        return 2;
152      }
153      /**
154       * @apilevel internal
155       * @ast method 
156       * 
157       */
158      public boolean mayHaveRewrite() {
159        return true;
160      }
161      /**
162       * Replaces the Modifiers child.
163       * @param node The new node to replace the Modifiers child.
164       * @apilevel high-level
165       * @ast method 
166       * 
167       */
168      public void setModifiers(Modifiers node) {
169        setChild(node, 0);
170      }
171      /**
172       * Retrieves the Modifiers child.
173       * @return The current node used as the Modifiers child.
174       * @apilevel high-level
175       * @ast method 
176       * 
177       */
178      public Modifiers getModifiers() {
179        return (Modifiers)getChild(0);
180      }
181      /**
182       * Retrieves the Modifiers child.
183       * <p><em>This method does not invoke AST transformations.</em></p>
184       * @return The current node used as the Modifiers child.
185       * @apilevel low-level
186       * @ast method 
187       * 
188       */
189      public Modifiers getModifiersNoTransform() {
190        return (Modifiers)getChildNoTransform(0);
191      }
192      /**
193       * Replaces the lexeme ID.
194       * @param value The new value for the lexeme ID.
195       * @apilevel high-level
196       * @ast method 
197       * 
198       */
199      public void setID(String value) {
200        tokenString_ID = value;
201      }
202      /**
203       * JastAdd-internal setter for lexeme ID using the Beaver parser.
204       * @apilevel internal
205       * @ast method 
206       * 
207       */
208      public void setID(beaver.Symbol symbol) {
209        if(symbol.value != null && !(symbol.value instanceof String))
210          throw new UnsupportedOperationException("setID is only valid for String lexemes");
211        tokenString_ID = (String)symbol.value;
212        IDstart = symbol.getStart();
213        IDend = symbol.getEnd();
214      }
215      /**
216       * Retrieves the value for the lexeme ID.
217       * @return The value for the lexeme ID.
218       * @apilevel high-level
219       * @ast method 
220       * 
221       */
222      public String getID() {
223        return tokenString_ID != null ? tokenString_ID : "";
224      }
225      /**
226       * Replaces the BodyDecl list.
227       * @param list The new list node to be used as the BodyDecl list.
228       * @apilevel high-level
229       * @ast method 
230       * 
231       */
232      public void setBodyDeclList(List<BodyDecl> list) {
233        setChild(list, 1);
234      }
235      /**
236       * Retrieves the number of children in the BodyDecl list.
237       * @return Number of children in the BodyDecl list.
238       * @apilevel high-level
239       * @ast method 
240       * 
241       */
242      public int getNumBodyDecl() {
243        return getBodyDeclList().getNumChild();
244      }
245      /**
246       * Retrieves the number of children in the BodyDecl list.
247       * Calling this method will not trigger rewrites..
248       * @return Number of children in the BodyDecl list.
249       * @apilevel low-level
250       * @ast method 
251       * 
252       */
253      public int getNumBodyDeclNoTransform() {
254        return getBodyDeclListNoTransform().getNumChildNoTransform();
255      }
256      /**
257       * Retrieves the element at index {@code i} in the BodyDecl list..
258       * @param i Index of the element to return.
259       * @return The element at position {@code i} in the BodyDecl list.
260       * @apilevel high-level
261       * @ast method 
262       * 
263       */
264      @SuppressWarnings({"unchecked", "cast"})
265      public BodyDecl getBodyDecl(int i) {
266        return (BodyDecl)getBodyDeclList().getChild(i);
267      }
268      /**
269       * Append an element to the BodyDecl list.
270       * @param node The element to append to the BodyDecl list.
271       * @apilevel high-level
272       * @ast method 
273       * 
274       */
275      public void addBodyDecl(BodyDecl node) {
276        List<BodyDecl> list = (parent == null || state == null) ? getBodyDeclListNoTransform() : getBodyDeclList();
277        list.addChild(node);
278      }
279      /**
280       * @apilevel low-level
281       * @ast method 
282       * 
283       */
284      public void addBodyDeclNoTransform(BodyDecl node) {
285        List<BodyDecl> list = getBodyDeclListNoTransform();
286        list.addChild(node);
287      }
288      /**
289       * Replaces the BodyDecl list element at index {@code i} with the new node {@code node}.
290       * @param node The new node to replace the old list element.
291       * @param i The list index of the node to be replaced.
292       * @apilevel high-level
293       * @ast method 
294       * 
295       */
296      public void setBodyDecl(BodyDecl node, int i) {
297        List<BodyDecl> list = getBodyDeclList();
298        list.setChild(node, i);
299      }
300      /**
301       * Retrieves the BodyDecl list.
302       * @return The node representing the BodyDecl list.
303       * @apilevel high-level
304       * @ast method 
305       * 
306       */
307      public List<BodyDecl> getBodyDecls() {
308        return getBodyDeclList();
309      }
310      /**
311       * Retrieves the BodyDecl list.
312       * <p><em>This method does not invoke AST transformations.</em></p>
313       * @return The node representing the BodyDecl list.
314       * @apilevel low-level
315       * @ast method 
316       * 
317       */
318      public List<BodyDecl> getBodyDeclsNoTransform() {
319        return getBodyDeclListNoTransform();
320      }
321      /**
322       * Retrieves the BodyDecl list.
323       * @return The node representing the BodyDecl list.
324       * @apilevel high-level
325       * @ast method 
326       * 
327       */
328      @SuppressWarnings({"unchecked", "cast"})
329      public List<BodyDecl> getBodyDeclList() {
330        List<BodyDecl> list = (List<BodyDecl>)getChild(1);
331        list.getNumChild();
332        return list;
333      }
334      /**
335       * Retrieves the BodyDecl list.
336       * <p><em>This method does not invoke AST transformations.</em></p>
337       * @return The node representing the BodyDecl list.
338       * @apilevel low-level
339       * @ast method 
340       * 
341       */
342      @SuppressWarnings({"unchecked", "cast"})
343      public List<BodyDecl> getBodyDeclListNoTransform() {
344        return (List<BodyDecl>)getChildNoTransform(1);
345      }
346      /**
347       * Replaces the optional node for the SuperClassAccess child. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child!
348       * @param opt The new node to be used as the optional node for the SuperClassAccess child.
349       * @apilevel low-level
350       * @ast method 
351       * 
352       */
353      public void setSuperClassAccessOpt(Opt<Access> opt) {
354        setChild(opt, 2);
355      }
356      /**
357       * Check whether the optional SuperClassAccess child exists.
358       * @return {@code true} if the optional SuperClassAccess child exists, {@code false} if it does not.
359       * @apilevel high-level
360       * @ast method 
361       * 
362       */
363      public boolean hasSuperClassAccess() {
364        return getSuperClassAccessOpt().getNumChild() != 0;
365      }
366      /**
367       * Retrieves the (optional) SuperClassAccess child.
368       * @return The SuperClassAccess child, if it exists. Returns {@code null} otherwise.
369       * @apilevel low-level
370       * @ast method 
371       * 
372       */
373      @SuppressWarnings({"unchecked", "cast"})
374      public Access getSuperClassAccess() {
375        return (Access)getSuperClassAccessOpt().getChild(0);
376      }
377      /**
378       * Replaces the (optional) SuperClassAccess child.
379       * @param node The new node to be used as the SuperClassAccess child.
380       * @apilevel high-level
381       * @ast method 
382       * 
383       */
384      public void setSuperClassAccess(Access node) {
385        getSuperClassAccessOpt().setChild(node, 0);
386      }
387      /**
388       * Retrieves the optional node for child SuperClassAccess. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child!
389       * <p><em>This method does not invoke AST transformations.</em></p>
390       * @return The optional node for child SuperClassAccess.
391       * @apilevel low-level
392       * @ast method 
393       * 
394       */
395      @SuppressWarnings({"unchecked", "cast"})
396      public Opt<Access> getSuperClassAccessOptNoTransform() {
397        return (Opt<Access>)getChildNoTransform(2);
398      }
399      /**
400       * Retrieves the child position of the optional child SuperClassAccess.
401       * @return The the child position of the optional child SuperClassAccess.
402       * @apilevel low-level
403       * @ast method 
404       * 
405       */
406      protected int getSuperClassAccessOptChildPosition() {
407        return 2;
408      }
409      /**
410       * Replaces the Implements list.
411       * @param list The new list node to be used as the Implements list.
412       * @apilevel high-level
413       * @ast method 
414       * 
415       */
416      public void setImplementsList(List<Access> list) {
417        setChild(list, 3);
418      }
419      /**
420       * Retrieves the number of children in the Implements list.
421       * @return Number of children in the Implements list.
422       * @apilevel high-level
423       * @ast method 
424       * 
425       */
426      public int getNumImplements() {
427        return getImplementsList().getNumChild();
428      }
429      /**
430       * Retrieves the number of children in the Implements list.
431       * Calling this method will not trigger rewrites..
432       * @return Number of children in the Implements list.
433       * @apilevel low-level
434       * @ast method 
435       * 
436       */
437      public int getNumImplementsNoTransform() {
438        return getImplementsListNoTransform().getNumChildNoTransform();
439      }
440      /**
441       * Retrieves the element at index {@code i} in the Implements list..
442       * @param i Index of the element to return.
443       * @return The element at position {@code i} in the Implements list.
444       * @apilevel high-level
445       * @ast method 
446       * 
447       */
448      @SuppressWarnings({"unchecked", "cast"})
449      public Access getImplements(int i) {
450        return (Access)getImplementsList().getChild(i);
451      }
452      /**
453       * Append an element to the Implements list.
454       * @param node The element to append to the Implements list.
455       * @apilevel high-level
456       * @ast method 
457       * 
458       */
459      public void addImplements(Access node) {
460        List<Access> list = (parent == null || state == null) ? getImplementsListNoTransform() : getImplementsList();
461        list.addChild(node);
462      }
463      /**
464       * @apilevel low-level
465       * @ast method 
466       * 
467       */
468      public void addImplementsNoTransform(Access node) {
469        List<Access> list = getImplementsListNoTransform();
470        list.addChild(node);
471      }
472      /**
473       * Replaces the Implements list element at index {@code i} with the new node {@code node}.
474       * @param node The new node to replace the old list element.
475       * @param i The list index of the node to be replaced.
476       * @apilevel high-level
477       * @ast method 
478       * 
479       */
480      public void setImplements(Access node, int i) {
481        List<Access> list = getImplementsList();
482        list.setChild(node, i);
483      }
484      /**
485       * Retrieves the Implements list.
486       * @return The node representing the Implements list.
487       * @apilevel high-level
488       * @ast method 
489       * 
490       */
491      public List<Access> getImplementss() {
492        return getImplementsList();
493      }
494      /**
495       * Retrieves the Implements list.
496       * <p><em>This method does not invoke AST transformations.</em></p>
497       * @return The node representing the Implements list.
498       * @apilevel low-level
499       * @ast method 
500       * 
501       */
502      public List<Access> getImplementssNoTransform() {
503        return getImplementsListNoTransform();
504      }
505      /**
506       * Retrieves the Implements list.
507       * <p><em>This method does not invoke AST transformations.</em></p>
508       * @return The node representing the Implements list.
509       * @apilevel low-level
510       * @ast method 
511       * 
512       */
513      public List<Access> getImplementsListNoTransform() {
514        return (List<Access>)getChildNoTransform(3);
515      }
516      /**
517       * Retrieves the child position of the Implements list.
518       * @return The the child position of the Implements list.
519       * @apilevel low-level
520       * @ast method 
521       * 
522       */
523      protected int getImplementsListChildPosition() {
524        return 3;
525      }
526      /**
527       * @ast method 
528       * @aspect VariableArityParameters
529       * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/VariableArityParameters.jrag:107
530       */
531       
532      protected List constructorParameterList(ConstructorDecl decl) {
533        List parameterList = new List();
534        for(int i = 0; i < decl.getNumParameter(); i++) {
535          ParameterDeclaration param = decl.getParameter(i);
536          if (param instanceof VariableArityParameterDeclaration) {
537            parameterList.add(
538                new VariableArityParameterDeclaration(
539                  new Modifiers(new List()),
540                  ((ArrayDecl) param.type()).componentType().createBoundAccess(),
541                  param.name()
542                  ));
543          } else {
544            parameterList.add(
545                new ParameterDeclaration(
546                  param.type().createBoundAccess(),
547                  param.name()
548                  ));
549          }
550        }
551    
552        return parameterList;
553      }
554      /**
555       * @apilevel internal
556       */
557      protected int isCircular_visited = -1;
558      /**
559       * @apilevel internal
560       */
561      protected boolean isCircular_computed = false;
562      /**
563       * @apilevel internal
564       */
565      protected boolean isCircular_initialized = false;
566      /**
567       * @apilevel internal
568       */
569      protected boolean isCircular_value;
570      /**
571       * @attribute syn
572       * @aspect AnonymousClasses
573       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/AnonymousClasses.jrag:30
574       */
575      @SuppressWarnings({"unchecked", "cast"})
576      public boolean isCircular() {
577        if(isCircular_computed) {
578          return isCircular_value;
579        }
580        ASTNode$State state = state();
581        if (!isCircular_initialized) {
582          isCircular_initialized = true;
583          isCircular_value = true;
584        }
585        if (!state.IN_CIRCLE) {
586          state.IN_CIRCLE = true;
587        int num = state.boundariesCrossed;
588        boolean isFinal = this.is$Final();
589          do {
590            isCircular_visited = state.CIRCLE_INDEX;
591            state.CHANGE = false;
592            boolean new_isCircular_value = isCircular_compute();
593            if (new_isCircular_value!=isCircular_value)
594              state.CHANGE = true;
595            isCircular_value = new_isCircular_value; 
596            state.CIRCLE_INDEX++;
597          } while (state.CHANGE);
598            if(isFinal && num == state().boundariesCrossed) {
599          isCircular_computed = true;
600          }
601          else {
602          state.RESET_CYCLE = true;
603          isCircular_compute();
604          state.RESET_CYCLE = false;
605            isCircular_computed = false;
606            isCircular_initialized = false;
607          }
608          state.IN_CIRCLE = false; 
609              return isCircular_value;
610        }
611        if(isCircular_visited != state.CIRCLE_INDEX) {
612          isCircular_visited = state.CIRCLE_INDEX;
613          if (state.RESET_CYCLE) {
614            isCircular_computed = false;
615            isCircular_initialized = false;
616            isCircular_visited = -1;
617                return isCircular_value;
618          }
619          boolean new_isCircular_value = isCircular_compute();
620          if (new_isCircular_value!=isCircular_value)
621            state.CHANGE = true;
622          isCircular_value = new_isCircular_value; 
623              return isCircular_value;
624        }
625            return isCircular_value;
626      }
627      /**
628       * @apilevel internal
629       */
630      private boolean isCircular_compute() {  return false;  }
631      /**
632       * @apilevel internal
633       */
634      protected boolean getSuperClassAccessOpt_computed = false;
635      /**
636       * @apilevel internal
637       */
638      protected Opt getSuperClassAccessOpt_value;
639      /**
640       * @attribute syn nta
641       * @aspect AnonymousClasses
642       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/AnonymousClasses.jrag:32
643       */
644      @SuppressWarnings({"unchecked", "cast"})
645      public Opt getSuperClassAccessOpt() {
646        if(getSuperClassAccessOpt_computed) {
647          return (Opt) getChild(getSuperClassAccessOptChildPosition());
648        }
649          ASTNode$State state = state();
650      int num = state.boundariesCrossed;
651      boolean isFinal = this.is$Final();
652        getSuperClassAccessOpt_value = getSuperClassAccessOpt_compute();
653        setSuperClassAccessOpt(getSuperClassAccessOpt_value);
654      if(isFinal && num == state().boundariesCrossed){ getSuperClassAccessOpt_computed = true; }
655        Opt node = (Opt) this.getChild(getSuperClassAccessOptChildPosition());
656        return node;
657      }
658      /**
659       * @apilevel internal
660       */
661      private Opt getSuperClassAccessOpt_compute() {
662        if(superType().isInterfaceDecl())
663          return new Opt(typeObject().createQualifiedAccess());
664        else
665          return new Opt(superType().createBoundAccess());
666      }
667      /**
668       * @apilevel internal
669       */
670      protected boolean getImplementsList_computed = false;
671      /**
672       * @apilevel internal
673       */
674      protected List getImplementsList_value;
675      /**
676       * @attribute syn nta
677       * @aspect AnonymousClasses
678       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/AnonymousClasses.jrag:38
679       */
680      @SuppressWarnings({"unchecked", "cast"})
681      public List getImplementsList() {
682        if(getImplementsList_computed) {
683          return (List) getChild(getImplementsListChildPosition());
684        }
685          ASTNode$State state = state();
686      int num = state.boundariesCrossed;
687      boolean isFinal = this.is$Final();
688        getImplementsList_value = getImplementsList_compute();
689        setImplementsList(getImplementsList_value);
690      if(isFinal && num == state().boundariesCrossed){ getImplementsList_computed = true; }
691        List node = (List) this.getChild(getImplementsListChildPosition());
692        return node;
693      }
694      /**
695       * @apilevel internal
696       */
697      private List getImplementsList_compute() {
698        if(superType().isInterfaceDecl())
699          return new List().add(superType().createBoundAccess());
700        else
701          return new List();
702      }
703      /**
704       * @attribute syn
705       * @aspect GenerateClassfile
706       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/GenerateClassfile.jrag:325
707       */
708      public boolean flush() {
709        ASTNode$State state = state();
710        try {  return true;  }
711        finally {
712        }
713      }
714      /**
715       * @attribute inh
716       * @aspect AnonymousClasses
717       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/AnonymousClasses.jrag:14
718       */
719      @SuppressWarnings({"unchecked", "cast"})
720      public TypeDecl superType() {
721          ASTNode$State state = state();
722        TypeDecl superType_value = getParent().Define_TypeDecl_superType(this, null);
723            return superType_value;
724      }
725      /**
726       * @attribute inh
727       * @aspect AnonymousClasses
728       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/AnonymousClasses.jrag:18
729       */
730      @SuppressWarnings({"unchecked", "cast"})
731      public ConstructorDecl constructorDecl() {
732          ASTNode$State state = state();
733        ConstructorDecl constructorDecl_value = getParent().Define_ConstructorDecl_constructorDecl(this, null);
734            return constructorDecl_value;
735      }
736      /**
737       * @attribute inh
738       * @aspect AnonymousClasses
739       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/AnonymousClasses.jrag:175
740       */
741      @SuppressWarnings({"unchecked", "cast"})
742      public TypeDecl typeNullPointerException() {
743          ASTNode$State state = state();
744        TypeDecl typeNullPointerException_value = getParent().Define_TypeDecl_typeNullPointerException(this, null);
745            return typeNullPointerException_value;
746      }
747      /**
748       * @apilevel internal
749       */
750      public ASTNode rewriteTo() {
751        // Declared in /home/jesper/svn/JastAddJ/Java1.4Frontend/AnonymousClasses.jrag at line 70
752        if(noConstructor()) {
753          state().duringAnonymousClasses++;
754          ASTNode result = rewriteRule0();
755          state().duringAnonymousClasses--;
756          return result;
757        }
758    
759        return super.rewriteTo();
760      }
761      /**
762       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/AnonymousClasses.jrag:70
763       * @apilevel internal
764       */  private AnonymousDecl rewriteRule0() {
765    {
766          setModifiers(new Modifiers(new List().add(new Modifier("final"))));
767    
768          ConstructorDecl decl = constructorDecl();
769          Modifiers modifiers = (Modifiers)decl.getModifiers().fullCopy();
770          String anonName = "Anonymous" + nextAnonymousIndex();
771    
772          ConstructorDecl constructor = new ConstructorDecl(modifiers, anonName,
773              constructorParameterList(decl), new List(), new Opt(), new Block());
774          constructor.setDefaultConstructor();
775          addBodyDecl(constructor);
776    
777          setID(anonName);
778    
779          List argList = new List();
780          for(int i = 0; i < constructor.getNumParameter(); i++) {
781            argList.add(new VarAccess(constructor.getParameter(i).name()));
782          }
783    
784          constructor.setConstructorInvocation(
785            new ExprStmt(
786              new SuperConstructorAccess("super", argList)
787            )
788          );
789    
790          HashSet set = new HashSet();
791          for(int i = 0; i < getNumBodyDecl(); i++) {
792            if(getBodyDecl(i) instanceof InstanceInitializer) {
793              InstanceInitializer init = (InstanceInitializer)getBodyDecl(i);
794              set.addAll(init.exceptions());
795            }
796            else if(getBodyDecl(i) instanceof FieldDeclaration) {
797              FieldDeclaration f = (FieldDeclaration)getBodyDecl(i);
798              if(f.isInstanceVariable()) {
799                set.addAll(f.exceptions());
800              }
801            }
802          }
803          List exceptionList = new List();
804          for(Iterator iter = set.iterator(); iter.hasNext(); ) {
805            TypeDecl exceptionType = (TypeDecl)iter.next();
806            if(exceptionType.isNull())
807              exceptionType = typeNullPointerException();
808            exceptionList.add(exceptionType.createQualifiedAccess());
809          }
810          constructor.setExceptionList(exceptionList);
811          return this;
812          /*
813          setModifiers(new Modifiers(new List().add(new Modifier("final"))));
814          
815          ConstructorDecl constructor = new ConstructorDecl();
816          addBodyDecl(constructor);
817    
818          constructor.setModifiers((Modifiers)constructorDecl().getModifiers().fullCopy());
819          String name = "Anonymous" + nextAnonymousIndex();
820          setID(name);
821          constructor.setID(name);
822    
823          List parameterList = new List();
824          for(int i = 0; i < constructorDecl().getNumParameter(); i++) {
825            parameterList.add(
826              new ParameterDeclaration(
827                constructorDecl().getParameter(i).type().createBoundAccess(),
828                constructorDecl().getParameter(i).name()
829              )
830            );
831          }
832          constructor.setParameterList(parameterList);
833          
834          List argList = new List();
835          for(int i = 0; i < constructor.getNumParameter(); i++)
836            argList.add(new VarAccess(constructor.getParameter(i).name()));
837          constructor.setConstructorInvocation(
838            new ExprStmt(
839              new SuperConstructorAccess("super", argList)
840            )
841          );
842          constructor.setBlock(new Block());
843    
844          HashSet set = new HashSet();
845          for(int i = 0; i < getNumBodyDecl(); i++) {
846            if(getBodyDecl(i) instanceof InstanceInitializer) {
847              InstanceInitializer init = (InstanceInitializer)getBodyDecl(i);
848              set.addAll(init.exceptions());
849            }
850            else if(getBodyDecl(i) instanceof FieldDeclaration) {
851              FieldDeclaration f = (FieldDeclaration)getBodyDecl(i);
852              if(f.isInstanceVariable()) {
853                set.addAll(f.exceptions());
854              }
855            }
856          }
857          List exceptionList = new List();
858          for(Iterator iter = set.iterator(); iter.hasNext(); ) {
859            TypeDecl exceptionType = (TypeDecl)iter.next();
860            if(exceptionType.isNull())
861              exceptionType = typeNullPointerException();
862            exceptionList.add(exceptionType.createQualifiedAccess());
863          }
864          constructor.setExceptionList(exceptionList);
865          return this;
866          */
867        }  }
868    }