< prev index next > src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java
Print this page
}
/**
* Common supertype for all functional expression trees (lambda and method references)
*/
- public abstract static class JCFunctionalExpression extends JCPolyExpression {
+ 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) {
- return target != null ? types.findDescriptorType(target) : types.createErrorType(null);
+ 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.
}
/**
* A lambda expression.
*/
- public static class JCLambda extends JCFunctionalExpression implements LambdaExpressionTree {
+ public static final class JCLambda extends JCFunctionalExpression implements LambdaExpressionTree {
public enum ParameterKind {
IMPLICIT,
EXPLICIT
}
}
/**
* Selects a member expression.
*/
- public static class JCMemberReference extends JCFunctionalExpression implements MemberReferenceTree {
+ 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 >