Java 类com.sun.tools.javac.tree.JCTree.JCMemberReference.ReferenceKind 实例源码

项目:OpenJSharp    文件:LambdaToMethod.java   
/**
 * 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;
    }
}
项目:OpenJSharp    文件:LambdaToMethod.java   
/**
 * Erasure destroys the implementation parameter subtype
 * relationship for intersection types
 */
boolean interfaceParameterIsIntersectionType() {
    List<Type> tl = tree.getDescriptorType(types).getParameterTypes();
    if (tree.kind == ReferenceKind.UNBOUND) {
        tl = tl.tail;
    }
    for (; tl.nonEmpty(); tl = tl.tail) {
        Type pt = tl.head;
        if (pt.getKind() == TypeKind.TYPEVAR) {
            TypeVar tv = (TypeVar) pt;
            if (tv.bound.getKind() == TypeKind.INTERSECTION) {
                return true;
            }
        }
    }
    return false;
}
项目:openjdk-jdk10    文件:LambdaToMethod.java   
/**
 * 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;
    }
}
项目:openjdk9    文件:LambdaToMethod.java   
/**
 * 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;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:LambdaToMethod.java   
/**
 * 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;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:LambdaToMethod.java   
/**
 * Erasure destroys the implementation parameter subtype
 * relationship for intersection types
 */
boolean interfaceParameterIsIntersectionType() {
    List<Type> tl = tree.getDescriptorType(types).getParameterTypes();
    if (tree.kind == ReferenceKind.UNBOUND) {
        tl = tl.tail;
    }
    for (; tl.nonEmpty(); tl = tl.tail) {
        Type pt = tl.head;
        if (pt.getKind() == TypeKind.TYPEVAR) {
            TypeVar tv = (TypeVar) pt;
            if (tv.bound.getKind() == TypeKind.INTERSECTION) {
                return true;
            }
        }
    }
    return false;
}
项目:jsr308-langtools    文件:LambdaToMethod.java   
/**
 * 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;
    }
}
项目:jsr308-langtools    文件:LambdaToMethod.java   
/**
 * Erasure destroys the implementation parameter subtype
 * relationship for intersection types
 */
boolean interfaceParameterIsIntersectionType() {
    List<Type> tl = tree.getDescriptorType(types).getParameterTypes();
    if (tree.kind == ReferenceKind.UNBOUND) {
        tl = tl.tail;
    }
    for (; tl.nonEmpty(); tl = tl.tail) {
        Type pt = tl.head;
        if (pt.getKind() == TypeKind.TYPEVAR) {
            TypeVar tv = (TypeVar) pt;
            if (tv.bound.getKind() == TypeKind.INTERSECTION) {
                return true;
            }
        }
    }
    return false;
}
项目:infobip-open-jdk-8    文件:LambdaToMethod.java   
/**
 * 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;
    }
}
项目:infobip-open-jdk-8    文件:LambdaToMethod.java   
/**
 * Erasure destroys the implementation parameter subtype
 * relationship for intersection types
 */
