Java Code Examples for com.sun.tools.javac.tree.JCTree.JCMemberReference.ReferenceKind#ARRAY_CTOR

The following examples show how to use com.sun.tools.javac.tree.JCTree.JCMemberReference.ReferenceKind#ARRAY_CTOR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LambdaToMethod.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Lambda body to use for a 'new'.
 */
private JCExpression expressionNew() {
    if (tree.kind == ReferenceKind.ARRAY_CTOR) {
        //create the array creation expression
        JCNewArray newArr = make.NewArray(
                make.Type(types.elemtype(tree.getQualifierExpression().type)),
                List.of(make.Ident(params.first())),
                null);
        newArr.type = tree.getQualifierExpression().type;
        return newArr;
    } else {
        //create the instance creation expression
        //note that method reference syntax does not allow an explicit
        //enclosing class (so the enclosing class is null)
        JCNewClass newClass = make.NewClass(null,
                List.<JCExpression>nil(),
                make.Type(tree.getQualifierExpression().type),
                convertArgs(tree.sym, args.toList(), tree.varargsElement),
                null);
        newClass.constructor = tree.sym;
        newClass.constructorType = tree.sym.erasure(types);
        newClass.type = tree.getQualifierExpression().type;
        setVarargsIfNeeded(newClass, tree.varargsElement);
        return newClass;
    }
}
 
Example 2
Source File: LambdaToMethod.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Lambda body to use for a 'new'.
 */
private JCExpression expressionNew() {
    if (tree.kind == ReferenceKind.ARRAY_CTOR) {
        //create the array creation expression
        JCNewArray newArr = make.NewArray(
                make.Type(types.elemtype(tree.getQualifierExpression().type)),
                List.of(make.Ident(params.first())),
                null);
        newArr.type = tree.getQualifierExpression().type;
        return newArr;
    } else {
        //create the instance creation expression
        //note that method reference syntax does not allow an explicit
        //enclosing class (so the enclosing class is null)
        JCNewClass newClass = make.NewClass(null,
                List.<JCExpression>nil(),
                make.Type(tree.getQualifierExpression().type),
                convertArgs(tree.sym, args.toList(), tree.varargsElement),
                null);
        newClass.constructor = tree.sym;
        newClass.constructorType = tree.sym.erasure(types);
        newClass.type = tree.getQualifierExpression().type;
        setVarargsIfNeeded(newClass, tree.varargsElement);
        return newClass;
    }
}
 
Example 3
Source File: LambdaToMethod.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Lambda body to use for a 'new'.
 */
private JCExpression expressionNew() {
    if (tree.kind == ReferenceKind.ARRAY_CTOR) {
        //create the array creation expression
        JCNewArray newArr = make.NewArray(
                make.Type(types.elemtype(tree.getQualifierExpression().type)),
                List.of(make.Ident(params.first())),
                null);
        newArr.type = tree.getQualifierExpression().type;
        return newArr;
    } else {
        //create the instance creation expression
        //note that method reference syntax does not allow an explicit
        //enclosing class (so the enclosing class is null)
        JCNewClass newClass = make.NewClass(null,
                List.nil(),
                make.Type(tree.getQualifierExpression().type),
                convertArgs(tree.sym, args.toList(), tree.varargsElement),
                null);
        newClass.constructor = tree.sym;
        newClass.constructorType = tree.sym.erasure(types);
        newClass.type = tree.getQualifierExpression().type;
        setVarargsIfNeeded(newClass, tree.varargsElement);
        return newClass;
    }
}
 
Example 4
Source File: LambdaToMethod.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Lambda body to use for a 'new'.
 */
private JCExpression expressionNew() {
    if (tree.kind == ReferenceKind.ARRAY_CTOR) {
        //create the array creation expression
        JCNewArray newArr = make.NewArray(
                make.Type(types.elemtype(tree.getQualifierExpression().type)),
                List.of(make.Ident(params.first())),
                null);
        newArr.type = tree.getQualifierExpression().type;
        return newArr;
    } else {
        //create the instance creation expression
        //note that method reference syntax does not allow an explicit
        //enclosing class (so the enclosing class is null)
        JCNewClass newClass = make.NewClass(null,
                List.<JCExpression>nil(),
                make.Type(tree.getQualifierExpression().type),
                convertArgs(tree.sym, args.toList(), tree.varargsElement),
                null);
        newClass.constructor = tree.sym;
        newClass.constructorType = tree.sym.erasure(types);
        newClass.type = tree.getQualifierExpression().type;
        setVarargsIfNeeded(newClass, tree.varargsElement);
        return newClass;
    }
}
 
