001    /* This file was generated with JastAdd2 (http://jastadd.org) version 2.1.13-12-g880e696 */
002    package org.extendj.ast;
003    
004    import java.util.HashSet;
005    import java.io.File;
006    import java.util.Set;
007    import java.util.Collections;
008    import java.util.Collection;
009    import java.util.ArrayList;
010    import beaver.*;
011    import java.util.*;
012    import java.io.ByteArrayOutputStream;
013    import java.io.PrintStream;
014    import java.lang.reflect.InvocationTargetException;
015    import java.lang.reflect.Method;
016    import org.jastadd.util.*;
017    import java.util.zip.*;
018    import java.io.*;
019    import org.jastadd.util.PrettyPrintable;
020    import org.jastadd.util.PrettyPrinter;
021    import java.io.FileNotFoundException;
022    import java.io.BufferedInputStream;
023    import java.io.DataInputStream;
024    /**
025     * @ast node
026     * @declaredat /home/jesper/git/extendj/java5/grammar/Generics.ast:2
027     * @production GenericClassDecl : {@link ClassDecl} ::= <span class="component">{@link Modifiers}</span> <span class="component">&lt;ID:String&gt;</span> <span class="component">[SuperClass:{@link Access}]</span> <span class="component">Implements:{@link Access}*</span> <span class="component">{@link BodyDecl}*</span> <span class="component">TypeParameter:{@link TypeVariable}*</span>;
028    
029     */
030    public class GenericClassDecl extends ClassDecl implements Cloneable, GenericTypeDecl {
031      /**
032       * @aspect GenericsTypeCheck
033       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:640
034       */
035      public void typeCheck() {
036        super.typeCheck();
037        if (instanceOf(typeThrowable())) {
038          errorf("generic class %s may not directly or indirectly inherit java.lang.Throwable",
039              typeName());
040        }
041      }
042      /**
043       * @aspect LookupParTypeDecl
044       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1434
045       */
046      public ClassDecl substitutedClassDecl(Parameterization parTypeDecl) {
047        return new GenericClassDeclSubstituted(
048          (Modifiers) getModifiers().treeCopyNoTransform(),
049          getID(),
050          hasSuperClass() ? new Opt(getSuperClass().type().substitute(parTypeDecl)) : new Opt(),
051          getImplementsList().substitute(parTypeDecl),
052          new List(), // delegates TypeParameter lookup to original
053          this
054        );
055      }
056      /**
057       * @aspect Java5PrettyPrint
058       * @declaredat /home/jesper/git/extendj/java5/frontend/PrettyPrint.jadd:333
059       */
060      public void prettyPrint(PrettyPrinter out) {
061        if (hasDocComment()) {
062          out.print(docComment());
063        }
064        if (!out.isNewLine()) {
065          out.println();
066        }
067        out.print(getModifiers());
068        out.print("class ");
069        out.print(getID());
070        out.print("<");
071        out.join(getTypeParameterList(), new PrettyPrinter.Joiner() {
072          @Override
073          public void printSeparator(PrettyPrinter out) {
074            out.print(", ");
075          }
076        });
077        out.print(">");
078        if (hasSuperClass()) {
079          out.print(" extends ");
080          out.print(getSuperClass());
081        }
082        if (hasImplements()) {
083          out.print(" implements ");
084          out.join(getImplementss(), new PrettyPrinter.Joiner() {
085            @Override
086            public void printSeparator(PrettyPrinter out) {
087              out.print(", ");
088            }
089          });
090        }
091        out.print(" {");
092        out.println();
093        out.indent(1);
094        out.join(getBodyDecls(), new PrettyPrinter.Joiner() {
095          @Override
096          public void printSeparator(PrettyPrinter out) {
097            out.println();
098            out.println();
099          }
100        });
101        if (!out.isNewLine()) {
102          out.println();
103        }
104        out.print("}");
105      }
106      /**
107       * @aspect Generics
108       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:298
109       */
110      public TypeDecl makeGeneric(Signatures.ClassSignature s) {
111        return (TypeDecl) this;
112      }
113      /**
114       * @aspect GenericsNameBinding
115       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:717
116       */
117      public SimpleSet addTypeVariables(SimpleSet c, String name) {
118        GenericTypeDecl original = (GenericTypeDecl) original();
119        for (int i = 0; i < original.getNumTypeParameter(); i++) {
120          TypeVariable p = original.getTypeParameter(i);
121          if (p.name().equals(name)) {
122            c = c.add(p);
123          }
124        }
125        return c;
126      }
127      /**
128       * @aspect LookupParTypeDecl
129       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:913
130       */
131      public List createArgumentList(Collection<TypeDecl> args) {
132        GenericTypeDecl original = (GenericTypeDecl) original();
133        List<Access> list = new List<Access>();
134        if (args.isEmpty()) {
135          // Change: Don't add any thing to the list.
136          // Concern: The previous version seem to add the erasure of the type variable for some reason,
137          // maybe this is how the raw type is represented (?), but this doesn't really comply with the
138          // claim that raw types don't have any type variables...?
139          for (int i = 0; i < original.getNumTypeParameter(); i++) {
140            list.add(original.getTypeParameter(i).erasure().createBoundAccess());
141          }
142        } else {
143          for (TypeDecl arg : args) {
144            list.add(arg.createBoundAccess());
145          }
146        }
147        return list;
148      }
149      /**
150       * @declaredat ASTNode:1
151       */
152      public GenericClassDecl() {
153        super();
154      }
155      /**
156       * Initializes the child array to the correct size.
157       * Initializes List and Opt nta children.
158       * @apilevel internal
159       * @ast method
160       * @declaredat ASTNode:10
161       */
162      public void init$Children() {
163        children = new ASTNode[6];
164        setChild(new Opt(), 1);
165        setChild(new List(), 2);
166        setChild(new List(), 3);
167        setChild(new List(), 4);
168        setChild(new Opt(), 5);
169      }
170      /**
171       * @declaredat ASTNode:18
172       */
173      public GenericClassDecl(Modifiers p0, String p1, Opt<Access> p2, List<Access> p3, List<BodyDecl> p4, List<TypeVariable> p5) {
174        setChild(p0, 0);
175        setID(p1);
176        setChild(p2, 1);
177        setChild(p3, 2);
178        setChild(p4, 3);
179        setChild(p5, 4);
180      }
181      /**
182       * @declaredat ASTNode:26
183       */
184      public GenericClassDecl(Modifiers p0, beaver.Symbol p1, Opt<Access> p2, List<Access> p3, List<BodyDecl> p4, List<TypeVariable> p5) {
185        setChild(p0, 0);
186        setID(p1);
187        setChild(p2, 1);
188        setChild(p3, 2);
189        setChild(p4, 3);
190        setChild(p5, 4);
191      }
192      /**
193       * @apilevel low-level
194       * @declaredat ASTNode:37
195       */
196      protected int numChildren() {
197        return 5;
198      }
199      /**
200       * @apilevel internal
201       * @declaredat ASTNode:43
202       */
203      public boolean mayHaveRewrite() {
204        return false;
205      }
206      /**
207       * @apilevel internal
208       * @declaredat ASTNode:49
209       */
210      public void flushAttrCache() {
211        super.flushAttrCache();
212        rawType_reset();
213        lookupParTypeDecl_Collection_TypeDecl__reset();
214        usesTypeVariable_reset();
215        subtype_TypeDecl_reset();
216        instanceOf_TypeDecl_reset();
217        needsSignatureAttribute_reset();
218        classSignature_reset();
219        getStandInMethodList_reset();
220        strictSubtype_TypeDecl_reset();
221        lookupParTypeDecl_ParTypeAccess_reset();
222      }
223      /**
224       * @apilevel internal
225       * @declaredat ASTNode:65
226       */
227      public void flushCollectionCache() {
228        super.flushCollectionCache();
229      }
230      /**
231       * @apilevel internal
232       * @declaredat ASTNode:71
233       */
234      public void flushRewriteCache() {
235        super.flushRewriteCache();
236      }
237      /**
238       * @apilevel internal
239       * @declaredat ASTNode:77
240       */
241      public GenericClassDecl clone() throws CloneNotSupportedException {
242        GenericClassDecl node = (GenericClassDecl) super.clone();
243        return node;
244      }
245      /**
246       * @apilevel internal
247       * @declaredat ASTNode:84
248       */
249      public GenericClassDecl copy() {
250        try {
251          GenericClassDecl node = (GenericClassDecl) clone();
252          node.parent = null;
253          if (children != null) {
254            node.children = (ASTNode[]) children.clone();
255          }
256          return node;
257        } catch (CloneNotSupportedException e) {
258          throw new Error("Error: clone not supported for " + getClass().getName());
259        }
260      }
261      /**
262       * Create a deep copy of the AST subtree at this node.
263       * The copy is dangling, i.e. has no parent.
264       * @return dangling copy of the subtree at this node
265       * @apilevel low-level
266       * @deprecated Please use treeCopy or treeCopyNoTransform instead
267       * @declaredat ASTNode:103
268       */
269      @Deprecated
270      public GenericClassDecl fullCopy() {
271        return treeCopyNoTransform();
272      }
273      /**
274       * Create a deep copy of the AST subtree at this node.
275       * The copy is dangling, i.e. has no parent.
276       * @return dangling copy of the subtree at this node
277       * @apilevel low-level
278       * @declaredat ASTNode:113
279       */
280      public GenericClassDecl treeCopyNoTransform() {
281        GenericClassDecl tree = (GenericClassDecl) copy();
282        if (children != null) {
283          for (int i = 0; i < children.length; ++i) {
284            switch (i) {
285            case 5:
286              tree.children[i] = new Opt();
287              continue;
288            }
289            ASTNode child = (ASTNode) children[i];
290            if (child != null) {
291              child = child.treeCopyNoTransform();
292              tree.setChild(child, i);
293            }
294          }
295        }
296        return tree;
297      }
298      /**
299       * Create a deep copy of the AST subtree at this node.
300       * The subtree of this node is traversed to trigger rewrites before copy.
301       * The copy is dangling, i.e. has no parent.
302       * @return dangling copy of the subtree at this node
303       * @apilevel low-level
304       * @declaredat ASTNode:138
305       */
306      public GenericClassDecl treeCopy() {
307        doFullTraversal();
308        return treeCopyNoTransform();
309      }
310      /**
311       * @apilevel internal
312       * @declaredat ASTNode:145
313       */
314      protected boolean is$Equal(ASTNode node) {
315        return super.is$Equal(node) && (tokenString_ID == ((GenericClassDecl)node).tokenString_ID);    
316      }
317      /**
318       * Replaces the Modifiers child.
319       * @param node The new node to replace the Modifiers child.
320       * @apilevel high-level
321       */
322      public void setModifiers(Modifiers node) {
323        setChild(node, 0);
324      }
325      /**
326       * Retrieves the Modifiers child.
327       * @return The current node used as the Modifiers child.
328       * @apilevel high-level
329       */
330      @ASTNodeAnnotation.Child(name="Modifiers")
331      public Modifiers getModifiers() {
332        return (Modifiers) getChild(0);
333      }
334      /**
335       * Retrieves the Modifiers child.
336       * <p><em>This method does not invoke AST transformations.</em></p>
337       * @return The current node used as the Modifiers child.
338       * @apilevel low-level
339       */
340      public Modifiers getModifiersNoTransform() {
341        return (Modifiers) getChildNoTransform(0);
342      }
343      /**
344       * Replaces the lexeme ID.
345       * @param value The new value for the lexeme ID.
346       * @apilevel high-level
347       */
348      public void setID(String value) {
349        tokenString_ID = value;
350      }
351      /**
352       * JastAdd-internal setter for lexeme ID using the Beaver parser.
353       * @param symbol Symbol containing the new value for the lexeme ID
354       * @apilevel internal
355       */
356      public void setID(beaver.Symbol symbol) {
357        if (symbol.value != null && !(symbol.value instanceof String))
358        throw new UnsupportedOperationException("setID is only valid for String lexemes");
359        tokenString_ID = (String)symbol.value;
360        IDstart = symbol.getStart();
361        IDend = symbol.getEnd();
362      }
363      /**
364       * Retrieves the value for the lexeme ID.
365       * @return The value for the lexeme ID.
366       * @apilevel high-level
367       */
368      @ASTNodeAnnotation.Token(name="ID")
369      public String getID() {
370        return tokenString_ID != null ? tokenString_ID : "";
371      }
372      /**
373       * Replaces the optional node for the SuperClass child. This is the <code>Opt</code>
374       * node containing the child SuperClass, not the actual child!
375       * @param opt The new node to be used as the optional node for the SuperClass child.
376       * @apilevel low-level
377       */
378      public void setSuperClassOpt(Opt<Access> opt) {
379        setChild(opt, 1);
380      }
381      /**
382       * Replaces the (optional) SuperClass child.
383       * @param node The new node to be used as the SuperClass child.
384       * @apilevel high-level
385       */
386      public void setSuperClass(Access node) {
387        getSuperClassOpt().setChild(node, 0);
388      }
389      /**
390       * Check whether the optional SuperClass child exists.
391       * @return {@code true} if the optional SuperClass child exists, {@code false} if it does not.
392       * @apilevel high-level
393       */
394      public boolean hasSuperClass() {
395        return getSuperClassOpt().getNumChild() != 0;
396      }
397      /**
398       * Retrieves the (optional) SuperClass child.
399       * @return The SuperClass child, if it exists. Returns {@code null} otherwise.
400       * @apilevel low-level
401       */
402      public Access getSuperClass() {
403        return (Access) getSuperClassOpt().getChild(0);
404      }
405      /**
406       * Retrieves the optional node for the SuperClass child. This is the <code>Opt</code> node containing the child SuperClass, not the actual child!
407       * @return The optional node for child the SuperClass child.
408       * @apilevel low-level
409       */
410      @ASTNodeAnnotation.OptChild(name="SuperClass")
411      public Opt<Access> getSuperClassOpt() {
412        return (Opt<Access>) getChild(1);
413      }
414      /**
415       * Retrieves the optional node for child SuperClass. This is the <code>Opt</code> node containing the child SuperClass, not the actual child!
416       * <p><em>This method does not invoke AST transformations.</em></p>
417       * @return The optional node for child SuperClass.
418       * @apilevel low-level
419       */
420      public Opt<Access> getSuperClassOptNoTransform() {
421        return (Opt<Access>) getChildNoTransform(1);
422      }
423      /**
424       * Replaces the Implements list.
425       * @param list The new list node to be used as the Implements list.
426       * @apilevel high-level
427       */
428      public void setImplementsList(List<Access> list) {
429        setChild(list, 2);
430      }
431      /**
432       * Retrieves the number of children in the Implements list.
433       * @return Number of children in the Implements list.
434       * @apilevel high-level
435       */
436      public int getNumImplements() {
437        return getImplementsList().getNumChild();
438      }
439      /**
440       * Retrieves the number of children in the Implements list.
441       * Calling this method will not trigger rewrites.
442       * @return Number of children in the Implements list.
443       * @apilevel low-level
444       */
445      public int getNumImplementsNoTransform() {
446        return getImplementsListNoTransform().getNumChildNoTransform();
447      }
448      /**
449       * Retrieves the element at index {@code i} in the Implements list.
450       * @param i Index of the element to return.
451       * @return The element at position {@code i} in the Implements list.
452       * @apilevel high-level
453       */
454      public Access getImplements(int i) {
455        return (Access) getImplementsList().getChild(i);
456      }
457      /**
458       * Check whether the Implements list has any children.
459       * @return {@code true} if it has at least one child, {@code false} otherwise.
460       * @apilevel high-level
461       */
462      public boolean hasImplements() {
463        return getImplementsList().getNumChild() != 0;
464      }
465      /**
466       * Append an element to the Implements list.
467       * @param node The element to append to the Implements list.
468       * @apilevel high-level
469       */
470      public void addImplements(Access node) {
471        List<Access> list = (parent == null) ? getImplementsListNoTransform() : getImplementsList();
472        list.addChild(node);
473      }
474      /**
475       * @apilevel low-level
476       */
477      public void addImplementsNoTransform(Access node) {
478        List<Access> list = getImplementsListNoTransform();
479        list.addChild(node);
480      }
481      /**
482       * Replaces the Implements list element at index {@code i} with the new node {@code node}.
483       * @param node The new node to replace the old list element.
484       * @param i The list index of the node to be replaced.
485       * @apilevel high-level
486       */
487      public void setImplements(Access node, int i) {
488        List<Access> list = getImplementsList();
489        list.setChild(node, i);
490      }
491      /**
492       * Retrieves the Implements list.
493       * @return The node representing the Implements list.
494       * @apilevel high-level
495       */
496      @ASTNodeAnnotation.ListChild(name="Implements")
497      public List<Access> getImplementsList() {
498        List<Access> list = (List<Access>) getChild(2);
499        return list;
500      }
501      /**
502       * Retrieves the Implements list.
503       * <p><em>This method does not invoke AST transformations.</em></p>
504       * @return The node representing the Implements list.
505       * @apilevel low-level
506       */
507      public List<Access> getImplementsListNoTransform() {
508        return (List<Access>) getChildNoTransform(2);
509      }
510      /**
511       * Retrieves the Implements list.
512       * @return The node representing the Implements list.
513       * @apilevel high-level
514       */
515      public List<Access> getImplementss() {
516        return getImplementsList();
517      }
518      /**
519       * Retrieves the Implements list.
520       * <p><em>This method does not invoke AST transformations.</em></p>
521       * @return The node representing the Implements list.
522       * @apilevel low-level
523       */
524      public List<Access> getImplementssNoTransform() {
525        return getImplementsListNoTransform();
526      }
527      /**
528       * Replaces the BodyDecl list.
529       * @param list The new list node to be used as the BodyDecl list.
530       * @apilevel high-level
531       */
532      public void setBodyDeclList(List<BodyDecl> list) {
533        setChild(list, 3);
534      }
535      /**
536       * Retrieves the number of children in the BodyDecl list.
537       * @return Number of children in the BodyDecl list.
538       * @apilevel high-level
539       */
540      public int getNumBodyDecl() {
541        return getBodyDeclList().getNumChild();
542      }
543      /**
544       * Retrieves the number of children in the BodyDecl list.
545       * Calling this method will not trigger rewrites.
546       * @return Number of children in the BodyDecl list.
547       * @apilevel low-level
548       */
549      public int getNumBodyDeclNoTransform() {
550        return getBodyDeclListNoTransform().getNumChildNoTransform();
551      }
552      /**
553       * Retrieves the element at index {@code i} in the BodyDecl list.
554       * @param i Index of the element to return.
555       * @return The element at position {@code i} in the BodyDecl list.
556       * @apilevel high-level
557       */
558      public BodyDecl getBodyDecl(int i) {
559        return (BodyDecl) getBodyDeclList().getChild(i);
560      }
561      /**
562       * Check whether the BodyDecl list has any children.
563       * @return {@code true} if it has at least one child, {@code false} otherwise.
564       * @apilevel high-level
565       */
566      public boolean hasBodyDecl() {
567        return getBodyDeclList().getNumChild() != 0;
568      }
569      /**
570       * Append an element to the BodyDecl list.
571       * @param node The element to append to the BodyDecl list.
572       * @apilevel high-level
573       */
574      public void addBodyDecl(BodyDecl node) {
575        List<BodyDecl> list = (parent == null) ? getBodyDeclListNoTransform() : getBodyDeclList();
576        list.addChild(node);
577      }
578      /**
579       * @apilevel low-level
580       */
581      public void addBodyDeclNoTransform(BodyDecl node) {
582        List<BodyDecl> list = getBodyDeclListNoTransform();
583        list.addChild(node);
584      }
585      /**
586       * Replaces the BodyDecl list element at index {@code i} with the new node {@code node}.
587       * @param node The new node to replace the old list element.
588       * @param i The list index of the node to be replaced.
589       * @apilevel high-level
590       */
591      public void setBodyDecl(BodyDecl node, int i) {
592        List<BodyDecl> list = getBodyDeclList();
593        list.setChild(node, i);
594      }
595      /**
596       * Retrieves the BodyDecl list.
597       * @return The node representing the BodyDecl list.
598       * @apilevel high-level
599       */
600      @ASTNodeAnnotation.ListChild(name="BodyDecl")
601      public List<BodyDecl> getBodyDeclList() {
602        List<BodyDecl> list = (List<BodyDecl>) getChild(3);
603        return list;
604      }
605      /**
606       * Retrieves the BodyDecl list.
607       * <p><em>This method does not invoke AST transformations.</em></p>
608       * @return The node representing the BodyDecl list.
609       * @apilevel low-level
610       */
611      public List<BodyDecl> getBodyDeclListNoTransform() {
612        return (List<BodyDecl>) getChildNoTransform(3);
613      }
614      /**
615       * Retrieves the BodyDecl list.
616       * @return The node representing the BodyDecl list.
617       * @apilevel high-level
618       */
619      public List<BodyDecl> getBodyDecls() {
620        return getBodyDeclList();
621      }
622      /**
623       * Retrieves the BodyDecl list.
624       * <p><em>This method does not invoke AST transformations.</em></p>
625       * @return The node representing the BodyDecl list.
626       * @apilevel low-level
627       */
628      public List<BodyDecl> getBodyDeclsNoTransform() {
629        return getBodyDeclListNoTransform();
630      }
631      /**
632       * Replaces the TypeParameter list.
633       * @param list The new list node to be used as the TypeParameter list.
634       * @apilevel high-level
635       */
636      public void setTypeParameterList(List<TypeVariable> list) {
637        setChild(list, 4);
638      }
639      /**
640       * Retrieves the number of children in the TypeParameter list.
641       * @return Number of children in the TypeParameter list.
642       * @apilevel high-level
643       */
644      public int getNumTypeParameter() {
645        return getTypeParameterList().getNumChild();
646      }
647      /**
648       * Retrieves the number of children in the TypeParameter list.
649       * Calling this method will not trigger rewrites.
650       * @return Number of children in the TypeParameter list.
651       * @apilevel low-level
652       */
653      public int getNumTypeParameterNoTransform() {
654        return getTypeParameterListNoTransform().getNumChildNoTransform();
655      }
656      /**
657       * Retrieves the element at index {@code i} in the TypeParameter list.
658       * @param i Index of the element to return.
659       * @return The element at position {@code i} in the TypeParameter list.
660       * @apilevel high-level
661       */
662      public TypeVariable getTypeParameter(int i) {
663        return (TypeVariable) getTypeParameterList().getChild(i);
664      }
665      /**
666       * Check whether the TypeParameter list has any children.
667       * @return {@code true} if it has at least one child, {@code false} otherwise.
668       * @apilevel high-level
669       */
670      public boolean hasTypeParameter() {
671        return getTypeParameterList().getNumChild() != 0;
672      }
673      /**
674       * Append an element to the TypeParameter list.
675       * @param node The element to append to the TypeParameter list.
676       * @apilevel high-level
677       */
678      public void addTypeParameter(TypeVariable node) {
679        List<TypeVariable> list = (parent == null) ? getTypeParameterListNoTransform() : getTypeParameterList();
680        list.addChild(node);
681      }
682      /**
683       * @apilevel low-level
684       */
685      public void addTypeParameterNoTransform(TypeVariable node) {
686        List<TypeVariable> list = getTypeParameterListNoTransform();
687        list.addChild(node);
688      }
689      /**
690       * Replaces the TypeParameter list element at index {@code i} with the new node {@code node}.
691       * @param node The new node to replace the old list element.
692       * @param i The list index of the node to be replaced.
693       * @apilevel high-level
694       */
695      public void setTypeParameter(TypeVariable node, int i) {
696        List<TypeVariable> list = getTypeParameterList();
697        list.setChild(node, i);
698      }
699      /**
700       * Retrieves the TypeParameter list.
701       * @return The node representing the TypeParameter list.
702       * @apilevel high-level
703       */
704      @ASTNodeAnnotation.ListChild(name="TypeParameter")
705      public List<TypeVariable> getTypeParameterList() {
706        List<TypeVariable> list = (List<TypeVariable>) getChild(4);
707        return list;
708      }
709      /**
710       * Retrieves the TypeParameter list.
711       * <p><em>This method does not invoke AST transformations.</em></p>
712       * @return The node representing the TypeParameter list.
713       * @apilevel low-level
714       */
715      public List<TypeVariable> getTypeParameterListNoTransform() {
716        return (List<TypeVariable>) getChildNoTransform(4);
717      }
718      /**
719       * Retrieves the TypeParameter list.
720       * @return The node representing the TypeParameter list.
721       * @apilevel high-level
722       */
723      public List<TypeVariable> getTypeParameters() {
724        return getTypeParameterList();
725      }
726      /**
727       * Retrieves the TypeParameter list.
728       * <p><em>This method does not invoke AST transformations.</em></p>
729       * @return The node representing the TypeParameter list.
730       * @apilevel low-level
731       */
732      public List<TypeVariable> getTypeParametersNoTransform() {
733        return getTypeParameterListNoTransform();
734      }
735      /**
736       * Replaces the (optional) ImplicitConstructor child.
737       * @param node The new node to be used as the ImplicitConstructor child.
738       * @apilevel high-level
739       */
740      public void setImplicitConstructor(ConstructorDecl node) {
741        getImplicitConstructorOpt().setChild(node, 0);
742      }
743      /**
744       * Check whether the optional ImplicitConstructor child exists.
745       * @return {@code true} if the optional ImplicitConstructor child exists, {@code false} if it does not.
746       * @apilevel high-level
747       */
748      public boolean hasImplicitConstructor() {
749        return getImplicitConstructorOpt().getNumChild() != 0;
750      }
751      /**
752       * Retrieves the (optional) ImplicitConstructor child.
753       * @return The ImplicitConstructor child, if it exists. Returns {@code null} otherwise.
754       * @apilevel low-level
755       */
756      public ConstructorDecl getImplicitConstructor() {
757        return (ConstructorDecl) getImplicitConstructorOpt().getChild(0);
758      }
759      /**
760       * Retrieves the optional node for child ImplicitConstructor. This is the <code>Opt</code> node containing the child ImplicitConstructor, not the actual child!
761       * <p><em>This method does not invoke AST transformations.</em></p>
762       * @return The optional node for child ImplicitConstructor.
763       * @apilevel low-level
764       */
765      public Opt<ConstructorDecl> getImplicitConstructorOptNoTransform() {
766        return (Opt<ConstructorDecl>) getChildNoTransform(5);
767      }
768      /**
769       * Retrieves the child position of the optional child ImplicitConstructor.
770       * @return The the child position of the optional child ImplicitConstructor.
771       * @apilevel low-level
772       */
773      protected int getImplicitConstructorOptChildPosition() {
774        return 5;
775      }
776      /**
777       * @apilevel internal
778       */
779      protected boolean rawType_computed = false;
780      /**
781       * @apilevel internal
782       */
783      protected TypeDecl rawType_value;
784      /**
785       * @apilevel internal
786       */
787      private void rawType_reset() {
788        rawType_computed = false;
789        rawType_value = null;
790      }
791      /**
792       * @attribute syn
793       * @aspect Generics
794       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:209
795       */
796      @ASTNodeAnnotation.Attribute
797      public TypeDecl rawType() {
798        ASTNode$State state = state();
799        if (rawType_computed) {
800          return rawType_value;
801        }
802        boolean intermediate = state.INTERMEDIATE_VALUE;
803        state.INTERMEDIATE_VALUE = false;
804        int num = state.boundariesCrossed;
805        boolean isFinal = this.is$Final();
806        rawType_value = lookupParTypeDecl(Collections.<TypeDecl>emptyList());
807        if (isFinal && num == state().boundariesCrossed) {
808          rawType_computed = true;
809        } else {
810        }
811        state.INTERMEDIATE_VALUE |= intermediate;
812    
813        return rawType_value;
814      }
815      /**
816       * @apilevel internal
817       */
818      protected List lookupParTypeDecl_Collection_TypeDecl__list;
819      /**
820       * @apilevel internal
821       */
822      protected java.util.Map lookupParTypeDecl_Collection_TypeDecl__values;
823      /**
824       * @apilevel internal
825       */
826      private void lookupParTypeDecl_Collection_TypeDecl__reset() {
827        lookupParTypeDecl_Collection_TypeDecl__values = null;
828        lookupParTypeDecl_Collection_TypeDecl__list = null;
829      }
830      /**
831       * @attribute syn
832       * @aspect LookupParTypeDecl
833       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:879
834       */
835      @ASTNodeAnnotation.Attribute
836      public TypeDecl lookupParTypeDecl(Collection<TypeDecl> typeArgs) {
837        Object _parameters = typeArgs;
838        if (lookupParTypeDecl_Collection_TypeDecl__values == null) lookupParTypeDecl_Collection_TypeDecl__values = new org.jastadd.util.RobustMap(new java.util.HashMap());
839        ASTNode$State state = state();
840        if (lookupParTypeDecl_Collection_TypeDecl__values.containsKey(_parameters)) {
841          return (TypeDecl) lookupParTypeDecl_Collection_TypeDecl__values.get(_parameters);
842        }
843        boolean intermediate = state.INTERMEDIATE_VALUE;
844        state.INTERMEDIATE_VALUE = false;
845        int num = state.boundariesCrossed;
846        boolean isFinal = this.is$Final();
847        TypeDecl lookupParTypeDecl_Collection_TypeDecl__value = lookupParTypeDecl_compute(typeArgs);
848        if (lookupParTypeDecl_Collection_TypeDecl__list == null) {
849          lookupParTypeDecl_Collection_TypeDecl__list = new List();
850          lookupParTypeDecl_Collection_TypeDecl__list.is$Final = true;
851          lookupParTypeDecl_Collection_TypeDecl__list.setParent(this);
852        }
853        lookupParTypeDecl_Collection_TypeDecl__list.add(lookupParTypeDecl_Collection_TypeDecl__value);
854        if (lookupParTypeDecl_Collection_TypeDecl__value != null) {
855          lookupParTypeDecl_Collection_TypeDecl__value = (TypeDecl) lookupParTypeDecl_Collection_TypeDecl__list.getChild(lookupParTypeDecl_Collection_TypeDecl__list.numChildren-1);
856          lookupParTypeDecl_Collection_TypeDecl__value.is$Final = true;
857        }
858        if (true) {
859          lookupParTypeDecl_Collection_TypeDecl__values.put(_parameters, lookupParTypeDecl_Collection_TypeDecl__value);
860        } else {
861        }
862        state.INTERMEDIATE_VALUE |= intermediate;
863    
864        return lookupParTypeDecl_Collection_TypeDecl__value;
865      }
866      /**
867       * @apilevel internal
868       */
869      private TypeDecl lookupParTypeDecl_compute(Collection<TypeDecl> typeArgs) {
870          ParClassDecl typeDecl = typeArgs.size() == 0 ? new RawClassDecl() : new ParClassDecl();
871          typeDecl.setModifiers((Modifiers) getModifiers().treeCopyNoTransform());
872          typeDecl.setID(getID());
873          // ES: trying to only do this for ParClassDecl and then later for RawClassDecl
874          if (!(typeDecl instanceof RawClassDecl)) {
875            typeDecl.setArgumentList(createArgumentList(typeArgs));
876          }
877          return typeDecl;
878        }
879      /**
880       * @apilevel internal
881       */
882      protected int usesTypeVariable_visited = -1;
883      /**
884       * @apilevel internal
885       */
886      private void usesTypeVariable_reset() {
887        usesTypeVariable_computed = false;
888        usesTypeVariable_initialized = false;
889        usesTypeVariable_visited = -1;
890      }
891      /**
892       * @apilevel internal
893       */
894      protected boolean usesTypeVariable_computed = false;
895      /**
896       * @apilevel internal
897       */
898      protected boolean usesTypeVariable_initialized = false;
899      /**
900       * @apilevel internal
901       */
902      protected boolean usesTypeVariable_value;
903      @ASTNodeAnnotation.Attribute
904      public boolean usesTypeVariable() {
905        if (usesTypeVariable_computed) {
906          return usesTypeVariable_value;
907        }
908        ASTNode$State state = state();
909        boolean new_usesTypeVariable_value;
910        if (!usesTypeVariable_initialized) {
911          usesTypeVariable_initialized = true;
912          usesTypeVariable_value = false;
913        }
914        if (!state.IN_CIRCLE) {
915          state.IN_CIRCLE = true;
916          int num = state.boundariesCrossed;
917          boolean isFinal = this.is$Final();
918          do {
919            usesTypeVariable_visited = state.CIRCLE_INDEX;
920            state.CHANGE = false;
921            new_usesTypeVariable_value = true;
922            if (new_usesTypeVariable_value != usesTypeVariable_value) {
923              state.CHANGE = true;
924            }
925            usesTypeVariable_value = new_usesTypeVariable_value;
926            state.CIRCLE_INDEX++;
927          } while (state.CHANGE);
928          if (isFinal && num == state().boundariesCrossed) {
929            usesTypeVariable_computed = true;
930          } else {
931            state.RESET_CYCLE = true;
932            boolean $tmp = true;
933            state.RESET_CYCLE = false;
934            usesTypeVariable_computed = false;
935            usesTypeVariable_initialized = false;
936          }
937          state.IN_CIRCLE = false;
938          state.INTERMEDIATE_VALUE = false;
939          return usesTypeVariable_value;
940        }
941        if (usesTypeVariable_visited != state.CIRCLE_INDEX) {
942          usesTypeVariable_visited = state.CIRCLE_INDEX;
943          if (state.RESET_CYCLE) {
944            usesTypeVariable_computed = false;
945            usesTypeVariable_initialized = false;
946            usesTypeVariable_visited = -1;
947            return usesTypeVariable_value;
948          }
949          new_usesTypeVariable_value = true;
950          if (new_usesTypeVariable_value != usesTypeVariable_value) {
951            state.CHANGE = true;
952          }
953          usesTypeVariable_value = new_usesTypeVariable_value;
954          state.INTERMEDIATE_VALUE = true;
955          return usesTypeVariable_value;
956        }
957        state.INTERMEDIATE_VALUE = true;
958        return usesTypeVariable_value;
959      }
960      /**
961       * @apilevel internal
962       */
963      private void subtype_TypeDecl_reset() {
964        subtype_TypeDecl_values = null;
965      }
966      protected java.util.Map subtype_TypeDecl_values;
967      @ASTNodeAnnotation.Attribute
968      public boolean subtype(TypeDecl type) {
969        Object _parameters = type;
970        if (subtype_TypeDecl_values == null) subtype_TypeDecl_values = new org.jastadd.util.RobustMap(new java.util.HashMap());
971        ASTNode$State.CircularValue _value;
972        if (subtype_TypeDecl_values.containsKey(_parameters)) {
973          Object _o = subtype_TypeDecl_values.get(_parameters);
974          if (!(_o instanceof ASTNode$State.CircularValue)) {
975            return (Boolean) _o;
976          } else {
977            _value = (ASTNode$State.CircularValue) _o;
978          }
979        } else {
980          _value = new ASTNode$State.CircularValue();
981          subtype_TypeDecl_values.put(_parameters, _value);
982          _value.value = true;
983        }
984        ASTNode$State state = state();
985        boolean new_subtype_TypeDecl_value;
986        if (!state.IN_CIRCLE) {
987          state.IN_CIRCLE = true;
988          int num = state.boundariesCrossed;
989          boolean isFinal = this.is$Final();
990          // TODO: fixme
991          // state().CIRCLE_INDEX = 1;
992          do {
993            _value.visited = state.CIRCLE_INDEX;
994            state.CHANGE = false;
995            new_subtype_TypeDecl_value = type.supertypeGenericClassDecl(this);
996            if (new_subtype_TypeDecl_value != ((Boolean)_value.value)) {
997              state.CHANGE = true;
998              _value.value = new_subtype_TypeDecl_value;
999            }
1000            state.CIRCLE_INDEX++;
1001          } while (state.CHANGE);
1002          if (isFinal && num == state().boundariesCrossed) {
1003            subtype_TypeDecl_values.put(_parameters, new_subtype_TypeDecl_value);
1004          } else {
1005            subtype_TypeDecl_values.remove(_parameters);
1006            state.RESET_CYCLE = true;
1007            boolean $tmp = type.supertypeGenericClassDecl(this);
1008            state.RESET_CYCLE = false;
1009          }
1010          state.IN_CIRCLE = false;
1011          state.INTERMEDIATE_VALUE = false;
1012          return new_subtype_TypeDecl_value;
1013        }
1014        if (state.CIRCLE_INDEX != _value.visited) {
1015          _value.visited = state.CIRCLE_INDEX;
1016          new_subtype_TypeDecl_value = type.supertypeGenericClassDecl(this);
1017          if (state.RESET_CYCLE) {
1018            subtype_TypeDecl_values.remove(_parameters);
1019          }
1020          else if (new_subtype_TypeDecl_value != ((Boolean)_value.value)) {
1021            state.CHANGE = true;
1022            _value.value = new_subtype_TypeDecl_value;
1023          }
1024          state.INTERMEDIATE_VALUE = true;
1025          return new_subtype_TypeDecl_value;
1026        }
1027        state.INTERMEDIATE_VALUE = true;
1028        return (Boolean) _value.value;
1029      }
1030      /**
1031       * @attribute syn
1032       * @aspect GenericsSubtype
1033       * @declaredat /home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:134
1034       */
1035      @ASTNodeAnnotation.Attribute
1036      public boolean supertypeParClassDecl(ParClassDecl type) {
1037        boolean supertypeParClassDecl_ParClassDecl_value = type.genericDecl().original().subtype(this);
1038    
1039        return supertypeParClassDecl_ParClassDecl_value;
1040      }
1041      /**
1042       * @attribute syn
1043       * @aspect GenericsSubtype
1044       * @declaredat /home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:137
1045       */
1046      @ASTNodeAnnotation.Attribute
1047      public boolean supertypeParInterfaceDecl(ParInterfaceDecl type) {
1048        boolean supertypeParInterfaceDecl_ParInterfaceDecl_value = type.genericDecl().original().subtype(this);
1049    
1050        return supertypeParInterfaceDecl_ParInterfaceDecl_value;
1051      }
1052      /**
1053       * @apilevel internal
1054       */
1055      protected java.util.Map instanceOf_TypeDecl_values;
1056      /**
1057       * @apilevel internal
1058       */
1059      private void instanceOf_TypeDecl_reset() {
1060        instanceOf_TypeDecl_values = null;
1061      }
1062      /**
1063       * @attribute syn
1064       * @aspect TypeWideningAndIdentity
1065       * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:442
1066       */
1067      @ASTNodeAnnotation.Attribute
1068      public boolean instanceOf(TypeDecl type) {
1069        Object _parameters = type;
1070        if (instanceOf_TypeDecl_values == null) instanceOf_TypeDecl_values = new org.jastadd.util.RobustMap(new java.util.HashMap());
1071        ASTNode$State state = state();
1072        if (instanceOf_TypeDecl_values.containsKey(_parameters)) {
1073          return (Boolean) instanceOf_TypeDecl_values.get(_parameters);
1074        }
1075        boolean intermediate = state.INTERMEDIATE_VALUE;
1076        state.INTERMEDIATE_VALUE = false;
1077        int num = state.boundariesCrossed;
1078        boolean isFinal = this.is$Final();
1079        boolean instanceOf_TypeDecl_value = subtype(type);
1080        if (isFinal && num == state().boundariesCrossed) {
1081          instanceOf_TypeDecl_values.put(_parameters, instanceOf_TypeDecl_value);
1082        } else {
1083        }
1084        state.INTERMEDIATE_VALUE |= intermediate;
1085    
1086        return instanceOf_TypeDecl_value;
1087      }
1088      /**
1089       * A type is reifiable if it either refers to a non-parameterized type,
1090       * is a raw type, is a parameterized type with only unbound wildcard
1091       * parameters or is an array type with a reifiable type parameter.
1092       * 
1093       * @see "JLS SE7 &sect;4.7"
1094       * @attribute syn
1095       * @aspect ReifiableTypes
1096       * @declaredat /home/jesper/git/extendj/java5/frontend/ReifiableTypes.jrag:39
1097       */
1098      @ASTNodeAnnotation.Attribute
1099      public boolean isReifiable() {
1100        boolean isReifiable_value = false;
1101    
1102        return isReifiable_value;
1103      }
1104      /**
1105       * @apilevel internal
1106       */
1107      protected boolean needsSignatureAttribute_computed = false;
1108      /**
1109       * @apilevel internal
1110       */
1111      protected boolean needsSignatureAttribute_value;
1112      /**
1113       * @apilevel internal
1114       */
1115      private void needsSignatureAttribute_reset() {
1116        needsSignatureAttribute_computed = false;
1117      }
1118      /**
1119       * @attribute syn
1120       * @aspect GenericsCodegen
1121       * @declaredat /home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:345
1122       */
1123      @ASTNodeAnnotation.Attribute
1124      public boolean needsSignatureAttribute() {
1125        ASTNode$State state = state();
1126        if (needsSignatureAttribute_computed) {
1127          return needsSignatureAttribute_value;
1128        }
1129        boolean intermediate = state.INTERMEDIATE_VALUE;
1130        state.INTERMEDIATE_VALUE = false;
1131        int num = state.boundariesCrossed;
1132        boolean isFinal = this.is$Final();
1133        needsSignatureAttribute_value = true;
1134        if (isFinal && num == state().boundariesCrossed) {
1135          needsSignatureAttribute_computed = true;
1136        } else {
1137        }
1138        state.INTERMEDIATE_VALUE |= intermediate;
1139    
1140        return needsSignatureAttribute_value;
1141      }
1142      /**
1143       * @apilevel internal
1144       */
1145      protected boolean classSignature_computed = false;
1146      /**
1147       * @apilevel internal
1148       */
1149      protected String classSignature_value;
1150      /**
1151       * @apilevel internal
1152       */
1153      private void classSignature_reset() {
1154        classSignature_computed = false;
1155        classSignature_value = null;
1156      }
1157      /**
1158       * @attribute syn
1159       * @aspect GenericsCodegen
1160       * @declaredat /home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:401
1161       */
1162      @ASTNodeAnnotation.Attribute
1163      public String classSignature() {
1164        ASTNode$State state = state();
1165        if (classSignature_computed) {
1166          return classSignature_value;
1167        }
1168        boolean intermediate = state.INTERMEDIATE_VALUE;
1169        state.INTERMEDIATE_VALUE = false;
1170        int num = state.boundariesCrossed;
1171        boolean isFinal = this.is$Final();
1172        classSignature_value = classSignature_compute();
1173        if (isFinal && num == state().boundariesCrossed) {
1174          classSignature_computed = true;
1175        } else {
1176        }
1177        state.INTERMEDIATE_VALUE |= intermediate;
1178    
1179        return classSignature_value;
1180      }
1181      /**
1182       * @apilevel internal
1183       */
1184      private String classSignature_compute() {
1185          StringBuilder buf = new StringBuilder();
1186          // FormalTypeParameters
1187          buf.append("<");
1188          for (int i = 0; i < getNumTypeParameter(); i++) {
1189            buf.append(getTypeParameter(i).formalTypeParameter());
1190          }
1191          buf.append(">");
1192          buf.append(super.classSignature());
1193          return buf.toString();
1194        }
1195      /**
1196       * @apilevel internal
1197       */
1198      protected boolean getStandInMethodList_computed = false;
1199      /**
1200       * @apilevel internal
1201       */
1202      protected List<StandInMethodDecl> getStandInMethodList_value;
1203      /**
1204       * @apilevel internal
1205       */
1206      private void getStandInMethodList_reset() {
1207        getStandInMethodList_computed = false;
1208        getStandInMethodList_value = null;
1209      }
1210      /**
1211       * The placeholder method list for the constructors of this generic
1212       * class.
1213       * 
1214       * @return list of placeholder methods
1215       * @attribute syn
1216       * @aspect Diamond
1217       * @declaredat /home/jesper/git/extendj/java7/frontend/Diamond.jrag:141
1218       */
1219      @ASTNodeAnnotation.Attribute
1220      public List<StandInMethodDecl> getStandInMethodList() {
1221        ASTNode$State state = state();
1222        if (getStandInMethodList_computed) {
1223          return getStandInMethodList_value;
1224        }
1225        boolean intermediate = state.INTERMEDIATE_VALUE;
1226        state.INTERMEDIATE_VALUE = false;
1227        int num = state.boundariesCrossed;
1228        boolean isFinal = this.is$Final();
1229        getStandInMethodList_value = getStandInMethodList_compute();
1230        getStandInMethodList_value.setParent(this);
1231        getStandInMethodList_value.is$Final = true;
1232        if (true) {
1233          getStandInMethodList_computed = true;
1234        } else {
1235        }
1236        state.INTERMEDIATE_VALUE |= intermediate;
1237    
1238        return getStandInMethodList_value;
1239      }
1240      /**
1241       * @apilevel internal
1242       */
1243      private List<StandInMethodDecl> getStandInMethodList_compute() {
1244          List<StandInMethodDecl> placeholderMethods = new List<StandInMethodDecl>();
1245          List<TypeVariable> typeParams = getTypeParameterList();
1246          List<TypeVariable> classTypeVars = new List<TypeVariable>();
1247          List<Access> typeArgs = new List<Access>();
1248      
1249          // Copy the list of type parameters.
1250          int arg = 0;
1251          for (Iterator iter = typeParams.iterator(); iter.hasNext(); ++arg) {
1252            String substName = "#"+arg;
1253            typeArgs.add(new TypeAccess(substName));
1254      
1255            TypeVariable typeVar = (TypeVariable) iter.next();
1256            List<Access> typeBounds = new List<Access>();
1257            for (Access typeBound : typeVar.getTypeBoundList()) {
1258              typeBounds.add((Access) typeBound.treeCopyNoTransform());
1259            }
1260            classTypeVars.add(new TypeVariable(
1261                new Modifiers(),
1262                substName,
1263                new List<BodyDecl>(),
1264                typeBounds));
1265          }
1266      
1267          ParTypeAccess returnType = new ParTypeAccess(
1268              createQualifiedAccess(),
1269              typeArgs);
1270      
1271          for (Iterator iter = constructors().iterator(); iter.hasNext(); ) {
1272            ConstructorDecl decl = (ConstructorDecl) iter.next();
1273            if (decl instanceof ConstructorDeclSubstituted) {
1274              decl = ((ConstructorDeclSubstituted) decl).getOriginal();
1275            }
1276      
1277            // Filter accessible constructors.
1278            if (!decl.accessibleFrom(hostType())) {
1279              continue;
1280            }
1281      
1282            Collection<TypeVariable> originalTypeVars = new LinkedList<TypeVariable>();
1283            List<TypeVariable> typeVars = new List<TypeVariable>();
1284            for (TypeVariable typeVar : typeParams) {
1285              originalTypeVars.add(typeVar);
1286            }
1287            for (TypeVariable typeVar : classTypeVars) {
1288              typeVars.add((TypeVariable) typeVar.treeCopyNoTransform());
1289            }
1290      
1291            if (decl.isGeneric()) {
1292              GenericConstructorDecl genericDecl = decl.genericDecl();
1293              List<TypeVariable> typeVariables = new List<TypeVariable>();
1294              for (int i = 0; i < genericDecl.getNumTypeParameter(); ++i) {
1295                String substName = "#" + (arg+i);
1296      
1297                TypeVariable typeVar = genericDecl.getTypeParameter(i);
1298                originalTypeVars.add(typeVar);
1299                List<Access> typeBounds = new List<Access>();
1300                for (Access typeBound : typeVar.getTypeBoundList()) {
1301                  typeBounds.add((Access) typeBound.treeCopyNoTransform());
1302                }
1303                typeVars.add(new TypeVariable(
1304                      new Modifiers(),
1305                      substName,
1306                      new List<BodyDecl>(),
1307                      typeBounds));
1308              }
1309            }
1310      
1311            List<ParameterDeclaration> substParameters = new List<ParameterDeclaration>();
1312            for (ParameterDeclaration param : decl.getParameterList()) {
1313              substParameters.add(param.substituted(originalTypeVars, typeVars));
1314            }
1315      
1316            List<Access> substExceptions = new List<Access>();
1317            for (Access exception : decl.getExceptionList()) {
1318              substExceptions.add(exception.substituted(originalTypeVars, typeVars));
1319            }
1320      
1321            StandInMethodDecl placeholderMethod = new StandInMethodDecl(
1322                (Modifiers) decl.getModifiers().treeCopyNoTransform(),
1323                (Access) returnType.treeCopyNoTransform(),
1324                "#" + getID(),
1325                substParameters,
1326                substExceptions,
1327                new Opt(new Block()),
1328                typeVars);
1329      
1330            placeholderMethods.add(placeholderMethod);
1331          }
1332          return placeholderMethods;
1333        }
1334      /**
1335       * @apilevel internal
1336       */
1337      private void strictSubtype_TypeDecl_reset() {
1338        strictSubtype_TypeDecl_values = null;
1339      }
1340      protected java.util.Map strictSubtype_TypeDecl_values;
1341      @ASTNodeAnnotation.Attribute
1342      public boolean strictSubtype(TypeDecl type) {
1343        Object _parameters = type;
1344        if (strictSubtype_TypeDecl_values == null) strictSubtype_TypeDecl_values = new org.jastadd.util.RobustMap(new java.util.HashMap());
1345        ASTNode$State.CircularValue _value;
1346        if (strictSubtype_TypeDecl_values.containsKey(_parameters)) {
1347          Object _o = strictSubtype_TypeDecl_values.get(_parameters);
1348          if (!(_o instanceof ASTNode$State.CircularValue)) {
1349            return (Boolean) _o;
1350          } else {
1351            _value = (ASTNode$State.CircularValue) _o;
1352          }
1353        } else {
1354          _value = new ASTNode$State.CircularValue();
1355          strictSubtype_TypeDecl_values.put(_parameters, _value);
1356          _value.value = true;
1357        }
1358        ASTNode$State state = state();
1359        boolean new_strictSubtype_TypeDecl_value;
1360        if (!state.IN_CIRCLE) {
1361          state.IN_CIRCLE = true;
1362          int num = state.boundariesCrossed;
1363          boolean isFinal = this.is$Final();
1364          // TODO: fixme
1365          // state().CIRCLE_INDEX = 1;
1366          do {
1367            _value.visited = state.CIRCLE_INDEX;
1368            state.CHANGE = false;
1369            new_strictSubtype_TypeDecl_value = type.strictSupertypeGenericClassDecl(this);
1370            if (new_strictSubtype_TypeDecl_value != ((Boolean)_value.value)) {
1371              state.CHANGE = true;
1372              _value.value = new_strictSubtype_TypeDecl_value;
1373            }
1374            state.CIRCLE_INDEX++;
1375          } while (state.CHANGE);
1376          if (isFinal && num == state().boundariesCrossed) {
1377            strictSubtype_TypeDecl_values.put(_parameters, new_strictSubtype_TypeDecl_value);
1378          } else {
1379            strictSubtype_TypeDecl_values.remove(_parameters);
1380            state.RESET_CYCLE = true;
1381            boolean $tmp = type.strictSupertypeGenericClassDecl(this);
1382            state.RESET_CYCLE = false;
1383          }
1384          state.IN_CIRCLE = false;
1385          state.INTERMEDIATE_VALUE = false;
1386          return new_strictSubtype_TypeDecl_value;
1387        }
1388        if (state.CIRCLE_INDEX != _value.visited) {
1389          _value.visited = state.CIRCLE_INDEX;
1390          new_strictSubtype_TypeDecl_value = type.strictSupertypeGenericClassDecl(this);
1391          if (state.RESET_CYCLE) {
1392            strictSubtype_TypeDecl_values.remove(_parameters);
1393          }
1394          else if (new_strictSubtype_TypeDecl_value != ((Boolean)_value.value)) {
1395            state.CHANGE = true;
1396            _value.value = new_strictSubtype_TypeDecl_value;
1397          }
1398          state.INTERMEDIATE_VALUE = true;
1399          return new_strictSubtype_TypeDecl_value;
1400        }
1401        state.INTERMEDIATE_VALUE = true;
1402        return (Boolean) _value.value;
1403      }
1404      /**
1405       * @attribute syn
1406       * @aspect StrictSubtype
1407       * @declaredat /home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:155
1408       */
1409      @ASTNodeAnnotation.Attribute
1410      public boolean strictSupertypeParClassDecl(ParClassDecl type) {
1411        boolean strictSupertypeParClassDecl_ParClassDecl_value = type.genericDecl().original().strictSubtype(this);
1412    
1413        return strictSupertypeParClassDecl_ParClassDecl_value;
1414      }
1415      /**
1416       * @attribute syn
1417       * @aspect StrictSubtype
1418       * @declaredat /home/jesper/git/extendj/java8/frontend/GenericsSubtype.jrag:159
1419       */
1420      @ASTNodeAnnotation.Attribute
1421      public boolean strictSupertypeParInterfaceDecl(ParInterfaceDecl type) {
1422        boolean strictSupertypeParInterfaceDecl_ParInterfaceDecl_value = type.genericDecl().original().strictSubtype(this);
1423    
1424        return strictSupertypeParInterfaceDecl_ParInterfaceDecl_value;
1425      }
1426      /**
1427       * @attribute syn
1428       * @aspect Generics
1429       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:204
1430       */
1431      @ASTNodeAnnotation.Attribute
1432      public boolean isGenericType() {
1433        boolean isGenericType_value = true;
1434    
1435        return isGenericType_value;
1436      }
1437      /**
1438       * @apilevel internal
1439       */
1440      protected java.util.Map lookupParTypeDecl_ParTypeAccess_values;
1441      /**
1442       * @apilevel internal
1443       */
1444      private void lookupParTypeDecl_ParTypeAccess_reset() {
1445        lookupParTypeDecl_ParTypeAccess_values = null;
1446      }
1447      /** Transforms the parameter and calls the lookupParTypeDecl attribute for ArrayList arguments. 
1448       * @attribute syn
1449       * @aspect LookupParTypeDecl
1450       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:871
1451       */
1452      @ASTNodeAnnotation.Attribute
1453      public TypeDecl lookupParTypeDecl(ParTypeAccess p) {
1454        Object _parameters = p;
1455        if (lookupParTypeDecl_ParTypeAccess_values == null) lookupParTypeDecl_ParTypeAccess_values = new org.jastadd.util.RobustMap(new java.util.HashMap());
1456        ASTNode$State state = state();
1457        if (lookupParTypeDecl_ParTypeAccess_values.containsKey(_parameters)) {
1458          return (TypeDecl) lookupParTypeDecl_ParTypeAccess_values.get(_parameters);
1459        }
1460        boolean intermediate = state.INTERMEDIATE_VALUE;
1461        state.INTERMEDIATE_VALUE = false;
1462        int num = state.boundariesCrossed;
1463        boolean isFinal = this.is$Final();
1464        TypeDecl lookupParTypeDecl_ParTypeAccess_value = lookupParTypeDecl_compute(p);
1465        if (isFinal && num == state().boundariesCrossed) {
1466          lookupParTypeDecl_ParTypeAccess_values.put(_parameters, lookupParTypeDecl_ParTypeAccess_value);
1467        } else {
1468        }
1469        state.INTERMEDIATE_VALUE |= intermediate;
1470    
1471        return lookupParTypeDecl_ParTypeAccess_value;
1472      }
1473      /**
1474       * @apilevel internal
1475       */
1476      private TypeDecl lookupParTypeDecl_compute(ParTypeAccess p) {
1477          Collection<TypeDecl> typeArguments = new ArrayList<TypeDecl>();
1478          for (int i = 0; i < p.getNumTypeArgument(); i++) {
1479            typeArguments.add(p.getTypeArgument(i).type());
1480          }
1481          return lookupParTypeDecl(typeArguments);
1482        }
1483      /**
1484       * @attribute inh
1485       * @aspect GenericsTypeCheck
1486       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:656
1487       */
1488      /**
1489       * @attribute inh
1490       * @aspect GenericsTypeCheck
1491       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:656
1492       */
1493      @ASTNodeAnnotation.Attribute
1494      public TypeDecl typeThrowable() {
1495        TypeDecl typeThrowable_value = getParent().Define_typeThrowable(this, null);
1496    
1497        return typeThrowable_value;
1498      }
1499      /**
1500       * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:569
1501       * @apilevel internal
1502       */
1503      public boolean Define_isNestedType(ASTNode caller, ASTNode child) {
1504        if (caller == getTypeParameterListNoTransform()) {
1505          // @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:709
1506          int childIndex = caller.getIndexOfChild(child);
1507          return true;
1508        }
1509        else {
1510          return super.Define_isNestedType(caller, child);
1511        }
1512      }
1513      protected boolean canDefine_isNestedType(ASTNode caller, ASTNode child) {
1514        return true;
1515      }
1516      /**
1517       * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:544
1518       * @apilevel internal
1519       */
1520      public TypeDecl Define_enclosingType(ASTNode caller, ASTNode child) {
1521        if (caller == getTypeParameterListNoTransform()) {
1522          // @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:710
1523          int childIndex = caller.getIndexOfChild(child);
1524          return this;
1525        }
1526        else {
1527          return super.Define_enclosingType(caller, child);
1528        }
1529      }
1530      protected boolean canDefine_enclosingType(ASTNode caller, ASTNode child) {
1531        return true;
1532      }
1533      /**
1534       * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:197
1535       * @apilevel internal
1536       */
1537      public SimpleSet Define_lookupType(ASTNode caller, ASTNode child, String name) {
1538        if (caller == getBodyDeclListNoTransform()) {
1539          // @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:763
1540          int index = caller.getIndexOfChild(child);
1541          {
1542              SimpleSet c = memberTypes(name);
1543              if (getBodyDecl(index).visibleTypeParameters()) {
1544                c = addTypeVariables(c, name);
1545              }
1546              if (!c.isEmpty()) {
1547                return c;
1548              }
1549              // 8.5.2
1550              if (isClassDecl() && isStatic() && !isTopLevelType()) {
1551                for (Iterator iter = lookupType(name).iterator(); iter.hasNext(); ) {
1552                  TypeDecl d = (TypeDecl) iter.next();
1553                  if (d.isStatic() || (d.enclosingType() != null && instanceOf(d.enclosingType()))) {
1554                    c = c.add(d);
1555                  }
1556                }
1557              } else {
1558                c = lookupType(name);
1559              }
1560              if (!c.isEmpty()) {
1561                return c;
1562              }
1563              return topLevelType().lookupType(name); // Fix to search imports
1564              // include type parameters if not static
1565            }
1566        }
1567        else if (caller == getTypeParameterListNoTransform()) {
1568          // @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:741
1569          int childIndex = caller.getIndexOfChild(child);
1570          {
1571              SimpleSet c = memberTypes(name);
1572              c = addTypeVariables(c, name);
1573              if (!c.isEmpty()) {
1574                return c;
1575              }
1576              // 8.5.2
1577              if (isClassDecl() && isStatic() && !isTopLevelType()) {
1578                for (Iterator iter = lookupType(name).iterator(); iter.hasNext(); ) {
1579                  TypeDecl d = (TypeDecl) iter.next();
1580                  if (d.isStatic() || (d.enclosingType() != null && instanceOf(d.enclosingType()))) {
1581                    c = c.add(d);
1582                  }
1583                }
1584              } else {
1585                c = lookupType(name);
1586              }
1587              if (!c.isEmpty()) {
1588                return c;
1589              }
1590              return topLevelType().lookupType(name); // Fix to search imports
1591            }
1592        }
1593        else if (caller == getImplementsListNoTransform()) {
1594          // @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:736
1595          int childIndex = caller.getIndexOfChild(child);
1596          {
1597              SimpleSet c = addTypeVariables(SimpleSet.emptySet, name);
1598              return !c.isEmpty() ? c : lookupType(name);
1599            }
1600        }
1601        else if (caller == getSuperClassOptNoTransform()) {
1602          // @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:732
1603          {
1604              SimpleSet c = addTypeVariables(SimpleSet.emptySet, name);
1605              return !c.isEmpty() ? c : lookupType(name);
1606            }
1607        }
1608        else {
1609          return super.Define_lookupType(caller, child, name);
1610        }
1611      }
1612      protected boolean canDefine_lookupType(ASTNode caller, ASTNode child, String name) {
1613        return true;
1614      }
1615      /**
1616       * @declaredat /home/jesper/git/extendj/java5/frontend/GenericsParTypeDecl.jrag:71
1617       * @apilevel internal
1618       */
1619      public TypeDecl Define_genericDecl(ASTNode caller, ASTNode child) {
1620        int childIndex = this.getIndexOfChild(caller);
1621        return this;
1622      }
1623      protected boolean canDefine_genericDecl(ASTNode caller, ASTNode child) {
1624        return true;
1625      }
1626      /**
1627       * @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:29
1628       * @apilevel internal
1629       */
1630      public int Define_typeVarPosition(ASTNode caller, ASTNode child) {
1631        if (caller == getTypeParameterListNoTransform()) {
1632          // @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:43
1633          int i = caller.getIndexOfChild(child);
1634          return i;
1635        }
1636        else {
1637          return getParent().Define_typeVarPosition(this, caller);
1638        }
1639      }
1640      protected boolean canDefine_typeVarPosition(ASTNode caller, ASTNode child) {
1641        return true;
1642      }
1643      /**
1644       * @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:32
1645       * @apilevel internal
1646       */
1647      public boolean Define_typeVarInMethod(ASTNode caller, ASTNode child) {
1648        if (caller == getTypeParameterListNoTransform()) {
1649          // @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:44
1650          int childIndex = caller.getIndexOfChild(child);
1651          return false;
1652        }
1653        else {
1654          return getParent().Define_typeVarInMethod(this, caller);
1655        }
1656      }
1657      protected boolean canDefine_typeVarInMethod(ASTNode caller, ASTNode child) {
1658        return true;
1659      }
1660      /**
1661       * @apilevel internal
1662       */
1663      public ASTNode rewriteTo() {
1664        return super.rewriteTo();
1665      }
1666    }