boolean interfaceParameterIsIntersectionType() {
    List<Type> tl = tree.getDescriptorType(types).getParameterTypes();
    if (tree.kind == ReferenceKind.UNBOUND) {
        tl = tl.tail;
    }
    for (; tl.nonEmpty(); tl = tl.tail) {
        Type pt = tl.head;
        if (pt.getKind() == TypeKind.TYPEVAR) {
            TypeVar tv = (TypeVar) pt;
            if (tv.bound.getKind() == TypeKind.INTERSECTION) {
                return true;
            }
        }
    }
    return false;
}
项目:OLD-OpenJDK8    文件:LambdaToMethod.java   
ReferenceTranslationContext(JCMemberReference tree) {
    super(tree);
    this.isSuper = tree.hasKind(ReferenceKind.SUPER);
    this.bridgeSym = needsBridge()
            ? makePrivateSyntheticMethod(isSuper ? 0 : STATIC,
                                  referenceBridgeName(), null,
                                  owner.enclClass())
            : null;
    this.sigPolySym = isSignaturePolymorphic()
            ? makePrivateSyntheticMethod(tree.sym.flags(),
                                  tree.sym.name,
                                  bridgedRefSig(),
                                  tree.sym.enclClass())
            : null;
    if (dumpLambdaToMethodStats) {
        String key = bridgeSym == null ?
                "mref.stat" : "mref.stat.1";
        log.note(tree, key, needsAltMetafactory(), bridgeSym);
    }
}
项目:OpenJSharp    文件:Resolve.java   
@Override
ReferenceKind referenceKind(Symbol sym) {
    if (sym.isStatic()) {
        return ReferenceKind.STATIC;
    } else {
        Name selName = TreeInfo.name(referenceTree.getQualifierExpression());
        return selName != null && selName == names._super ?
                ReferenceKind.SUPER :
                ReferenceKind.BOUND;
    }
}
项目:OpenJSharp    文件:LambdaToMethod.java   
ReferenceTranslationContext(JCMemberReference tree) {
    super(tree);
    this.isSuper = tree.hasKind(ReferenceKind.SUPER);
    this.sigPolySym = isSignaturePolymorphic()
            ? makePrivateSyntheticMethod(tree.sym.flags(),
                                  tree.sym.name,
                                  bridgedRefSig(),
                                  tree.sym.enclClass())
            : null;
}
项目:OpenJSharp    文件:LambdaToMethod.java   
/**
 * 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()));
}
项目:openjdk-jdk10    文件:TransTypes.java   
public void visitReference(JCMemberReference tree) {
    Type t = types.skipTypeVars(tree.expr.type, false);
    Type receiverTarget = t.isCompound() ? erasure(tree.sym.owner.type) : erasure(t);
    if (tree.kind == ReferenceKind.UNBOUND) {
        tree.expr = make.Type(receiverTarget);
    } else {
        tree.expr = translate(tree.expr, receiverTarget);
    }

    tree.type = erasure(tree.type);
    if (tree.varargsElement != null)
        tree.varargsElement = erasure(tree.varargsElement);
    result = tree;
}
项目:openjdk-jdk10    文件:Resolve.java   
@Override
ReferenceKind referenceKind(Symbol sym) {
    if (sym.isStatic()) {
        return ReferenceKind.STATIC;
    } else {
        Name selName = TreeInfo.name(referenceTree.getQualifierExpression());
        return selName != null && selName == names._super ?
                ReferenceKind.SUPER :
                ReferenceKind.BOUND;
    }
}
项目:openjdk-jdk10    文件:LambdaToMethod.java   
ReferenceTranslationContext(JCMemberReference tree) {
    super(tree);
    this.isSuper = tree.hasKind(ReferenceKind.SUPER);
    this.sigPolySym = isSignaturePolymorphic()
            ? makePrivateSyntheticMethod(tree.sym.flags(),
                                  tree.sym.name,
                                  bridgedRefSig(),
                                  tree.sym.enclClass())
            : null;
}
项目:openjdk-jdk10    文件:LambdaToMethod.java   
/**
 * 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()));
}
项目:openjdk9    文件:TransTypes.java   
public void visitReference(JCMemberReference tree) {
    Type t = types.skipTypeVars(tree.expr.type, false);
    Type receiverTarget = t.isCompound() ? erasure(tree.sym.owner.type) : erasure(t);
    if (tree.kind == ReferenceKind.UNBOUND) {
        tree.expr = make.Type(receiverTarget);
    } else {
        tree.expr = translate(tree.expr, receiverTarget);
    }

    tree.type = erasure(tree.type);
    if (tree.varargsElement != null)
        tree.varargsElement = erasure(tree.varargsElement);
    result = tree;
}
项目:openjdk9    文件:Resolve.java   
@Override
ReferenceKind referenceKind(Symbol sym) {
    if (sym.isStatic()) {
        return ReferenceKind.STATIC;
    } else {
        Name selName = TreeInfo.name(referenceTree.getQualifierExpression());
        return selName != null && selName == names._super ?
                ReferenceKind.SUPER :
                ReferenceKind.BOUND;
    }
}
项目:openjdk9    文件:LambdaToMethod.java   
ReferenceTranslationContext(JCMemberReference tree) {
    super(tree);
    this.isSuper = tree.hasKind(ReferenceKind.SUPER);
    this.sigPolySym = isSignaturePolymorphic()
            ? makePrivateSyntheticMethod(tree.sym.flags(),
                                  tree.sym.name,
                                  bridgedRefSig(),
                                  tree.sym.enclClass())
            : null;
}
项目:openjdk9    文件:LambdaToMethod.java   
/**
 * 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()));
}
项目:lookaside_java-1.8.0-openjdk    文件:Resolve.java   
@Override
ReferenceKind referenceKind(Symbol sym) {
    if (sym.isStatic()) {
        return ReferenceKind.STATIC;
    } else {
        Name selName = TreeInfo.name(referenceTree.getQualifierExpression());
        return selName != null && selName == names._super ?
                ReferenceKind.SUPER :
                ReferenceKind.BOUND;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:LambdaToMethod.java   
ReferenceTranslationContext(JCMemberReference tree) {
    super(tree);
    this.isSuper = tree.hasKind(ReferenceKind.SUPER);
    this.sigPolySym = isSignaturePolymorphic()
            ? makePrivateSyntheticMethod(tree.sym.flags(),
                                  tree.sym.name,
                                  bridgedRefSig(),
                                  tree.sym.enclClass())
            : null;
}
项目:lookaside_java-1.8.0-openjdk    文件:LambdaToMethod.java   
/**
 * 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()));
}
项目:jsr308-langtools    文件:Resolve.java   
@Override
ReferenceKind referenceKind(Symbol sym) {
    if (sym.isStatic()) {
        return ReferenceKind.STATIC;
    } else {
        Name selName = TreeInfo.name(referenceTree.getQualifierExpression());
        return selName != null && selName == names._super ?
                ReferenceKind.SUPER :
                ReferenceKind.BOUND;
    }
}
项目:jsr308-langtools    文件:LambdaToMethod.java   
ReferenceTranslationContext(JCMemberReference tree) {
    super(tree);
    this.isSuper = tree.hasKind(ReferenceKind.SUPER);
    this.sigPolySym = isSignaturePolymorphic()
            ? makePrivateSyntheticMethod(tree.sym.flags(),
                                  tree.sym.name,
                                  bridgedRefSig(),
                                  tree.sym.enclClass())
            : null;
}
项目:jsr308-langtools    文件:LambdaToMethod.java   
/**
 * 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()));
}
项目:infobip-open-jdk-8    文件:Resolve.java   
@Override
ReferenceKind referenceKind(Symbol sym) {
    if (sym.isStatic()) {
        return ReferenceKind.STATIC;
    } else {
        Name selName = TreeInfo.name(referenceTree.getQualifierExpression());
        return selName != null && selName == names._super ?
                ReferenceKind.SUPER :
                ReferenceKind.BOUND;
    }
}
项目:infobip-open-jdk-8    文件:LambdaToMethod.java   
ReferenceTranslationContext(JCMemberReference tree) {
    super(tree);
    this.isSuper = tree.hasKind(ReferenceKind.SUPER);
    this.sigPolySym = isSignaturePolymorphic()
            ? makePrivateSyntheticMethod(tree.sym.flags(),
                                  tree.sym.name,
                                  bridgedRefSig(),
                                  tree.sym.enclClass())
            : null;
}
项目:infobip-open-jdk-8    文件:LambdaToMethod.java   
/**
 * 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()));
}
项目:OLD-OpenJDK8    文件:Resolve.java   
@Override
ReferenceKind referenceKind(Symbol sym) {
    if (sym.isStatic()) {
        return ReferenceKind.STATIC;
    } else {
        Name selName = TreeInfo.name(referenceTree.getQualifierExpression());
        return selName != null && selName == names._super ?
                ReferenceKind.SUPER :
                ReferenceKind.BOUND;
    }
}
项目:OLD-OpenJDK8    文件:LambdaToMethod.java   
/**
 * the enclosing expression is either 'null' (no enclosing type) or set
 * to the first bridge synthetic parameter
 */
