Interface ExprMirror.BranchingMirror
-
- All Superinterfaces:
ExprMirror
,ExprMirror.PolyExprMirror
- Enclosing interface:
- ExprMirror
public static interface ExprMirror.BranchingMirror extends ExprMirror.PolyExprMirror
Mirrors a conditional or switch expression.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.sourceforge.pmd.lang.java.types.internal.infer.ExprMirror
ExprMirror.BranchingMirror, ExprMirror.CtorInvocationMirror, ExprMirror.FunctionalExprMirror, ExprMirror.InvocationMirror, ExprMirror.LambdaExprMirror, ExprMirror.MethodRefMirror, ExprMirror.PolyExprMirror, ExprMirror.TypeSpecies
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
branchesMatch(Predicate<? super ExprMirror> condition)
Returns true if every result expression matches the given predicate.default boolean
isEquivalentToUnderlyingAst()
Returns true if this mirror and its subexpressions are equivalent to the underlying AST node.default void
setStandalone()
Record on the AST node that is is a standalone expression.-
Methods inherited from interface net.sourceforge.pmd.lang.java.types.internal.infer.ExprMirror
finishStandaloneInference, getInferredType, getLocation, getStandaloneSpecies, getTypingContext, setInferredType
-
Methods inherited from interface net.sourceforge.pmd.lang.java.types.internal.infer.ExprMirror.PolyExprMirror
getEnclosingType, getStandaloneType, unresolvedType
-
-
-
-
Method Detail
-
branchesMatch
boolean branchesMatch(Predicate<? super ExprMirror> condition)
Returns true if every result expression matches the given predicate.
-
setStandalone
default void setStandalone()
Record on the AST node that is is a standalone expression. This accounts for special cases in the spec which are made for numeric and boolean conditional expressions. For those types of standalone exprs, the branches may have an additional implicit unboxing/widening conversion, that does not depend on the usual target type (the context of the ternary itself), but just on the other branch.
-
isEquivalentToUnderlyingAst
default boolean isEquivalentToUnderlyingAst()
Description copied from interface:ExprMirror
Returns true if this mirror and its subexpressions are equivalent to the underlying AST node. This is only relevant when making mirrors that are not exactly equal to the AST node (eg, omitting explicit type arguments), in order to check if the transformation does not change the meaning of the program. It verifies that method and constructor calls are overload-selected to the same compile-time declaration, and that nested lambdas have the same type as in the AST.This mirror's state, as filled-in during type resolution by
Infer
using the various setters ofExprMirror
interfaces, is compared to the AST's corresponding state. Consequently, if this state is missing (meaning, that no overload resolution has been run using this mirror), the analysis cannot be performed and an exception is thrown.- Specified by:
isEquivalentToUnderlyingAst
in interfaceExprMirror
-
-