< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java

Print this page

  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.tools.javac.tree;
  27 
  28 import java.io.IOException;
  29 import java.io.StringWriter;
  30 import java.util.*;

  31 
  32 import javax.lang.model.element.Modifier;
  33 import javax.lang.model.type.TypeKind;
  34 import javax.tools.JavaFileObject;
  35 
  36 import com.sun.source.tree.*;
  37 import com.sun.tools.javac.code.*;
  38 import com.sun.tools.javac.code.Directive.RequiresDirective;
  39 import com.sun.tools.javac.code.Scope.*;
  40 import com.sun.tools.javac.code.Symbol.*;
  41 import com.sun.tools.javac.util.*;
  42 import com.sun.tools.javac.util.DefinedBy.Api;
  43 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
  44 import com.sun.tools.javac.util.List;
  45 
  46 import static com.sun.tools.javac.tree.JCTree.Tag.*;
  47 
  48 import javax.tools.JavaFileManager.Location;
  49 
  50 import com.sun.source.tree.ModuleTree.ModuleKind;

 806         public PolyKind polyKind;
 807 
 808         @Override public boolean isPoly() { return polyKind == PolyKind.POLY; }
 809         @Override public boolean isStandalone() { return polyKind == PolyKind.STANDALONE; }
 810     }
 811 
 812     /**
 813      * Common supertype for all functional expression trees (lambda and method references)
 814      */
 815     public abstract static class JCFunctionalExpression extends JCPolyExpression {
 816 
 817         public JCFunctionalExpression() {
 818             //a functional expression is always a 'true' poly
 819             polyKind = PolyKind.POLY;
 820         }
 821 
 822         /** list of target types inferred for this functional expression. */
 823         public Type target;
 824         /** The owner of this functional expression. */
 825         public Symbol owner;


 826 
 827         public Type getDescriptorType(Types types) {
 828             return target != null ? types.findDescriptorType(target) : types.createErrorType(null);
 829         }


 830     }
 831 
 832     /**
 833      * A class definition.
 834      */
 835     public static class JCClassDecl extends JCStatement implements ClassTree {
 836         /** the modifiers */
 837         public JCModifiers mods;
 838         /** the name of the class */
 839         public Name name;
 840         /** formal class parameters */
 841         public List<JCTypeParameter> typarams;
 842         /** the classes this class extends */
 843         public JCExpression extending;
 844         /** the interfaces implemented by this class */
 845         public List<JCExpression> implementing;
 846         /** the subclasses allowed to extend this class, if sealed */
 847         public List<JCExpression> permitting;
 848         /** all variables and methods defined in this class */
 849         public List<JCTree> defs;

  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.tools.javac.tree;
  27 
  28 import java.io.IOException;
  29 import java.io.StringWriter;
  30 import java.util.*;
  31 import java.util.function.Consumer;
  32 
  33 import javax.lang.model.element.Modifier;
  34 import javax.lang.model.type.TypeKind;
  35 import javax.tools.JavaFileObject;
  36 
  37 import com.sun.source.tree.*;
  38 import com.sun.tools.javac.code.*;
  39 import com.sun.tools.javac.code.Directive.RequiresDirective;
  40 import com.sun.tools.javac.code.Scope.*;
  41 import com.sun.tools.javac.code.Symbol.*;
  42 import com.sun.tools.javac.util.*;
  43 import com.sun.tools.javac.util.DefinedBy.Api;
  44 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
  45 import com.sun.tools.javac.util.List;
  46 
  47 import static com.sun.tools.javac.tree.JCTree.Tag.*;
  48 
  49 import javax.tools.JavaFileManager.Location;
  50 
  51 import com.sun.source.tree.ModuleTree.ModuleKind;

 807         public PolyKind polyKind;
 808 
 809         @Override public boolean isPoly() { return polyKind == PolyKind.POLY; }
 810         @Override public boolean isStandalone() { return polyKind == PolyKind.STANDALONE; }
 811     }
 812 
 813     /**
 814      * Common supertype for all functional expression trees (lambda and method references)
 815      */
 816     public abstract static class JCFunctionalExpression extends JCPolyExpression {
 817 
 818         public JCFunctionalExpression() {
 819             //a functional expression is always a 'true' poly
 820             polyKind = PolyKind.POLY;
 821         }
 822 
 823         /** list of target types inferred for this functional expression. */
 824         public Type target;
 825         /** The owner of this functional expression. */
 826         public Symbol owner;
 827         /** code reflection specific metadata. */
 828         public CodeReflectionInfo codeReflectionInfo;
 829 
 830         public Type getDescriptorType(Types types) {
 831             return target != null ? types.findDescriptorType(target) : types.createErrorType(null);
 832         }
 833 
 834         public record CodeReflectionInfo(Consumer<Name> registerImplementation, Type reflectableLambdaMetafactory) { }
 835     }
 836 
 837     /**
 838      * A class definition.
 839      */
 840     public static class JCClassDecl extends JCStatement implements ClassTree {
 841         /** the modifiers */
 842         public JCModifiers mods;
 843         /** the name of the class */
 844         public Name name;
 845         /** formal class parameters */
 846         public List<JCTypeParameter> typarams;
 847         /** the classes this class extends */
 848         public JCExpression extending;
 849         /** the interfaces implemented by this class */
 850         public List<JCExpression> implementing;
 851         /** the subclasses allowed to extend this class, if sealed */
 852         public List<JCExpression> permitting;
 853         /** all variables and methods defined in this class */
 854         public List<JCTree> defs;
< prev index next >