private JCExpression bridgeExpressionNew() {
    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 {
        JCExpression encl = null;
        switch (tree.kind) {
            case UNBOUND:
            case IMPLICIT_INNER:
                encl = make.Ident(params.first());
        }

        //create the instance creation expression
        JCNewClass newClass = make.NewClass(encl,
                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;
    }
}
项目:OpenJSharp    文件:Resolve.java   
@Override
ReferenceKind referenceKind(Symbol sym) {
    return ReferenceKind.UNBOUND;
}
项目:OpenJSharp    文件:Resolve.java   
@Override
ReferenceKind referenceKind(Symbol sym) {
    return ReferenceKind.ARRAY_CTOR;
}
项目:OpenJSharp    文件:Resolve.java   
@Override
ReferenceKind referenceKind(Symbol sym) {
    return site.getEnclosingType().hasTag(NONE) ?
            ReferenceKind.TOPLEVEL : ReferenceKind.IMPLICIT_INNER;
}
项目:openjdk-jdk10    文件:Resolve.java   
@Override
ReferenceKind referenceKind(Symbol sym) {
    return ReferenceKind.UNBOUND;
}
项目:openjdk-jdk10    文件:Resolve.java   
@Override
ReferenceKind referenceKind(Symbol sym) {
    return ReferenceKind.ARRAY_CTOR;
}
项目:openjdk-jdk10    文件:Resolve.java   
@Override
ReferenceKind referenceKind(Symbol sym) {
    return site.getEnclosingType().hasTag(NONE) ?
            ReferenceKind.TOPLEVEL : ReferenceKind.IMPLICIT_INNER;
}
项目:openjdk9    文件:Resolve.java   
@Override
ReferenceKind referenceKind(Symbol sym) {
    return ReferenceKind.UNBOUND;
}