APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.tools.javac.comp

public Class DeferredAttr

extends Visitor
Class Inheritance
Imports
com.sun.source.tree.AnnotatedTypeTree, .LambdaExpressionTree.BodyKind, .NewClassTree, .MemberReferenceTree, .ModifiersTree, com.sun.tools.javac.code.*, .Type.ErrorType, .Type.MethodType, .Type.StructuralTypeMapping, .Types.TypeMapping, .Type, com.sun.tools.javac.comp.ArgumentAttr.LocalCacheContext, .Infer.GraphSolver.InferenceGraph, .Resolve.ResolveError, .Attr.ResultInfo, .Resolve.MethodResolutionPhase, .Annotate.Queues, com.sun.tools.javac.resources.CompilerProperties.Fragments, .CompilerProperties.Errors, com.sun.tools.javac.tree.*, com.sun.tools.javac.tree.JCTree.*, .JCTree.JCMemberReference.OverloadKind, com.sun.tools.javac.util.*, .DefinedBy.Api, .GraphUtils.DependencyKind, .JCDiagnostic.DiagnosticPosition, .JCDiagnostic.DiagnosticType, .Log.DeferredDiagnosticHandler, .Log.DiagnosticHandler, java.util.ArrayList, .Collection, .Collections, .EnumSet, .HashSet, .LinkedHashSet, .Map, .Set, .WeakHashMap, java.util.function.Predicate, .Supplier

This is an helper class that is used to perform deferred type-analysis. Each time a poly expression occurs in argument position, javac attributes it with a temporary 'deferred type' that is checked (possibly multiple times) against an expected formal type.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum
DeferredAttr.AttributionMode

Mode of attribution (used in AttrContext).

public static enum
DeferredAttr.AttrMode

The 'mode' in which the deferred type is to be type-checked

pack-priv class
DeferredAttr.CheckStuckPolicy

This visitor is used to check that structural expressions conform to their target - this step is required as inference could end up inferring types that make some of the nested expressions incompatible with their corresponding instantiated target

pack-priv class
DeferredAttr.DeferredAttrContext

A deferred context is created on each method check.

pack-priv static class
pack-priv class
DeferredAttr.DeferredAttrNode

Class representing a deferred attribution node.

pack-priv static interface
DeferredAttr.DeferredStuckPolicy

Policy for detecting stuck expressions.

public class
DeferredAttr.DeferredType

This type represents a deferred type.

pack-priv class
DeferredAttr.DeferredTypeMap<T>

Map a list of types possibly containing one or more deferred types into a list of ordinary types.

pack-priv abstract static class
DeferredAttr.FilterScanner

A special tree scanner that would only visit portions of a given tree.

pack-priv static class
DeferredAttr.LambdaReturnScanner

A tree scanner suitable for visiting the target-type dependent nodes nested within a lambda expression body.

pack-priv class
DeferredAttr.OverloadStuckPolicy

This visitor is used to check that structural expressions conform to their target - this step is required as inference could end up inferring types that make some of the nested expressions incompatible with their corresponding instantiated target

pack-priv static class
DeferredAttr.PolyScanner

A tree scanner suitable for visiting the target-type dependent nodes of a given argument expression.

public class
DeferredAttr.RecoveryDeferredTypeMap

Specialized recovery deferred mapping.

pack-priv static class
DeferredAttr.SwitchExpressionScanner

A tree scanner suitable for visiting the target-type dependent nodes nested within a switch expression body.

private static class

Field Summary

Modifier and TypeField and Description
pack-priv final Annotate
pack-priv final ArgumentAttr
pack-priv final Attr
pack-priv final Check
pack-priv final DeferredCompletionFailureHandler
protected static final Context.Key<DeferredAttr>
pack-priv final Types.TypeMapping<Void>
pack-priv final JCDiagnostic.Factory
pack-priv DeferredAttr.DeferredStuckPolicy
dummyStuckPolicy

Basic stuck policy; an expression is never considered to be stuck.

pack-priv final DeferredAttr.DeferredAttrContext
emptyDeferredAttrContext

an empty deferred attribution context - all methods throw exceptions

pack-priv final Enter
pack-priv final Flow
pack-priv final Infer
pack-priv final Log
pack-priv final TreeMaker
pack-priv final Names
pack-priv final Resolve
pack-priv final JCTree
stuckTree

shared tree for stuck expressions

pack-priv final Symtab
pack-priv final TreeCopier<Void>
pack-priv final TypeEnvs
pack-priv final Types

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
pack-priv JCTree
attribSpeculative(JCTree tree, Env<AttrContext> env, Attr.ResultInfo resultInfo)

Routine that performs speculative type-checking; the input AST node is cloned (to avoid side-effects cause by Attr) and compiler state is restored after type-checking.

pack-priv JCTree
pack-priv <Z> JCTree
attribSpeculative(JCTree tree, Env<AttrContext> env, Attr.ResultInfo resultInfo, TreeCopier<Z> deferredCopier, Supplier<Log.DiagnosticHandler> diagHandlerCreator, DeferredAttr.AttributionMode attributionMode, ArgumentAttr.LocalCacheContext localCache)

pack-priv <Z> JCTree
attribSpeculative(JCTree tree, Env<AttrContext> env, Attr.ResultInfo resultInfo, Supplier<Log.DiagnosticHandler> diagHandlerCreator, DeferredAttr.AttributionMode attributionMode, ArgumentAttr.LocalCacheContext localCache)

Attribute the given tree, mostly reverting side-effects applied to shared compiler state.

pack-priv JCTree.JCLambda
attribSpeculativeLambda(JCTree.JCLambda that, Env<AttrContext> env, Attr.ResultInfo resultInfo)

Performs speculative attribution of a lambda body and returns the speculative lambda tree, in the absence of a target-type.

private boolean
public static DeferredAttr
instance(Context context)

Inherited from com.sun.tools.javac.tree.JCTree.Visitor:
visitAnnotatedTypevisitAnnotationvisitAnyPatternvisitApplyvisitAssertvisitAssignvisitAssignopvisitBinaryvisitBindingPatternvisitBlockvisitBreakvisitCasevisitCatchvisitClassDefvisitConditionalvisitConstantCaseLabelvisitContinuevisitDefaultCaseLabelvisitDoLoopvisitErroneousvisitExecvisitExportsvisitForeachLoopvisitForLoopvisitIdentvisitIfvisitImportvisitIndexedvisitLabelledvisitLambdavisitLetExprvisitLiteralvisitMethodDefvisitModifiersvisitModuleDefvisitModuleImportvisitNewArrayvisitNewClassvisitOpensvisitPackageDefvisitParensvisitPatternCaseLabelvisitProvidesvisitRecordPatternvisitReferencevisitRequiresvisitReturnvisitSelectvisitSkipvisitSwitchvisitSwitchExpressionvisitSynchronizedvisitThrowvisitTopLevelvisitTreevisitTryvisitTypeApplyvisitTypeArrayvisitTypeBoundKindvisitTypeCastvisitTypeIdentvisitTypeIntersectionvisitTypeParametervisitTypeTestvisitTypeUnionvisitUnaryvisitUsesvisitVarDefvisitVarTypevisitWhileLoopvisitWildcardvisitYield