langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
changeset 8031 d5fe2c1cecfc
parent 7681 1f0819a3341f
child 8032 e1aa25ccdabb
equal deleted inserted replaced
7848:884a6d60b235 8031:d5fe2c1cecfc
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   167                                List<JCTypeParameter> typarams,
   167                                List<JCTypeParameter> typarams,
   168                                List<JCVariableDecl> params,
   168                                List<JCVariableDecl> params,
   169                                List<JCExpression> thrown,
   169                                List<JCExpression> thrown,
   170                                JCBlock body,
   170                                JCBlock body,
   171                                JCExpression defaultValue) {
   171                                JCExpression defaultValue) {
   172         return MethodDef(
       
   173                 mods, name, restype, typarams, params,
       
   174                 null, thrown, body, defaultValue);
       
   175     }
       
   176 
       
   177     public JCMethodDecl MethodDef(JCModifiers mods,
       
   178                                Name name,
       
   179                                JCExpression restype,
       
   180                                List<JCTypeParameter> typarams,
       
   181                                List<JCVariableDecl> params,
       
   182                                List<JCTypeAnnotation> receiver,
       
   183                                List<JCExpression> thrown,
       
   184                                JCBlock body,
       
   185                                JCExpression defaultValue)
       
   186     {
       
   187         JCMethodDecl tree = new JCMethodDecl(mods,
   172         JCMethodDecl tree = new JCMethodDecl(mods,
   188                                        name,
   173                                        name,
   189                                        restype,
   174                                        restype,
   190                                        typarams,
   175                                        typarams,
   191                                        params,
   176                                        params,
   192                                        receiver,
       
   193                                        thrown,
   177                                        thrown,
   194                                        body,
   178                                        body,
   195                                        defaultValue,
   179                                        defaultValue,
   196                                        null);
   180                                        null);
   197         tree.pos = pos;
   181         tree.pos = pos;
   456         tree.pos = pos;
   440         tree.pos = pos;
   457         return tree;
   441         return tree;
   458     }
   442     }
   459 
   443 
   460     public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds) {
   444     public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds) {
   461         return TypeParameter(name, bounds, List.<JCTypeAnnotation>nil());
   445         JCTypeParameter tree = new JCTypeParameter(name, bounds);
   462     }
       
   463 
       
   464     public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annos) {
       
   465         JCTypeParameter tree = new JCTypeParameter(name, bounds, annos);
       
   466         tree.pos = pos;
   446         tree.pos = pos;
   467         return tree;
   447         return tree;
   468     }
   448     }
   469 
   449 
   470     public JCWildcard Wildcard(TypeBoundKind kind, JCTree type) {
   450     public JCWildcard Wildcard(TypeBoundKind kind, JCTree type) {
   479         return tree;
   459         return tree;
   480     }
   460     }
   481 
   461 
   482     public JCAnnotation Annotation(JCTree annotationType, List<JCExpression> args) {
   462     public JCAnnotation Annotation(JCTree annotationType, List<JCExpression> args) {
   483         JCAnnotation tree = new JCAnnotation(annotationType, args);
   463         JCAnnotation tree = new JCAnnotation(annotationType, args);
   484         tree.pos = pos;
       
   485         return tree;
       
   486     }
       
   487 
       
   488     public JCTypeAnnotation TypeAnnotation(JCTree annotationType, List<JCExpression> args) {
       
   489         JCTypeAnnotation tree = new JCTypeAnnotation(annotationType, args);
       
   490         tree.pos = pos;
   464         tree.pos = pos;
   491         return tree;
   465         return tree;
   492     }
   466     }
   493 
   467 
   494     public JCModifiers Modifiers(long flags, List<JCAnnotation> annotations) {
   468     public JCModifiers Modifiers(long flags, List<JCAnnotation> annotations) {
   498         return tree;
   472         return tree;
   499     }
   473     }
   500 
   474 
   501     public JCModifiers Modifiers(long flags) {
   475     public JCModifiers Modifiers(long flags) {
   502         return Modifiers(flags, List.<JCAnnotation>nil());
   476         return Modifiers(flags, List.<JCAnnotation>nil());
   503     }
       
   504 
       
   505     public JCAnnotatedType AnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) {
       
   506         JCAnnotatedType tree = new JCAnnotatedType(annotations, underlyingType);
       
   507         tree.pos = pos;
       
   508         return tree;
       
   509     }
   477     }
   510 
   478 
   511     public JCErroneous Erroneous() {
   479     public JCErroneous Erroneous() {
   512         return Erroneous(List.<JCTree>nil());
   480         return Erroneous(List.<JCTree>nil());
   513     }
   481     }
   819                 Modifiers(m.flags(), Annotations(m.getAnnotationMirrors())),
   787                 Modifiers(m.flags(), Annotations(m.getAnnotationMirrors())),
   820                 m.name,
   788                 m.name,
   821                 Type(mtype.getReturnType()),
   789                 Type(mtype.getReturnType()),
   822                 TypeParams(mtype.getTypeArguments()),
   790                 TypeParams(mtype.getTypeArguments()),
   823                 Params(mtype.getParameterTypes(), m),
   791                 Params(mtype.getParameterTypes(), m),
   824                 null,
       
   825                 Types(mtype.getThrownTypes()),
   792                 Types(mtype.getThrownTypes()),
   826                 body,
   793                 body,
   827                 null,
   794                 null,
   828                 m).setPos(pos).setType(mtype);
   795                 m).setPos(pos).setType(mtype);
   829     }
   796     }