Example 5
Source File: LambdaToMethod.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Lambda body to use for a 'new'.
 */
private JCExpression expressionNew() {
    if (tree.kind == ReferenceKind.ARRAY_CTOR) {
        //create the array creation expression
        JCNewArray newArr = make.NewArray(
                make.Type(types.elemtype(tree.getQualifierExpression().type)),
                List.of(make.Ident(params.first())),
                null);
        newArr.type = tree.getQualifierExpression().type;
        return newArr;
    } else {
        //create the instance creation expression
        //note that method reference syntax does not allow an explicit
        //enclosing class (so the enclosing class is null)
        JCNewClass newClass = make.NewClass(null,
                List.<JCExpression>nil(),
                make.Type(tree.getQualifierExpression().type),
                convertArgs(tree.sym, args.toList(), tree.varargsElement),
                null);
        newClass.constructor = tree.sym;
        newClass.constructorType = tree.sym.erasure(types);
        newClass.type = tree.getQualifierExpression().type;
        setVarargsIfNeeded(newClass, tree.varargsElement);
        return newClass;
    }
}
 
Example 6
Source File: LambdaToMethod.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Lambda body to use for a 'new'.
 */
private JCExpression expressionNew() {
    if (tree.kind == ReferenceKind.ARRAY_CTOR) {
        //create the array creation expression
        JCNewArray newArr = make.NewArray(
                make.Type(types.elemtype(tree.getQualifierExpression().type)),
                List.of(make.Ident(params.first())),
                null);
        newArr.type = tree.getQualifierExpression().type;
        return newArr;
    } else {
        //create the instance creation expression
        //note that method reference syntax does not allow an explicit
        //enclosing class (so the enclosing class is null)
        JCNewClass newClass = make.NewClass(null,
                List.<JCExpression>nil(),
                make.Type(tree.getQualifierExpression().type),
                convertArgs(tree.sym, args.toList(), tree.varargsElement),
                null);
        newClass.constructor = tree.sym;
        newClass.constructorType = tree.sym.erasure(types);
        newClass.type = tree.getQualifierExpression().type;
        setVarargsIfNeeded(newClass, tree.varargsElement);
        return newClass;
    }
}
 
Example 7
Source File: LambdaToMethod.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Lambda body to use for a 'new'.
 */
private JCExpression expressionNew() {
    if (tree.kind == ReferenceKind.ARRAY_CTOR) {
        //create the array creation expression
        JCNewArray newArr = make.NewArray(
                make.Type(types.elemtype(tree.getQualifierExpression().type)),
                List.of(make.Ident(params.first())),
                null);
        newArr.type = tree.getQualifierExpression().type;
        return newArr;
    } else {
        //create the instance creation expression
        //note that method reference syntax does not allow an explicit
        //enclosing class (so the enclosing class is null)
        JCNewClass newClass = make.NewClass(null,
                List.nil(),
                make.Type(tree.getQualifierExpression().type),
                convertArgs(tree.sym, args.toList(), tree.varargsElement),
                null);
        newClass.constructor = tree.sym;
        newClass.constructorType = tree.sym.erasure(types);
        newClass.type = tree.getQualifierExpression().type;
        setVarargsIfNeeded(newClass, tree.varargsElement);
        return newClass;
    }
}
 
Example 8
Source File: LambdaToMethod.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Does this reference need to be converted to a lambda
 * (i.e. var args need to be expanded or "super" is used)
 */
