Class InferenceBudgetExceededError
java.lang.Object
java.lang.Throwable
java.lang.Error
org.checkerframework.framework.util.typeinference8.util.InferenceBudgetExceededError
- All Implemented Interfaces:
Serializable
Thrown when a single inference problem performs more bound-incorporation work than
Java8InferenceContext.MAX_INCORPORATION_WORK allows.
Java 8 type-argument inference incorporates bounds to a fixed point (JLS 18.3). For deeply nested generic invocations this fixed point is reached only after work that grows roughly with the cube of the nesting depth, so a single pathological (often machine-generated) invocation can take many seconds or effectively hang the compiler. The budget caps that work and abandons inference soundly instead.
This extends Error rather than RuntimeException on purpose: the abort has to
unwind past the catch (Exception) and catch (FalseBoundException) blocks in the
incorporation/resolution machinery (which would otherwise swallow it or retry the blowup) and be
handled only at the inferTypeArgs entry point.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInferenceBudgetExceededError(int work, int budget) Creates an InferenceBudgetExceededError. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
InferenceBudgetExceededError
public InferenceBudgetExceededError(int work, int budget) Creates an InferenceBudgetExceededError.- Parameters:
work- the amount of incorporation work performed when the budget was exceededbudget- the budget that was exceeded
-