src/share/classes/com/sun/source/tree/LambdaExpressionTree.java

Thu, 24 Nov 2011 13:36:20 +0000

author
mcimadamore
date
Thu, 24 Nov 2011 13:36:20 +0000
changeset 1142
c896d95e7469
child 1326
30c36e23f154
permissions
-rw-r--r--

7115046: Add AST node for lambda expressions
Summary: Add tree nodes for representing lambda expressions and update relevant visitors interfaces
Reviewed-by: jjg

mcimadamore@1142 1 /*
mcimadamore@1142 2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
mcimadamore@1142 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mcimadamore@1142 4 *
mcimadamore@1142 5 * This code is free software; you can redistribute it and/or modify it
mcimadamore@1142 6 * under the terms of the GNU General Public License version 2 only, as
mcimadamore@1142 7 * published by the Free Software Foundation. Oracle designates this
mcimadamore@1142 8 * particular file as subject to the "Classpath" exception as provided
mcimadamore@1142 9 * by Oracle in the LICENSE file that accompanied this code.
mcimadamore@1142 10 *
mcimadamore@1142 11 * This code is distributed in the hope that it will be useful, but WITHOUT
mcimadamore@1142 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mcimadamore@1142 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mcimadamore@1142 14 * version 2 for more details (a copy is included in the LICENSE file that
mcimadamore@1142 15 * accompanied this code).
mcimadamore@1142 16 *
mcimadamore@1142 17 * You should have received a copy of the GNU General Public License version
mcimadamore@1142 18 * 2 along with this work; if not, write to the Free Software Foundation,
mcimadamore@1142 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mcimadamore@1142 20 *
mcimadamore@1142 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
mcimadamore@1142 22 * or visit www.oracle.com if you need additional information or have any
mcimadamore@1142 23 * questions.
mcimadamore@1142 24 */
mcimadamore@1142 25
mcimadamore@1142 26 package com.sun.source.tree;
mcimadamore@1142 27
mcimadamore@1142 28 import java.util.List;
mcimadamore@1142 29
mcimadamore@1142 30 /**
mcimadamore@1142 31 * A tree node for a lambda expression.
mcimadamore@1142 32 *
mcimadamore@1142 33 * For example:
mcimadamore@1142 34 * <pre>
mcimadamore@1142 35 * ()->{}
mcimadamore@1142 36 * (List<String> ls)->ls.size()
mcimadamore@1142 37 * (x,y)-> { return x + y; }
mcimadamore@1142 38 * </pre>
mcimadamore@1142 39 */
mcimadamore@1142 40 public interface LambdaExpressionTree extends ExpressionTree {
mcimadamore@1142 41
mcimadamore@1142 42 /**
mcimadamore@1142 43 * Lambda expressions come in two forms: (i) expression lambdas, whose body
mcimadamore@1142 44 * is an expression, and (ii) statement lambdas, whose body is a block
mcimadamore@1142 45 */
mcimadamore@1142 46 public enum BodyKind {
mcimadamore@1142 47 /** enum constant for expression lambdas */
mcimadamore@1142 48 EXPRESSION,
mcimadamore@1142 49 /** enum constant for statement lambdas */
mcimadamore@1142 50 STATEMENT;
mcimadamore@1142 51 }
mcimadamore@1142 52
mcimadamore@1142 53 List<? extends VariableTree> getParameters();
mcimadamore@1142 54 Tree getBody();
mcimadamore@1142 55 BodyKind getBodyKind();
mcimadamore@1142 56 }

mercurial