当前位置: 首页>>代码示例>>Java>>正文


Java JCLambda类代码示例

本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.JCLambda的典型用法代码示例。如果您正苦于以下问题:Java JCLambda类的具体用法?Java JCLambda怎么用?Java JCLambda使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JCLambda类属于com.sun.tools.javac.tree.JCTree包,在下文中一共展示了JCLambda类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: methodParamIndex

import com.sun.tools.javac.tree.JCTree.JCLambda; //导入依赖的package包/类
private int methodParamIndex(List<JCTree> path, JCTree param) {
    List<JCTree> curr = path;
    while (curr.head.getTag() != Tag.METHODDEF &&
            curr.head.getTag() != Tag.LAMBDA) {
        curr = curr.tail;
    }
    if (curr.head.getTag() == Tag.METHODDEF) {
        JCMethodDecl method = (JCMethodDecl)curr.head;
        return method.params.indexOf(param);
    } else if (curr.head.getTag() == Tag.LAMBDA) {
        JCLambda lambda = (JCLambda)curr.head;
        return lambda.params.indexOf(param);
    } else {
        Assert.error("methodParamIndex expected to find method or lambda for param: " + param);
        return -1;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:TypeAnnotations.java

示例2: TypeAnnotationPosition

import com.sun.tools.javac.tree.JCTree.JCLambda; //导入依赖的package包/类
private TypeAnnotationPosition(final TargetType ttype,
                               final int pos,
                               final int parameter_index,
                               final JCLambda onLambda,
                               final int type_index,
                               final int bound_index,
                               final List<TypePathEntry> location) {
    Assert.checkNonNull(location);
    this.type = ttype;
    this.pos = pos;
    this.parameter_index = parameter_index;
    this.onLambda = onLambda;
    this.type_index = type_index;
    this.bound_index = bound_index;
    this.location = location;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:TypeAnnotationPosition.java

示例3: methodThrowsTAPosition

import com.sun.tools.javac.tree.JCTree.JCLambda; //导入依赖的package包/类
public static TypeAnnotationPosition methodThrowsTAPosition(SourceVersion ver, final int tidx, final int pos) {
    return call8or9(ver,
            new TAPCall() {
                @Override
                public TypeAnnotationPosition call8(Object ... p) throws InstantiationException, IllegalAccessException, IllegalArgumentException, NoSuchFieldException, SecurityException {
                    TypeAnnotationPosition tapos = TypeAnnotationPosition.class.newInstance();
                    TypeAnnotationPosition.class.getField("type").set(tapos, TargetType.THROWS);
                    TypeAnnotationPosition.class.getField("type_index").set(tapos, tidx);
                    TypeAnnotationPosition.class.getField("pos").set(tapos, pos);
                    return tapos;
                }
                @Override
                public TypeAnnotationPosition call9(Object... param) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, NoSuchFieldException {
                    return (TypeAnnotationPosition) TypeAnnotationPosition.class
                            .getMethod("methodThrows", List.class, JCLambda.class, int.class, int.class)
                            .invoke(null, TypeAnnotationPosition.class.getField("emptyPath").get(null), null, tidx, pos);
                }
            }
        );
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:21,代码来源:TypeAnnotationUtils.java

示例4: typeParameterTAPosition

import com.sun.tools.javac.tree.JCTree.JCLambda; //导入依赖的package包/类
public static TypeAnnotationPosition typeParameterTAPosition(SourceVersion ver, final int tpidx, final int pos) {
    return call8or9(ver,
            new TAPCall() {
                @Override
                public TypeAnnotationPosition call8(Object ... p) throws InstantiationException, IllegalAccessException, IllegalArgumentException, NoSuchFieldException, SecurityException {
                    TypeAnnotationPosition tapos = TypeAnnotationPosition.class.newInstance();
                    TypeAnnotationPosition.class.getField("type").set(tapos, TargetType.CLASS_TYPE_PARAMETER);
                    TypeAnnotationPosition.class.getField("parameter_index").set(tapos, tpidx);
                    TypeAnnotationPosition.class.getField("pos").set(tapos, pos);
                    return tapos;
                }
                @Override
                public TypeAnnotationPosition call9(Object... param) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, NoSuchFieldException {
                    return (TypeAnnotationPosition) TypeAnnotationPosition.class
                            .getMethod("typeParameter", List.class, JCLambda.class, int.class, int.class)
                            .invoke(null, TypeAnnotationPosition.class.getField("emptyPath").get(null), null, tpidx, pos);
                }
            }
        );
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:21,代码来源:TypeAnnotationUtils.java

示例5: methodTypeParameterTAPosition

import com.sun.tools.javac.tree.JCTree.JCLambda; //导入依赖的package包/类
public static TypeAnnotationPosition methodTypeParameterTAPosition(SourceVersion ver, final int tpidx, final int pos) {
    return call8or9(ver,
            new TAPCall() {
                @Override
                public TypeAnnotationPosition call8(Object ... p) throws InstantiationException, IllegalAccessException, IllegalArgumentException, NoSuchFieldException, SecurityException {
                    TypeAnnotationPosition tapos = TypeAnnotationPosition.class.newInstance();
                    TypeAnnotationPosition.class.getField("type").set(tapos, TargetType.METHOD_TYPE_PARAMETER);
                    TypeAnnotationPosition.class.getField("parameter_index").set(tapos, tpidx);
                    TypeAnnotationPosition.class.getField("pos").set(tapos, pos);
                    return tapos;
                }
                @Override
                public TypeAnnotationPosition call9(Object... param) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, NoSuchFieldException {
                    return (TypeAnnotationPosition) TypeAnnotationPosition.class
                            .getMethod("methodTypeParameter", List.class, JCLambda.class, int.class, int.class)
                            .invoke(null, TypeAnnotationPosition.class.getField("emptyPath").get(null), null, tpidx, pos);
                }
            }
        );
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:21,代码来源:TypeAnnotationUtils.java

示例6: typeParameterBoundTAPosition

import com.sun.tools.javac.tree.JCTree.JCLambda; //导入依赖的package包/类
public static TypeAnnotationPosition typeParameterBoundTAPosition(SourceVersion ver, final int tpidx, final int bndidx, final int pos) {
    return call8or9(ver,
            new TAPCall() {
                @Override
                public TypeAnnotationPosition call8(Object ... p) throws InstantiationException, IllegalAccessException, IllegalArgumentException, NoSuchFieldException, SecurityException {
                    TypeAnnotationPosition tapos = TypeAnnotationPosition.class.newInstance();
                    TypeAnnotationPosition.class.getField("type").set(tapos, TargetType.CLASS_TYPE_PARAMETER_BOUND);
                    TypeAnnotationPosition.class.getField("parameter_index").set(tapos, tpidx);
                    TypeAnnotationPosition.class.getField("bound_index").set(tapos, bndidx);
                    TypeAnnotationPosition.class.getField("pos").set(tapos, pos);
                    return tapos;
                }
                @Override
                public TypeAnnotationPosition call9(Object... param) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, NoSuchFieldException {
                    return (TypeAnnotationPosition) TypeAnnotationPosition.class
                            .getMethod("typeParameterBound", List.class, JCLambda.class, int.class, int.class, int.class)
                            .invoke(null, TypeAnnotationPosition.class.getField("emptyPath").get(null), null, tpidx, bndidx, pos);
                }
            }
        );
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:22,代码来源:TypeAnnotationUtils.java

示例7: methodTypeParameterBoundTAPosition

import com.sun.tools.javac.tree.JCTree.JCLambda; //导入依赖的package包/类
public static TypeAnnotationPosition methodTypeParameterBoundTAPosition(SourceVersion ver, final int tpidx, final int bndidx, final int pos) {
    return call8or9(ver,
            new TAPCall() {
                @Override
                public TypeAnnotationPosition call8(Object ... p) throws InstantiationException, IllegalAccessException, IllegalArgumentException, NoSuchFieldException, SecurityException {
                    TypeAnnotationPosition tapos = TypeAnnotationPosition.class.newInstance();
                    TypeAnnotationPosition.class.getField("type").set(tapos, TargetType.METHOD_TYPE_PARAMETER_BOUND);
                    TypeAnnotationPosition.class.getField("parameter_index").set(tapos, tpidx);
                    TypeAnnotationPosition.class.getField("bound_index").set(tapos, bndidx);
                    TypeAnnotationPosition.class.getField("pos").set(tapos, pos);
                    return tapos;
                }
                @Override
                public TypeAnnotationPosition call9(Object... param) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, NoSuchFieldException {
                    return (TypeAnnotationPosition) TypeAnnotationPosition.class
                            .getMethod("methodTypeParameterBound", List.class, JCLambda.class, int.class, int.class, int.class)
                            .invoke(null, TypeAnnotationPosition.class.getField("emptyPath").get(null), null, tpidx, bndidx, pos);
                }
            }
        );
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:22,代码来源:TypeAnnotationUtils.java

示例8: visitLambda

import com.sun.tools.javac.tree.JCTree.JCLambda; //导入依赖的package包/类
public void visitLambda(JCLambda tree) {
    JCLambda prevLambda = currentLambda;
    try {
        currentLambda = tree;

        int i = 0;
        for (JCVariableDecl param : tree.params) {
            if (!param.mods.annotations.isEmpty()) {
                // Nothing to do for separateAnnotationsKinds if
                // there are no annotations of either kind.
                TypeAnnotationPosition pos = new TypeAnnotationPosition();
                pos.type = TargetType.METHOD_FORMAL_PARAMETER;
                pos.parameter_index = i;
                pos.pos = param.vartype.pos;
                pos.onLambda = tree;
                separateAnnotationsKinds(param.vartype, param.sym.type, param.sym, pos);
            }
            ++i;
        }

        push(tree);
        scan(tree.body);
        scan(tree.params);
        pop();
    } finally {
        currentLambda = prevLambda;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:TypeAnnotations.java

示例9: isSimpleStringArg

import com.sun.tools.javac.tree.JCTree.JCLambda; //导入依赖的package包/类
boolean isSimpleStringArg(JCExpression e) {
    switch (e.getTag()) {
        case LAMBDA:
            JCLambda lambda = (JCLambda)e;
            return (lambda.getBodyKind() == BodyKind.EXPRESSION) &&
                    isSimpleStringArg((JCExpression)lambda.body);
        default:
            Symbol argSym = TreeInfo.symbolFor(e);
            return (e.type.constValue() != null ||
                    (argSym != null && argSym.kind == Kinds.Kind.VAR));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:AssertCheckAnalyzer.java

示例10: visitLambda

import com.sun.tools.javac.tree.JCTree.JCLambda; //导入依赖的package包/类
public void visitLambda(JCLambda tree) {
    JCLambda prevLambda = currentLambda;
    try {
        currentLambda = tree;

        int i = 0;
        for (JCVariableDecl param : tree.params) {
            if (!param.mods.annotations.isEmpty()) {
                // Nothing to do for separateAnnotationsKinds if
                // there are no annotations of either kind.
                final TypeAnnotationPosition pos =  TypeAnnotationPosition
                        .methodParameter(tree, i, param.vartype.pos);
                push(param);
                try {
                    separateAnnotationsKinds(param.vartype, param.sym.type, param.sym, pos);
                } finally {
                    pop();
                }
            }
            ++i;
        }

        scan(tree.body);
        scan(tree.params);
    } finally {
        currentLambda = prevLambda;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:TypeAnnotations.java

示例11: methodReturn

import com.sun.tools.javac.tree.JCTree.JCLambda; //导入依赖的package包/类
/**
 * Create a {@code TypeAnnotationPosition} for a method return.
 *
 * @param location The type path.
 * @param onLambda The lambda for this parameter.
 * @param pos The position from the associated tree node.
 */
public static TypeAnnotationPosition
    methodReturn(final List<TypePathEntry> location,
                 final JCLambda onLambda,
                 final int pos) {
    return new TypeAnnotationPosition(TargetType.METHOD_RETURN, pos,
                                      Integer.MIN_VALUE, onLambda,
                                      Integer.MIN_VALUE, Integer.MIN_VALUE,
                                      location);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:TypeAnnotationPosition.java

示例12: methodReceiver

import com.sun.tools.javac.tree.JCTree.JCLambda; //导入依赖的package包/类
/**
 * Create a {@code TypeAnnotationPosition} for a method receiver parameter.
 *
 * @param location The type path.
 * @param onLambda The lambda for this parameter.
 * @param pos The position from the associated tree node.
 */
public static TypeAnnotationPosition
    methodReceiver(final List<TypePathEntry> location,
                 final JCLambda onLambda,
                 final int pos) {
    return new TypeAnnotationPosition(TargetType.METHOD_RECEIVER, pos,
                                      Integer.MIN_VALUE, onLambda,
                                      Integer.MIN_VALUE, Integer.MIN_VALUE,
                                      location);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:TypeAnnotationPosition.java

示例13: methodParameter

import com.sun.tools.javac.tree.JCTree.JCLambda; //导入依赖的package包/类
/**
 * Create a {@code TypeAnnotationPosition} for a method formal parameter.
 *
 * @param location The type path.
 * @param onLambda The lambda for this parameter.
 * @param parameter_index The index of the parameter.
 * @param pos The position from the associated tree node.
 */
public static TypeAnnotationPosition
    methodParameter(final List<TypePathEntry> location,
                    final JCLambda onLambda,
                    final int parameter_index,
                    final int pos) {
    return new TypeAnnotationPosition(TargetType.METHOD_FORMAL_PARAMETER,
                                      pos, parameter_index, onLambda,
                                      Integer.MIN_VALUE, Integer.MIN_VALUE,
                                      location);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:TypeAnnotationPosition.java

示例14: methodRef

import com.sun.tools.javac.tree.JCTree.JCLambda; //导入依赖的package包/类
/**
 * Create a {@code TypeAnnotationPosition} for a method reference.
 *
 * @param location The type path.
 * @param onLambda The lambda for this method reference.
 * @param pos The position from the associated tree node.
 */
public static TypeAnnotationPosition
    methodRef(final List<TypePathEntry> location,
              final JCLambda onLambda,
              final int pos) {
    return new TypeAnnotationPosition(TargetType.METHOD_REFERENCE, pos,
                                      Integer.MIN_VALUE, onLambda,
                                      Integer.MIN_VALUE, Integer.MIN_VALUE,
                                      location);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:TypeAnnotationPosition.java

示例15: constructorRef

import com.sun.tools.javac.tree.JCTree.JCLambda; //导入依赖的package包/类
/**
 * Create a {@code TypeAnnotationPosition} for a constructor reference.
 *
 * @param location The type path.
 * @param onLambda The lambda for this constructor reference.
 * @param pos The position from the associated tree node.
 */
public static TypeAnnotationPosition
    constructorRef(final List<TypePathEntry> location,
                   final JCLambda onLambda,
                   final int pos) {
    return new TypeAnnotationPosition(TargetType.CONSTRUCTOR_REFERENCE, pos,
                                      Integer.MIN_VALUE, onLambda,
                                      Integer.MIN_VALUE, Integer.MIN_VALUE,
                                      location);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:TypeAnnotationPosition.java


注:本文中的com.sun.tools.javac.tree.JCTree.JCLambda类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。