< prev index next >

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

Print this page
*** 796,24 ***
      }
  
      /**
       * Common supertype for all functional expression trees (lambda and method references)
       */
!     public abstract static class JCFunctionalExpression extends JCPolyExpression {
  
          public JCFunctionalExpression() {
              //a functional expression is always a 'true' poly
              polyKind = PolyKind.POLY;
          }
  
          /** list of target types inferred for this functional expression. */
          public Type target;
          /** The owner of this functional expression. */
          public Symbol owner;
  
          public Type getDescriptorType(Types types) {
!             return target != null ? types.findDescriptorType(target) : types.createErrorType(null);
          }
      }
  
      /**
       * A class definition.
--- 796,34 ---
      }
  
      /**
       * Common supertype for all functional expression trees (lambda and method references)
       */
!     public abstract static sealed class JCFunctionalExpression extends JCPolyExpression
+                                                                permits JCLambda, JCMemberReference {
  
          public JCFunctionalExpression() {
              //a functional expression is always a 'true' poly
              polyKind = PolyKind.POLY;
          }
  
          /** list of target types inferred for this functional expression. */
          public Type target;
          /** The owner of this functional expression. */
          public Symbol owner;
+         /** code reflection specific metadata. */
+         public Symbol codeModel;
  
          public Type getDescriptorType(Types types) {
!             if (target == null) {
+                 return types.createErrorType(null);
+             } else if (target.hasTag(TypeTag.METHOD)) {
+                 // this is a quoted expression
+                 return target;
+             } else {
+                 return types.findDescriptorType(target);
+             }
          }
      }
  
      /**
       * A class definition.

*** 2002,11 ***
      }
  
      /**
       * A lambda expression.
       */
!     public static class JCLambda extends JCFunctionalExpression implements LambdaExpressionTree {
  
          public enum ParameterKind {
              IMPLICIT,
              EXPLICIT
          }
--- 2012,11 ---
      }
  
      /**
       * A lambda expression.
       */
!     public static final class JCLambda extends JCFunctionalExpression implements LambdaExpressionTree {
  
          public enum ParameterKind {
              IMPLICIT,
              EXPLICIT
          }

*** 2589,11 ***
      }
  
      /**
       * Selects a member expression.
       */
!     public static class JCMemberReference extends JCFunctionalExpression implements MemberReferenceTree {
  
          public ReferenceMode mode;
          public ReferenceKind kind;
          public Name name;
          public JCExpression expr;
--- 2599,11 ---
      }
  
      /**
       * Selects a member expression.
       */
!     public static non-sealed class JCMemberReference extends JCFunctionalExpression implements MemberReferenceTree {
  
          public ReferenceMode mode;
          public ReferenceKind kind;
          public Name name;
          public JCExpression expr;
< prev index next >