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/GenericMethods.ast:2
027     * @production GenericMethodDecl : {@link MethodDecl} ::= <span class="component">TypeParameter:{@link TypeVariable}*</span>;
028    
029     */
030    public class GenericMethodDecl extends MethodDecl implements Cloneable {
031      /**
032       * @aspect GenericMethods
033       * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:59
034       */
035      public ParMethodDecl newParMethodDecl(Collection<TypeDecl> typeArguments) {
036        ParMethodDecl methodDecl = typeArguments.isEmpty() ? new RawMethodDecl() : new ParMethodDecl();
037    
038        // Adding a link to GenericMethodDecl to be used during substitution
039        // instead of the not yet existing parent link.
040        methodDecl.setGenericMethodDecl(this);
041    
042        List<Access> list = new List<Access>();
043        if (typeArguments.isEmpty()) {
044          GenericMethodDecl original = original();
045          for (int i = 0; i < original.getNumTypeParameter(); i++) {
046            list.add(original.getTypeParameter(i).erasure().createBoundAccess());
047          }
048        } else {
049          for (TypeDecl arg : typeArguments) {
050            list.add(arg.createBoundAccess());
051          }
052        }
053        methodDecl.setTypeArgumentList(list);
054        methodDecl.setModifiers((Modifiers) getModifiers().treeCopyNoTransform());
055        methodDecl.setTypeAccess(getTypeAccess().type().substituteReturnType(methodDecl));
056        methodDecl.setID(getID());
057        methodDecl.setParameterList(getParameterList().substitute(methodDecl));
058        methodDecl.setExceptionList(getExceptionList().substitute(methodDecl));
059        return methodDecl;
060      }
061      /**
062       * @aspect LookupParTypeDecl
063       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1383
064       */
065      public GenericMethodDecl original;
066      /**
067       * @aspect Java5PrettyPrint
068       * @declaredat /home/jesper/git/extendj/java5/frontend/PrettyPrint.jadd:237
069       */
070      public void prettyPrint(PrettyPrinter out) {
071        if (hasDocComment()) {
072          out.print(docComment());
073        }
074        if (!out.isNewLine()) {
075          out.println();
076        }
077        out.print(getModifiers());
078        out.print("<");
079        out.join(getTypeParameterList(), new PrettyPrinter.Joiner() {
080          @Override
081          public void printSeparator(PrettyPrinter out) {
082            out.print(", ");
083          }
084        });
085        out.print("> ");
086        out.print(getTypeAccess());
087        out.print(" ");
088        out.print(getID());
089        out.print("(");
090        out.join(getParameterList(), new PrettyPrinter.Joiner() {
091          @Override
092          public void printSeparator(PrettyPrinter out) {
093            out.print(", ");
094          }
095        });
096        out.print(")");
097        if (hasExceptions()) {
098          out.print(" throws ");
099          out.join(getExceptionList(), new PrettyPrinter.Joiner() {
100            @Override
101            public void printSeparator(PrettyPrinter out) {
102              out.print(", ");
103            }
104          });
105        }
106        if (hasBlock()) {
107          out.print(" ");
108          out.print(getBlock());
109        } else {
110          out.print(";");
111        }
112      }
113      /**
114       * @declaredat ASTNode:1
115       */
116      public GenericMethodDecl() {
117        super();
118      }
119      /**
120       * Initializes the child array to the correct size.
121       * Initializes List and Opt nta children.
122       * @apilevel internal
123       * @ast method
124       * @declaredat ASTNode:10
125       */
126      public void init$Children() {
127        children = new ASTNode[6];
128        setChild(new List(), 2);
129        setChild(new List(), 3);
130        setChild(new Opt(), 4);
131        setChild(new List(), 5);
132      }
133      /**
134       * @declaredat ASTNode:17
135       */
136      public GenericMethodDecl(Modifiers p0, Access p1, String p2, List<ParameterDeclaration> p3, List<Access> p4, Opt<Block> p5, List<TypeVariable> p6) {
137        setChild(p0, 0);
138        setChild(p1, 1);
139        setID(p2);
140        setChild(p3, 2);
141        setChild(p4, 3);
142        setChild(p5, 4);
143        setChild(p6, 5);
144      }
145      /**
146       * @declaredat ASTNode:26
147       */
148      public GenericMethodDecl(Modifiers p0, Access p1, beaver.Symbol p2, List<ParameterDeclaration> p3, List<Access> p4, Opt<Block> p5, List<TypeVariable> p6) {
149        setChild(p0, 0);
150        setChild(p1, 1);
151        setID(p2);
152        setChild(p3, 2);
153        setChild(p4, 3);
154        setChild(p5, 4);
155        setChild(p6, 5);
156      }
157      /**
158       * @apilevel low-level
159       * @declaredat ASTNode:38
160       */
161      protected int numChildren() {
162        return 6;
163      }
164      /**
165       * @apilevel internal
166       * @declaredat ASTNode:44
167       */
168      public boolean mayHaveRewrite() {
169        return false;
170      }
171      /**
172       * @apilevel internal
173       * @declaredat ASTNode:50
174       */
175      public void flushAttrCache() {
176        super.flushAttrCache();
177        rawMethodDecl_reset();
178        lookupParMethodDecl_Collection_TypeDecl__reset();
179        subsignatureTo_MethodDecl_reset();
180        sameTypeParameters_GenericMethodDecl_reset();
181        sameFormalParameters_GenericMethodDecl_reset();
182        usesTypeVariable_reset();
183        typeVariableInReturn_reset();
184        genericMethodLevel_reset();
185      }
186      /**
187       * @apilevel internal
188       * @declaredat ASTNode:64
189       */
190      public void flushCollectionCache() {
191        super.flushCollectionCache();
192      }
193      /**
194       * @apilevel internal
195       * @declaredat ASTNode:70
196       */
197      public void flushRewriteCache() {
198        super.flushRewriteCache();
199      }
200      /**
201       * @apilevel internal
202       * @declaredat ASTNode:76
203       */
204      public GenericMethodDecl clone() throws CloneNotSupportedException {
205        GenericMethodDecl node = (GenericMethodDecl) super.clone();
206        return node;
207      }
208      /**
209       * @apilevel internal
210       * @declaredat ASTNode:83
211       */
212      public GenericMethodDecl copy() {
213        try {
214          GenericMethodDecl node = (GenericMethodDecl) clone();
215          node.parent = null;
216          if (children != null) {
217            node.children = (ASTNode[]) children.clone();
218          }
219          return node;
220        } catch (CloneNotSupportedException e) {
221          throw new Error("Error: clone not supported for " + getClass().getName());
222        }
223      }
224      /**
225       * Create a deep copy of the AST subtree at this node.
226       * The copy is dangling, i.e. has no parent.
227       * @return dangling copy of the subtree at this node
228       * @apilevel low-level
229       * @deprecated Please use treeCopy or treeCopyNoTransform instead
230       * @declaredat ASTNode:102
231       */
232      @Deprecated
233      public GenericMethodDecl fullCopy() {
234        return treeCopyNoTransform();
235      }
236      /**
237       * Create a deep copy of the AST subtree at this node.
238       * The copy is dangling, i.e. has no parent.
239       * @return dangling copy of the subtree at this node
240       * @apilevel low-level
241       * @declaredat ASTNode:112
242       */
243      public GenericMethodDecl treeCopyNoTransform() {
244        GenericMethodDecl tree = (GenericMethodDecl) copy();
245        if (children != null) {
246          for (int i = 0; i < children.length; ++i) {
247            ASTNode child = (ASTNode) children[i];
248            if (child != null) {
249              child = child.treeCopyNoTransform();
250              tree.setChild(child, i);
251            }
252          }
253        }
254        return tree;
255      }
256      /**
257       * Create a deep copy of the AST subtree at this node.
258       * The subtree of this node is traversed to trigger rewrites before copy.
259       * The copy is dangling, i.e. has no parent.
260       * @return dangling copy of the subtree at this node
261       * @apilevel low-level
262       * @declaredat ASTNode:132
263       */
264      public GenericMethodDecl treeCopy() {
265        doFullTraversal();
266        return treeCopyNoTransform();
267      }
268      /**
269       * @apilevel internal
270       * @declaredat ASTNode:139
271       */
272      protected boolean is$Equal(ASTNode node) {
273        return super.is$Equal(node) && (tokenString_ID == ((GenericMethodDecl)node).tokenString_ID);    
274      }
275      /**
276       * Replaces the Modifiers child.
277       * @param node The new node to replace the Modifiers child.
278       * @apilevel high-level
279       */
280      public void setModifiers(Modifiers node) {
281        setChild(node, 0);
282      }
283      /**
284       * Retrieves the Modifiers child.
285       * @return The current node used as the Modifiers child.
286       * @apilevel high-level
287       */
288      @ASTNodeAnnotation.Child(name="Modifiers")
289      public Modifiers getModifiers() {
290        return (Modifiers) getChild(0);
291      }
292      /**
293       * Retrieves the Modifiers child.
294       * <p><em>This method does not invoke AST transformations.</em></p>
295       * @return The current node used as the Modifiers child.
296       * @apilevel low-level
297       */
298      public Modifiers getModifiersNoTransform() {
299        return (Modifiers) getChildNoTransform(0);
300      }
301      /**
302       * Replaces the TypeAccess child.
303       * @param node The new node to replace the TypeAccess child.
304       * @apilevel high-level
305       */
306      public void setTypeAccess(Access node) {
307        setChild(node, 1);
308      }
309      /**
310       * Retrieves the TypeAccess child.
311       * @return The current node used as the TypeAccess child.
312       * @apilevel high-level
313       */
314      @ASTNodeAnnotation.Child(name="TypeAccess")
315      public Access getTypeAccess() {
316        return (Access) getChild(1);
317      }
318      /**
319       * Retrieves the TypeAccess child.
320       * <p><em>This method does not invoke AST transformations.</em></p>
321       * @return The current node used as the TypeAccess child.
322       * @apilevel low-level
323       */
324      public Access getTypeAccessNoTransform() {
325        return (Access) getChildNoTransform(1);
326      }
327      /**
328       * Replaces the lexeme ID.
329       * @param value The new value for the lexeme ID.
330       * @apilevel high-level
331       */
332      public void setID(String value) {
333        tokenString_ID = value;
334      }
335      /**
336       * JastAdd-internal setter for lexeme ID using the Beaver parser.
337       * @param symbol Symbol containing the new value for the lexeme ID
338       * @apilevel internal
339       */
340      public void setID(beaver.Symbol symbol) {
341        if (symbol.value != null && !(symbol.value instanceof String))
342        throw new UnsupportedOperationException("setID is only valid for String lexemes");
343        tokenString_ID = (String)symbol.value;
344        IDstart = symbol.getStart();
345        IDend = symbol.getEnd();
346      }
347      /**
348       * Retrieves the value for the lexeme ID.
349       * @return The value for the lexeme ID.
350       * @apilevel high-level
351       */
352      @ASTNodeAnnotation.Token(name="ID")
353      public String getID() {
354        return tokenString_ID != null ? tokenString_ID : "";
355      }
356      /**
357       * Replaces the Parameter list.
358       * @param list The new list node to be used as the Parameter list.
359       * @apilevel high-level
360       */
361      public void setParameterList(List<ParameterDeclaration> list) {
362        setChild(list, 2);
363      }
364      /**
365       * Retrieves the number of children in the Parameter list.
366       * @return Number of children in the Parameter list.
367       * @apilevel high-level
368       */
369      public int getNumParameter() {
370        return getParameterList().getNumChild();
371      }
372      /**
373       * Retrieves the number of children in the Parameter list.
374       * Calling this method will not trigger rewrites.
375       * @return Number of children in the Parameter list.
376       * @apilevel low-level
377       */
378      public int getNumParameterNoTransform() {
379        return getParameterListNoTransform().getNumChildNoTransform();
380      }
381      /**
382       * Retrieves the element at index {@code i} in the Parameter list.
383       * @param i Index of the element to return.
384       * @return The element at position {@code i} in the Parameter list.
385       * @apilevel high-level
386       */
387      public ParameterDeclaration getParameter(int i) {
388        return (ParameterDeclaration) getParameterList().getChild(i);
389      }
390      /**
391       * Check whether the Parameter list has any children.
392       * @return {@code true} if it has at least one child, {@code false} otherwise.
393       * @apilevel high-level
394       */
395      public boolean hasParameter() {
396        return getParameterList().getNumChild() != 0;
397      }
398      /**
399       * Append an element to the Parameter list.
400       * @param node The element to append to the Parameter list.
401       * @apilevel high-level
402       */
403      public void addParameter(ParameterDeclaration node) {
404        List<ParameterDeclaration> list = (parent == null) ? getParameterListNoTransform() : getParameterList();
405        list.addChild(node);
406      }
407      /**
408       * @apilevel low-level
409       */
410      public void addParameterNoTransform(ParameterDeclaration node) {
411        List<ParameterDeclaration> list = getParameterListNoTransform();
412        list.addChild(node);
413      }
414      /**
415       * Replaces the Parameter list element at index {@code i} with the new node {@code node}.
416       * @param node The new node to replace the old list element.
417       * @param i The list index of the node to be replaced.
418       * @apilevel high-level
419       */
420      public void setParameter(ParameterDeclaration node, int i) {
421        List<ParameterDeclaration> list = getParameterList();
422        list.setChild(node, i);
423      }
424      /**
425       * Retrieves the Parameter list.
426       * @return The node representing the Parameter list.
427       * @apilevel high-level
428       */
429      @ASTNodeAnnotation.ListChild(name="Parameter")
430      public List<ParameterDeclaration> getParameterList() {
431        List<ParameterDeclaration> list = (List<ParameterDeclaration>) getChild(2);
432        return list;
433      }
434      /**
435       * Retrieves the Parameter list.
436       * <p><em>This method does not invoke AST transformations.</em></p>
437       * @return The node representing the Parameter list.
438       * @apilevel low-level
439       */
440      public List<ParameterDeclaration> getParameterListNoTransform() {
441        return (List<ParameterDeclaration>) getChildNoTransform(2);
442      }
443      /**
444       * Retrieves the Parameter list.
445       * @return The node representing the Parameter list.
446       * @apilevel high-level
447       */
448      public List<ParameterDeclaration> getParameters() {
449        return getParameterList();
450      }
451      /**
452       * Retrieves the Parameter list.
453       * <p><em>This method does not invoke AST transformations.</em></p>
454       * @return The node representing the Parameter list.
455       * @apilevel low-level
456       */
457      public List<ParameterDeclaration> getParametersNoTransform() {
458        return getParameterListNoTransform();
459      }
460      /**
461       * Replaces the Exception list.
462       * @param list The new list node to be used as the Exception list.
463       * @apilevel high-level
464       */
465      public void setExceptionList(List<Access> list) {
466        setChild(list, 3);
467      }
468      /**
469       * Retrieves the number of children in the Exception list.
470       * @return Number of children in the Exception list.
471       * @apilevel high-level
472       */
473      public int getNumException() {
474        return getExceptionList().getNumChild();
475      }
476      /**
477       * Retrieves the number of children in the Exception list.
478       * Calling this method will not trigger rewrites.
479       * @return Number of children in the Exception list.
480       * @apilevel low-level
481       */
482      public int getNumExceptionNoTransform() {
483        return getExceptionListNoTransform().getNumChildNoTransform();
484      }
485      /**
486       * Retrieves the element at index {@code i} in the Exception list.
487       * @param i Index of the element to return.
488       * @return The element at position {@code i} in the Exception list.
489       * @apilevel high-level
490       */
491      public Access getException(int i) {
492        return (Access) getExceptionList().getChild(i);
493      }
494      /**
495       * Check whether the Exception list has any children.
496       * @return {@code true} if it has at least one child, {@code false} otherwise.
497       * @apilevel high-level
498       */
499      public boolean hasException() {
500        return getExceptionList().getNumChild() != 0;
501      }
502      /**
503       * Append an element to the Exception list.
504       * @param node The element to append to the Exception list.
505       * @apilevel high-level
506       */
507      public void addException(Access node) {
508        List<Access> list = (parent == null) ? getExceptionListNoTransform() : getExceptionList();
509        list.addChild(node);
510      }
511      /**
512       * @apilevel low-level
513       */
514      public void addExceptionNoTransform(Access node) {
515        List<Access> list = getExceptionListNoTransform();
516        list.addChild(node);
517      }
518      /**
519       * Replaces the Exception list element at index {@code i} with the new node {@code node}.
520       * @param node The new node to replace the old list element.
521       * @param i The list index of the node to be replaced.
522       * @apilevel high-level
523       */
524      public void setException(Access node, int i) {
525        List<Access> list = getExceptionList();
526        list.setChild(node, i);
527      }
528      /**
529       * Retrieves the Exception list.
530       * @return The node representing the Exception list.
531       * @apilevel high-level
532       */
533      @ASTNodeAnnotation.ListChild(name="Exception")
534      public List<Access> getExceptionList() {
535        List<Access> list = (List<Access>) getChild(3);
536        return list;
537      }
538      /**
539       * Retrieves the Exception list.
540       * <p><em>This method does not invoke AST transformations.</em></p>
541       * @return The node representing the Exception list.
542       * @apilevel low-level
543       */
544      public List<Access> getExceptionListNoTransform() {
545        return (List<Access>) getChildNoTransform(3);
546      }
547      /**
548       * Retrieves the Exception list.
549       * @return The node representing the Exception list.
550       * @apilevel high-level
551       */
552      public List<Access> getExceptions() {
553        return getExceptionList();
554      }
555      /**
556       * Retrieves the Exception list.
557       * <p><em>This method does not invoke AST transformations.</em></p>
558       * @return The node representing the Exception list.
559       * @apilevel low-level
560       */
561      public List<Access> getExceptionsNoTransform() {
562        return getExceptionListNoTransform();
563      }
564      /**
565       * Replaces the optional node for the Block child. This is the <code>Opt</code>
566       * node containing the child Block, not the actual child!
567       * @param opt The new node to be used as the optional node for the Block child.
568       * @apilevel low-level
569       */
570      public void setBlockOpt(Opt<Block> opt) {
571        setChild(opt, 4);
572      }
573      /**
574       * Replaces the (optional) Block child.
575       * @param node The new node to be used as the Block child.
576       * @apilevel high-level
577       */
578      public void setBlock(Block node) {
579        getBlockOpt().setChild(node, 0);
580      }
581      /**
582       * Check whether the optional Block child exists.
583       * @return {@code true} if the optional Block child exists, {@code false} if it does not.
584       * @apilevel high-level
585       */
586      public boolean hasBlock() {
587        return getBlockOpt().getNumChild() != 0;
588      }
589      /**
590       * Retrieves the (optional) Block child.
591       * @return The Block child, if it exists. Returns {@code null} otherwise.
592       * @apilevel low-level
593       */
594      public Block getBlock() {
595        return (Block) getBlockOpt().getChild(0);
596      }
597      /**
598       * Retrieves the optional node for the Block child. This is the <code>Opt</code> node containing the child Block, not the actual child!
599       * @return The optional node for child the Block child.
600       * @apilevel low-level
601       */
602      @ASTNodeAnnotation.OptChild(name="Block")
603      public Opt<Block> getBlockOpt() {
604        return (Opt<Block>) getChild(4);
605      }
606      /**
607       * Retrieves the optional node for child Block. This is the <code>Opt</code> node containing the child Block, not the actual child!
608       * <p><em>This method does not invoke AST transformations.</em></p>
609       * @return The optional node for child Block.
610       * @apilevel low-level
611       */
612      public Opt<Block> getBlockOptNoTransform() {
613        return (Opt<Block>) getChildNoTransform(4);
614      }
615      /**
616       * Replaces the TypeParameter list.
617       * @param list The new list node to be used as the TypeParameter list.
618       * @apilevel high-level
619       */
620      public void setTypeParameterList(List<TypeVariable> list) {
621        setChild(list, 5);
622      }
623      /**
624       * Retrieves the number of children in the TypeParameter list.
625       * @return Number of children in the TypeParameter list.
626       * @apilevel high-level
627       */
628      public int getNumTypeParameter() {
629        return getTypeParameterList().getNumChild();
630      }
631      /**
632       * Retrieves the number of children in the TypeParameter list.
633       * Calling this method will not trigger rewrites.
634       * @return Number of children in the TypeParameter list.
635       * @apilevel low-level
636       */
637      public int getNumTypeParameterNoTransform() {
638        return getTypeParameterListNoTransform().getNumChildNoTransform();
639      }
640      /**
641       * Retrieves the element at index {@code i} in the TypeParameter list.
642       * @param i Index of the element to return.
643       * @return The element at position {@code i} in the TypeParameter list.
644       * @apilevel high-level
645       */
646      public TypeVariable getTypeParameter(int i) {
647        return (TypeVariable) getTypeParameterList().getChild(i);
648      }
649      /**
650       * Check whether the TypeParameter list has any children.
651       * @return {@code true} if it has at least one child, {@code false} otherwise.
652       * @apilevel high-level
653       */
654      public boolean hasTypeParameter() {
655        return getTypeParameterList().getNumChild() != 0;
656      }
657      /**
658       * Append an element to the TypeParameter list.
659       * @param node The element to append to the TypeParameter list.
660       * @apilevel high-level
661       */
662      public void addTypeParameter(TypeVariable node) {
663        List<TypeVariable> list = (parent == null) ? getTypeParameterListNoTransform() : getTypeParameterList();
664        list.addChild(node);
665      }
666      /**
667       * @apilevel low-level
668       */
669      public void addTypeParameterNoTransform(TypeVariable node) {
670        List<TypeVariable> list = getTypeParameterListNoTransform();
671        list.addChild(node);
672      }
673      /**
674       * Replaces the TypeParameter list element at index {@code i} with the new node {@code node}.
675       * @param node The new node to replace the old list element.
676       * @param i The list index of the node to be replaced.
677       * @apilevel high-level
678       */
679      public void setTypeParameter(TypeVariable node, int i) {
680        List<TypeVariable> list = getTypeParameterList();
681        list.setChild(node, i);
682      }
683      /**
684       * Retrieves the TypeParameter list.
685       * @return The node representing the TypeParameter list.
686       * @apilevel high-level
687       */
688      @ASTNodeAnnotation.ListChild(name="TypeParameter")
689      public List<TypeVariable> getTypeParameterList() {
690        List<TypeVariable> list = (List<TypeVariable>) getChild(5);
691        return list;
692      }
693      /**
694       * Retrieves the TypeParameter list.
695       * <p><em>This method does not invoke AST transformations.</em></p>
696       * @return The node representing the TypeParameter list.
697       * @apilevel low-level
698       */
699      public List<TypeVariable> getTypeParameterListNoTransform() {
700        return (List<TypeVariable>) getChildNoTransform(5);
701      }
702      /**
703       * Retrieves the TypeParameter list.
704       * @return The node representing the TypeParameter list.
705       * @apilevel high-level
706       */
707      public List<TypeVariable> getTypeParameters() {
708        return getTypeParameterList();
709      }
710      /**
711       * Retrieves the TypeParameter list.
712       * <p><em>This method does not invoke AST transformations.</em></p>
713       * @return The node representing the TypeParameter list.
714       * @apilevel low-level
715       */
716      public List<TypeVariable> getTypeParametersNoTransform() {
717        return getTypeParameterListNoTransform();
718      }
719      /**
720       * @apilevel internal
721       */
722      protected boolean rawMethodDecl_computed = false;
723      /**
724       * @apilevel internal
725       */
726      protected MethodDecl rawMethodDecl_value;
727      /**
728       * @apilevel internal
729       */
730      private void rawMethodDecl_reset() {
731        rawMethodDecl_computed = false;
732        rawMethodDecl_value = null;
733      }
734      /**
735       * @attribute syn
736       * @aspect GenericMethods
737       * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:48
738       */
739      @ASTNodeAnnotation.Attribute
740      public MethodDecl rawMethodDecl() {
741        ASTNode$State state = state();
742        if (rawMethodDecl_computed) {
743          return rawMethodDecl_value;
744        }
745        boolean intermediate = state.INTERMEDIATE_VALUE;
746        state.INTERMEDIATE_VALUE = false;
747        int num = state.boundariesCrossed;
748        boolean isFinal = this.is$Final();
749        rawMethodDecl_value = lookupParMethodDecl(Collections.<TypeDecl>emptyList());
750        if (true) {
751          rawMethodDecl_computed = true;
752        } else {
753        }
754        state.INTERMEDIATE_VALUE |= intermediate;
755    
756        return rawMethodDecl_value;
757      }
758      /**
759       * @apilevel internal
760       */
761      protected List lookupParMethodDecl_Collection_TypeDecl__list;
762      /**
763       * @apilevel internal
764       */
765      protected java.util.Map lookupParMethodDecl_Collection_TypeDecl__values;
766      /**
767       * @apilevel internal
768       */
769      private void lookupParMethodDecl_Collection_TypeDecl__reset() {
770        lookupParMethodDecl_Collection_TypeDecl__values = null;
771        lookupParMethodDecl_Collection_TypeDecl__list = null;
772      }
773      /**
774       * @attribute syn
775       * @aspect GenericMethods
776       * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:56
777       */
778      @ASTNodeAnnotation.Attribute
779      public MethodDecl lookupParMethodDecl(Collection<TypeDecl> typeArguments) {
780        Object _parameters = typeArguments;
781        if (lookupParMethodDecl_Collection_TypeDecl__values == null) lookupParMethodDecl_Collection_TypeDecl__values = new org.jastadd.util.RobustMap(new java.util.HashMap());
782        ASTNode$State state = state();
783        if (lookupParMethodDecl_Collection_TypeDecl__values.containsKey(_parameters)) {
784          return (MethodDecl) lookupParMethodDecl_Collection_TypeDecl__values.get(_parameters);
785        }
786        boolean intermediate = state.INTERMEDIATE_VALUE;
787        state.INTERMEDIATE_VALUE = false;
788        int num = state.boundariesCrossed;
789        boolean isFinal = this.is$Final();
790        MethodDecl lookupParMethodDecl_Collection_TypeDecl__value = newParMethodDecl(typeArguments);
791        if (lookupParMethodDecl_Collection_TypeDecl__list == null) {
792          lookupParMethodDecl_Collection_TypeDecl__list = new List();
793          lookupParMethodDecl_Collection_TypeDecl__list.is$Final = true;
794          lookupParMethodDecl_Collection_TypeDecl__list.setParent(this);
795        }
796        lookupParMethodDecl_Collection_TypeDecl__list.add(lookupParMethodDecl_Collection_TypeDecl__value);
797        if (lookupParMethodDecl_Collection_TypeDecl__value != null) {
798          lookupParMethodDecl_Collection_TypeDecl__value = (MethodDecl) lookupParMethodDecl_Collection_TypeDecl__list.getChild(lookupParMethodDecl_Collection_TypeDecl__list.numChildren-1);
799          lookupParMethodDecl_Collection_TypeDecl__value.is$Final = true;
800        }
801        if (true) {
802          lookupParMethodDecl_Collection_TypeDecl__values.put(_parameters, lookupParMethodDecl_Collection_TypeDecl__value);
803        } else {
804        }
805        state.INTERMEDIATE_VALUE |= intermediate;
806    
807        return lookupParMethodDecl_Collection_TypeDecl__value;
808      }
809      /**
810       * @attribute syn
811       * @aspect GenericMethodsNameAnalysis
812       * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:181
813       */
814      @ASTNodeAnnotation.Attribute
815      public SimpleSet localLookupType(String name) {
816        {
817            for (int i = 0; i < getNumTypeParameter(); i++) {
818              if (original().getTypeParameter(i).name().equals(name)) {
819                return SimpleSet.emptySet.add(original().getTypeParameter(i));
820              }
821            }
822            return SimpleSet.emptySet;
823          }
824      }
825      /**
826       * @attribute syn
827       * @aspect LookupParTypeDecl
828       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1382
829       */
830      @ASTNodeAnnotation.Attribute
831      public GenericMethodDecl original() {
832        GenericMethodDecl original_value = original != null ? original : this;
833    
834        return original_value;
835      }
836      /**
837       * @return {@code true} if this is a generic method or constructor, or a
838       * substitued generic method or constructor.
839       * @attribute syn
840       * @aspect MethodSignature15
841       * @declaredat /home/jesper/git/extendj/java5/frontend/MethodSignature.jrag:375
842       */
843      @ASTNodeAnnotation.Attribute
844      public boolean isGeneric() {
845        boolean isGeneric_value = true;
846    
847        return isGeneric_value;
848      }
849      /**
850       * Note: isGeneric must be called first to check if this declaration is generic.
851       * Otherwise this attribute will throw an error!
852       * @return the original generic declaration of this method.
853       * @attribute syn
854       * @aspect MethodSignature15
855       * @declaredat /home/jesper/git/extendj/java5/frontend/MethodSignature.jrag:386
856       */
857      @ASTNodeAnnotation.Attribute
858      public GenericMethodDecl genericDecl() {
859        GenericMethodDecl genericDecl_value = this;
860    
861        return genericDecl_value;
862      }
863      /**
864       * Note: isGeneric must be called first to check if this declaration is generic.
865       * Otherwise this attribute will throw an error!
866       * @return type parameters for this declaration.
867       * @attribute syn
868       * @aspect MethodSignature15
869       * @declaredat /home/jesper/git/extendj/java5/frontend/MethodSignature.jrag:408
870       */
871      @ASTNodeAnnotation.Attribute
872      public List<TypeVariable> typeParameters() {
873        List<TypeVariable> typeParameters_value = getTypeParameterList();
874    
875        return typeParameters_value;
876      }
877      /**
878       * @attribute syn
879       * @aspect GenericsCodegen
880       * @declaredat /home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:375
881       */
882      @ASTNodeAnnotation.Attribute
883      public boolean needsSignatureAttribute() {
884        boolean needsSignatureAttribute_value = true;
885    
886        return needsSignatureAttribute_value;
887      }
888      /**
889       * @attribute syn
890       * @aspect GenericsCodegen
891       * @declaredat /home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:508
892       */
893      @ASTNodeAnnotation.Attribute
894      public String methodTypeSignature() {
895        {
896            StringBuilder buf = new StringBuilder();
897            buf.append("<");
898            for (int i = 0; i < getNumTypeParameter(); i++) {
899              TypeVariable param = getTypeParameter(i);
900              buf.append(param.getID() + ":" + param.classBound() + param.interfaceBounds());
901            }
902            buf.append(">");
903            buf.append(super.methodTypeSignature());
904            return buf.toString();
905          }
906      }
907      /**
908       * @attribute syn
909       * @aspect FunctionalInterface
910       * @declaredat /home/jesper/git/extendj/java8/frontend/FunctionalInterface.jrag:36
911       */
912      @ASTNodeAnnotation.Attribute
913      public boolean sameSignature(MethodDecl m) {
914        {
915            if (!m.isGeneric()) {
916              return false;
917            }
918            GenericMethodDecl gm = m.genericDecl();
919            return !(!name().equals(gm.name()) || !sameTypeParameters(gm) || !sameFormalParameters(gm));
920          }
921      }
922      /**
923       * @apilevel internal
924       */
925      protected java.util.Map subsignatureTo_MethodDecl_values;
926      /**
927       * @apilevel internal
928       */
929      private void subsignatureTo_MethodDecl_reset() {
930        subsignatureTo_MethodDecl_values = null;
931      }
932      /**
933       * @attribute syn
934       * @aspect FunctionalInterface
935       * @declaredat /home/jesper/git/extendj/java8/frontend/FunctionalInterface.jrag:72
936       */
937      @ASTNodeAnnotation.Attribute
938      public boolean subsignatureTo(MethodDecl m) {
939        Object _parameters = m;
940        if (subsignatureTo_MethodDecl_values == null) subsignatureTo_MethodDecl_values = new org.jastadd.util.RobustMap(new java.util.HashMap());
941        ASTNode$State state = state();
942        if (subsignatureTo_MethodDecl_values.containsKey(_parameters)) {
943          return (Boolean) subsignatureTo_MethodDecl_values.get(_parameters);
944        }
945        boolean intermediate = state.INTERMEDIATE_VALUE;
946        state.INTERMEDIATE_VALUE = false;
947        int num = state.boundariesCrossed;
948        boolean isFinal = this.is$Final();
949        boolean subsignatureTo_MethodDecl_value = subsignatureTo_compute(m);
950        if (isFinal && num == state().boundariesCrossed) {
951          subsignatureTo_MethodDecl_values.put(_parameters, subsignatureTo_MethodDecl_value);
952        } else {
953        }
954        state.INTERMEDIATE_VALUE |= intermediate;
955    
956        return subsignatureTo_MethodDecl_value;
957      }
958      /**
959       * @apilevel internal
960       */
961      private boolean subsignatureTo_compute(MethodDecl m) {
962          if (m.isGeneric()) {
963            GenericMethodDecl gm = m.genericDecl();
964            if (this == gm) {
965              return true;
966            }
967            return sameSignature(gm);
968          } else {
969            // A generic method can never be subsignature to a non-generic method.
970            return false;
971          }
972        }
973      /**
974       * @apilevel internal
975       */
976      protected java.util.Map sameTypeParameters_GenericMethodDecl_values;
977      /**
978       * @apilevel internal
979       */
980      private void sameTypeParameters_GenericMethodDecl_reset() {
981        sameTypeParameters_GenericMethodDecl_values = null;
982      }
983      /**
984       * @attribute syn
985       * @aspect FunctionalInterface
986       * @declaredat /home/jesper/git/extendj/java8/frontend/FunctionalInterface.jrag:108
987       */
988      @ASTNodeAnnotation.Attribute
989      public boolean sameTypeParameters(GenericMethodDecl gm) {
990        Object _parameters = gm;
991        if (sameTypeParameters_GenericMethodDecl_values == null) sameTypeParameters_GenericMethodDecl_values = new org.jastadd.util.RobustMap(new java.util.HashMap());
992        ASTNode$State state = state();
993        if (sameTypeParameters_GenericMethodDecl_values.containsKey(_parameters)) {
994          return (Boolean) sameTypeParameters_GenericMethodDecl_values.get(_parameters);
995        }
996        boolean intermediate = state.INTERMEDIATE_VALUE;
997        state.INTERMEDIATE_VALUE = false;
998        int num = state.boundariesCrossed;
999        boolean isFinal = this.is$Final();
1000        boolean sameTypeParameters_GenericMethodDecl_value = sameTypeParameters_compute(gm);
1001        if (isFinal && num == state().boundariesCrossed) {
1002          sameTypeParameters_GenericMethodDecl_values.put(_parameters, sameTypeParameters_GenericMethodDecl_value);
1003        } else {
1004        }
1005        state.INTERMEDIATE_VALUE |= intermediate;
1006    
1007        return sameTypeParameters_GenericMethodDecl_value;
1008      }
1009      /**
1010       * @apilevel internal
1011       */
1012      private boolean sameTypeParameters_compute(GenericMethodDecl gm) {
1013          if (getNumTypeParameter() != gm.getNumTypeParameter()) {
1014            return false;
1015          }
1016      
1017          for (int i = 0; i < getNumTypeParameter(); i++) {
1018            TypeVariable tv1 = getTypeParameter(i);
1019            TypeVariable tv2 = gm.getTypeParameter(i);
1020            if (tv1.getNumTypeBound() != tv2.getNumTypeBound()) {
1021              return false;
1022            }
1023      
1024            /* The bounds have to be the same in the way that a bound
1025            that exists in type variable tv1 must exist exactly the same
1026            number of times in tv2, but the order doesn't matter */
1027      
1028            boolean[] checkedBound = new boolean[tv1.getNumTypeBound()];
1029      
1030            for (int j = 0; j < tv1.getNumTypeBound(); j++) {
1031              boolean found = false;
1032              for (int k = 0; k < tv2.getNumTypeBound(); k++) {
1033                if (checkedBound[k]) {
1034                  continue;
1035                }
1036                Access a1 = tv1.getTypeBound(j);
1037                Access a2 = tv2.getTypeBound(k);
1038      
1039                if (a1.sameType(a2)) {
1040                  checkedBound[k] = true;
1041                  found = true;
1042                  break;
1043                }
1044              }
1045              if (!found) {
1046                return false;
1047              }
1048            }
1049          }
1050          return true;
1051        }
1052      /**
1053       * @apilevel internal
1054       */
1055      protected java.util.Map sameFormalParameters_GenericMethodDecl_values;
1056      /**
1057       * @apilevel internal
1058       */
1059      private void sameFormalParameters_GenericMethodDecl_reset() {
1060        sameFormalParameters_GenericMethodDecl_values = null;
1061      }
1062      /**
1063       * @attribute syn
1064       * @aspect FunctionalInterface
1065       * @declaredat /home/jesper/git/extendj/java8/frontend/FunctionalInterface.jrag:150
1066       */
1067      @ASTNodeAnnotation.Attribute
1068      public boolean sameFormalParameters(GenericMethodDecl gm) {
1069        Object _parameters = gm;
1070        if (sameFormalParameters_GenericMethodDecl_values == null) sameFormalParameters_GenericMethodDecl_values = new org.jastadd.util.RobustMap(new java.util.HashMap());
1071        ASTNode$State state = state();
1072        if (sameFormalParameters_GenericMethodDecl_values.containsKey(_parameters)) {
1073          return (Boolean) sameFormalParameters_GenericMethodDecl_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 sameFormalParameters_GenericMethodDecl_value = sameFormalParameters_compute(gm);
1080        if (isFinal && num == state().boundariesCrossed) {
1081          sameFormalParameters_GenericMethodDecl_values.put(_parameters, sameFormalParameters_GenericMethodDecl_value);
1082        } else {
1083        }
1084        state.INTERMEDIATE_VALUE |= intermediate;
1085    
1086        return sameFormalParameters_GenericMethodDecl_value;
1087      }
1088      /**
1089       * @apilevel internal
1090       */
1091      private boolean sameFormalParameters_compute(GenericMethodDecl gm) {
1092          if (getNumParameter() != gm.getNumParameter()) {
1093            return false;
1094          }
1095          if (getNumParameter() == 0) {
1096            return true;
1097          }
1098      
1099          for (int i = 0; i < getNumParameter(); i++) {
1100            ParameterDeclaration p1 = getParameter(i);
1101            ParameterDeclaration p2 = gm.getParameter(i);
1102            Access a1 = p1.getTypeAccess();
1103            Access a2 = p2.getTypeAccess();
1104            if (!a1.sameType(a2)) {
1105              return false;
1106            }
1107          }
1108          return true;
1109        }
1110      /**
1111       * @apilevel internal
1112       */
1113      protected boolean usesTypeVariable_computed = false;
1114      /**
1115       * @apilevel internal
1116       */
1117      protected boolean usesTypeVariable_value;
1118      /**
1119       * @apilevel internal
1120       */
1121      private void usesTypeVariable_reset() {
1122        usesTypeVariable_computed = false;
1123      }
1124      /**
1125       * @attribute syn
1126       * @aspect LookupParTypeDecl
1127       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1249
1128       */
1129      @ASTNodeAnnotation.Attribute
1130      public boolean usesTypeVariable() {
1131        ASTNode$State state = state();
1132        if (usesTypeVariable_computed) {
1133          return usesTypeVariable_value;
1134        }
1135        boolean intermediate = state.INTERMEDIATE_VALUE;
1136        state.INTERMEDIATE_VALUE = false;
1137        int num = state.boundariesCrossed;
1138        boolean isFinal = this.is$Final();
1139        usesTypeVariable_value = super.usesTypeVariable() || getTypeParameterList().usesTypeVariable();
1140        if (isFinal && num == state().boundariesCrossed) {
1141          usesTypeVariable_computed = true;
1142        } else {
1143        }
1144        state.INTERMEDIATE_VALUE |= intermediate;
1145    
1146        return usesTypeVariable_value;
1147      }
1148      /**
1149       * @apilevel internal
1150       */
1151      protected boolean typeVariableInReturn_computed = false;
1152      /**
1153       * @apilevel internal
1154       */
1155      protected boolean typeVariableInReturn_value;
1156      /**
1157       * @apilevel internal
1158       */
1159      private void typeVariableInReturn_reset() {
1160        typeVariableInReturn_computed = false;
1161      }
1162      /**
1163       * @attribute syn
1164       * @aspect PolyExpressions
1165       * @declaredat /home/jesper/git/extendj/java8/frontend/PolyExpressions.jrag:110
1166       */
1167      @ASTNodeAnnotation.Attribute
1168      public boolean typeVariableInReturn() {
1169        ASTNode$State state = state();
1170        if (typeVariableInReturn_computed) {
1171          return typeVariableInReturn_value;
1172        }
1173        boolean intermediate = state.INTERMEDIATE_VALUE;
1174        state.INTERMEDIATE_VALUE = false;
1175        int num = state.boundariesCrossed;
1176        boolean isFinal = this.is$Final();
1177        typeVariableInReturn_value = typeVariableInReturn_compute();
1178        if (isFinal && num == state().boundariesCrossed) {
1179          typeVariableInReturn_computed = true;
1180        } else {
1181        }
1182        state.INTERMEDIATE_VALUE |= intermediate;
1183    
1184        return typeVariableInReturn_value;
1185      }
1186      /**
1187       * @apilevel internal
1188       */
1189      private boolean typeVariableInReturn_compute() {
1190          if (!getTypeAccess().usesTypeVariable()) {
1191            return false;
1192          }
1193          ASTNode current = getTypeAccess();
1194          LinkedList<ASTNode> list = new LinkedList<ASTNode>();
1195          list.add(current);
1196          boolean foundUse = false;
1197          while (!list.isEmpty()) {
1198            current = list.poll();
1199            for (int i = 0; i < current.getNumChild(); i++) {
1200              list.add(current.getChild(i));
1201            }
1202            if (current instanceof TypeAccess) {
1203              TypeAccess typeAccess = (TypeAccess)current;
1204              if (typeAccess.type().isTypeVariable()) {
1205                for (int i = 0; i < getNumTypeParameter(); i++) {
1206                  if (typeAccess.type() == getTypeParameter(i)) {
1207                    foundUse = true;
1208                    break;
1209                  }
1210                }
1211                if (foundUse) {
1212                  break;
1213                }
1214              }
1215            }
1216          }
1217          return foundUse;
1218        }
1219      /**
1220       * @attribute inh
1221       * @aspect GenericMethodsNameAnalysis
1222       * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:180
1223       */
1224      /**
1225       * @attribute inh
1226       * @aspect GenericMethodsNameAnalysis
1227       * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:180
1228       */
1229      @ASTNodeAnnotation.Attribute
1230      public SimpleSet lookupType(String name) {
1231        SimpleSet lookupType_String_value = getParent().Define_lookupType(this, null, name);
1232    
1233        return lookupType_String_value;
1234      }
1235      /**
1236       * @attribute inh
1237       * @aspect TypeVariablePositions
1238       * @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:31
1239       */
1240      /**
1241       * @attribute inh
1242       * @aspect TypeVariablePositions
1243       * @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:31
1244       */
1245      @ASTNodeAnnotation.Attribute
1246      public int genericMethodLevel() {
1247        ASTNode$State state = state();
1248        if (genericMethodLevel_computed) {
1249          return genericMethodLevel_value;
1250        }
1251        boolean intermediate = state.INTERMEDIATE_VALUE;
1252        state.INTERMEDIATE_VALUE = false;
1253        int num = state.boundariesCrossed;
1254        boolean isFinal = this.is$Final();
1255        genericMethodLevel_value = getParent().Define_genericMethodLevel(this, null);
1256        if (isFinal && num == state().boundariesCrossed) {
1257          genericMethodLevel_computed = true;
1258        } else {
1259        }
1260        state.INTERMEDIATE_VALUE |= intermediate;
1261    
1262        return genericMethodLevel_value;
1263      }
1264      /**
1265       * @apilevel internal
1266       */
1267      protected boolean genericMethodLevel_computed = false;
1268      /**
1269       * @apilevel internal
1270       */
1271      protected int genericMethodLevel_value;
1272      /**
1273       * @apilevel internal
1274       */
1275      private void genericMethodLevel_reset() {
1276        genericMethodLevel_computed = false;
1277      }
1278      /**
1279       * @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:36
1280       * @apilevel internal
1281       */
1282      public NameType Define_nameType(ASTNode caller, ASTNode child) {
1283        if (caller == getTypeParameterListNoTransform()) {
1284          // @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:178
1285          int childIndex = caller.getIndexOfChild(child);
1286          return NameType.TYPE_NAME;
1287        }
1288        else {
1289          return super.Define_nameType(caller, child);
1290        }
1291      }
1292      protected boolean canDefine_nameType(ASTNode caller, ASTNode child) {
1293        return true;
1294      }
1295      /**
1296       * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:197
1297       * @apilevel internal
1298       */
1299      public SimpleSet Define_lookupType(ASTNode caller, ASTNode child, String name) {
1300        int childIndex = this.getIndexOfChild(caller);
1301        return localLookupType(name).isEmpty() ? lookupType(name) : localLookupType(name);
1302      }
1303      protected boolean canDefine_lookupType(ASTNode caller, ASTNode child, String name) {
1304        return true;
1305      }
1306      /**
1307       * @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:29
1308       * @apilevel internal
1309       */
1310      public int Define_typeVarPosition(ASTNode caller, ASTNode child) {
1311        if (caller == getTypeParameterListNoTransform()) {
1312          // @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:37
1313          int i = caller.getIndexOfChild(child);
1314          return i;
1315        }
1316        else {
1317          return getParent().Define_typeVarPosition(this, caller);
1318        }
1319      }
1320      protected boolean canDefine_typeVarPosition(ASTNode caller, ASTNode child) {
1321        return true;
1322      }
1323      /**
1324       * @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:32
1325       * @apilevel internal
1326       */
1327      public boolean Define_typeVarInMethod(ASTNode caller, ASTNode child) {
1328        if (caller == getTypeParameterListNoTransform()) {
1329          // @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:38
1330          int childIndex = caller.getIndexOfChild(child);
1331          return true;
1332        }
1333        else {
1334          return getParent().Define_typeVarInMethod(this, caller);
1335        }
1336      }
1337      protected boolean canDefine_typeVarInMethod(ASTNode caller, ASTNode child) {
1338        return true;
1339      }
1340      /**
1341       * @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:30
1342       * @apilevel internal
1343       */
1344      public int Define_genericMethodLevel(ASTNode caller, ASTNode child) {
1345        if (caller == getBlockOptNoTransform()) {
1346          // @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:50
1347          return genericMethodLevel() + 1;
1348        }
1349        else if (caller == getTypeParameterListNoTransform()) {
1350          // @declaredat /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag:49
1351          int childIndex = caller.getIndexOfChild(child);
1352          return genericMethodLevel() + 1;
1353        }
1354        else {
1355          return getParent().Define_genericMethodLevel(this, caller);
1356        }
1357      }
1358      protected boolean canDefine_genericMethodLevel(ASTNode caller, ASTNode child) {
1359        return true;
1360      }
1361      /**
1362       * @apilevel internal
1363       */
1364      public ASTNode rewriteTo() {
1365        return super.rewriteTo();
1366      }
1367    }