< prev index next > src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
Print this page
/*
! * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
/*
! * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@Override
public void visitLambda(JCLambda tree) {
Check.CheckContext checkContext = resultInfo.checkContext;
Type pt = resultInfo.pt;
! if (!inferenceContext.inferencevars.contains(pt)) {
//must be a functional descriptor
Type descriptorType = null;
try {
descriptorType = types.findDescriptorType(pt);
} catch (Types.FunctionDescriptorLookupError ex) {
@Override
public void visitLambda(JCLambda tree) {
Check.CheckContext checkContext = resultInfo.checkContext;
Type pt = resultInfo.pt;
! if (!types.isQuoted(pt) && !inferenceContext.inferencevars.contains(pt)) {
//must be a functional descriptor
Type descriptorType = null;
try {
descriptorType = types.findDescriptorType(pt);
} catch (Types.FunctionDescriptorLookupError ex) {
/**
* A special tree scanner that would only visit portions of a given tree.
* The set of nodes visited by the scanner can be customized at construction-time.
*/
! abstract static class FilterScanner extends com.sun.tools.javac.tree.TreeScanner {
final Predicate<JCTree> treeFilter;
! FilterScanner(final Set<JCTree.Tag> validTags) {
this.treeFilter = t -> validTags.contains(t.getTag());
}
@Override
public void scan(JCTree tree) {
/**
* A special tree scanner that would only visit portions of a given tree.
* The set of nodes visited by the scanner can be customized at construction-time.
*/
! public abstract static class FilterScanner extends com.sun.tools.javac.tree.TreeScanner {
final Predicate<JCTree> treeFilter;
! protected FilterScanner(final Set<JCTree.Tag> validTags) {
this.treeFilter = t -> validTags.contains(t.getTag());
}
@Override
public void scan(JCTree tree) {
}
/**
* handler that is executed when a node has been discarded
*/
! void skip(JCTree tree) {}
}
/**
* A tree scanner suitable for visiting the target-type dependent nodes of
* a given argument expression.
}
/**
* handler that is executed when a node has been discarded
*/
! protected void skip(JCTree tree) {}
}
/**
* A tree scanner suitable for visiting the target-type dependent nodes of
* a given argument expression.
@Override
public void visitLambda(JCLambda tree) {
if (inferenceContext.inferenceVars().contains(pt)) {
stuckVars.add(pt);
}
! if (!types.isFunctionalInterface(pt)) {
return;
}
Type descType = types.findDescriptorType(pt);
List<Type> freeArgVars = inferenceContext.freeVarsIn(descType.getParameterTypes());
if (tree.paramKind == JCLambda.ParameterKind.IMPLICIT &&
@Override
public void visitLambda(JCLambda tree) {
if (inferenceContext.inferenceVars().contains(pt)) {
stuckVars.add(pt);
}
! if (types.isQuoted(pt) || !types.isFunctionalInterface(pt)) {
return;
}
Type descType = types.findDescriptorType(pt);
List<Type> freeArgVars = inferenceContext.freeVarsIn(descType.getParameterTypes());
if (tree.paramKind == JCLambda.ParameterKind.IMPLICIT &&
< prev index next >