Class ExprContext
java.lang.Object
net.sourceforge.pmd.lang.java.types.ast.ExprContext
Context of an expression. This determines the target type of poly
expressions, which is necessary for overload resolution. It also
determines what kinds of conversions apply to the value to make it
compatible with the context.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptsType(@NonNull JTypeMirror type) Returns true if the given type is compatible with this context implicitly (without cast).@Nullable InvocationNodegetKind()Returns the kind of context this is.static net.sourceforge.pmd.lang.java.types.ast.internal.RegularCtxReturns anExprContextinstance which represents a missing context.@Nullable JTypeMirrorgetPolyTargetType(boolean lambdaOrMethodRef) Returns the target type bestowed by this context ON A POLY EXPRESSION.abstract @Nullable JTypeMirrorReturns the target type, or null if there is none.@NonNull ExprContextbooleanbooleanReturns true if this context does not provide any target type.
-
Field Details
-
kind
-
-
Constructor Details
-
ExprContext
-
-
Method Details
-
getTargetType
Returns the target type, or null if there is none. -
acceptsType
Returns true if the given type is compatible with this context implicitly (without cast). Conversions may occur to make this possible. What conversions may occur depends on the kind of this context.By convention, any type is compatible with a missing context.
- Parameters:
type- A type which is checked against the target type
-
isMissing
public boolean isMissing()Returns true if this context does not provide any target type. This is then a sentinel object. -
getKind
Returns the kind of context this is. -
getInvocNodeIfInvocContext
-
getToplevelCtx
-
getPolyTargetType
Returns the target type bestowed by this context ON A POLY EXPRESSION.- Parameters:
lambdaOrMethodRef- Whether the poly to be considered is a lambda or method ref. In this case, cast contexts can give a target type.
-
getMissingInstance
public static net.sourceforge.pmd.lang.java.types.ast.internal.RegularCtx getMissingInstance()Returns anExprContextinstance which represents a missing context. UseisMissing()instead of testing for equality. -
hasKind
-