final boolean needsConversionToLambda() {
    return interfaceParameterIsIntersectionType() ||
            isSuper ||
            needsVarArgsConversion() ||
            isArrayOp() ||
            isPrivateInOtherClass() ||
            !receiverAccessible() ||
            (tree.getMode() == ReferenceMode.NEW &&
              tree.kind != ReferenceKind.ARRAY_CTOR &&
              (tree.sym.owner.isLocal() || tree.sym.owner.isInner()));
}
 
Example 9
Source File: LambdaToMethod.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Does this reference need to be converted to a lambda
 * (i.e. var args need to be expanded or "super" is used)
 */
final boolean needsConversionToLambda() {
    return interfaceParameterIsIntersectionType() ||
            isSuper ||
            needsVarArgsConversion() ||
            isArrayOp() ||
            isPrivateInOtherClass() ||
            isProtectedInSuperClassOfEnclosingClassInOtherPackage() ||
            !receiverAccessible() ||
            (tree.getMode() == ReferenceMode.NEW &&
              tree.kind != ReferenceKind.ARRAY_CTOR &&
              (tree.sym.owner.isLocal() || tree.sym.owner.isInner()));
}
 
Example 10
Source File: LambdaToMethod.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Does this reference need to be converted to a lambda
 * (i.e. var args need to be expanded or "super" is used)
 */
final boolean needsConversionToLambda() {
    return interfaceParameterIsIntersectionType() ||
            isSuper ||
            needsVarArgsConversion() ||
            isArrayOp() ||
            isPrivateInOtherClass() ||
            !receiverAccessible() ||
            (tree.getMode() == ReferenceMode.NEW &&
              tree.kind != ReferenceKind.ARRAY_CTOR &&
              (tree.sym.owner.isLocal() || tree.sym.owner.isInner()));
}
 
Example 11
Source File: LambdaToMethod.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Does this reference need to be converted to a lambda
 * (i.e. var args need to be expanded or "super" is used)
 */
final boolean needsConversionToLambda() {
    return interfaceParameterIsIntersectionType() ||
            isSuper ||
            needsVarArgsConversion() ||
            isArrayOp() ||
            isPrivateInOtherClass() ||
            !receiverAccessible() ||
            (tree.getMode() == ReferenceMode.NEW &&
              tree.kind != ReferenceKind.ARRAY_CTOR &&
              (tree.sym.owner.isLocal() || tree.sym.owner.isInner()));
}
 
Example 12
Source File: LambdaToMethod.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Does this reference need to be converted to a lambda
 * (i.e. var args need to be expanded or "super" is used)
 */
final boolean needsConversionToLambda() {
    return interfaceParameterIsIntersectionType() ||
            isSuper ||
            needsVarArgsConversion() ||
            isArrayOp() ||
            isPrivateInOtherClass() ||
            !receiverAccessible() ||
            (tree.getMode() == ReferenceMode.NEW &&
              tree.kind != ReferenceKind.ARRAY_CTOR &&
              (tree.sym.owner.isLocal() || tree.sym.owner.isInner()));
}
 
Example 13
Source File: Resolve.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
ReferenceKind referenceKind(Symbol sym) {
    return ReferenceKind.ARRAY_CTOR;
}
 
Example 14
Source File: Resolve.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
ReferenceKind referenceKind(Symbol sym) {
    return ReferenceKind.ARRAY_CTOR;
}
 
Example 15
Source File: Resolve.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
ReferenceKind referenceKind(Symbol sym) {
    return ReferenceKind.ARRAY_CTOR;
}
 
Example 16
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
ReferenceKind referenceKind(Symbol sym) {
    return ReferenceKind.ARRAY_CTOR;
}
 
Example 17
Source File: Resolve.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
ReferenceKind referenceKind(Symbol sym) {
    return ReferenceKind.ARRAY_CTOR;
}
 
Example 18
Source File: Resolve.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
ReferenceKind referenceKind(Symbol sym) {
    return ReferenceKind.ARRAY_CTOR;
}
 
Example 19
Source File: Resolve.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
ReferenceKind referenceKind(Symbol sym) {
    return ReferenceKind.ARRAY_CTOR;
}
 
Example 20
Source File: Resolve.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
ReferenceKind referenceKind(Symbol sym) {
    return ReferenceKind.ARRAY_CTOR;
}