apple/pkl · warning
Method `${qualifiedName}` is deprecated: ${deprecation}
Error message
Method `${qualifiedName}` is deprecated: ${deprecation} What it means
ClassMethod.reportDeprecation fires when Pkl code calls a class method marked deprecated. It logs a warning naming the qualified method and any custom deprecation text, with a stack frame at the call site; evaluation continues normally.
Source
Thrown at pkl-core/src/main/java/org/pkl/core/ast/member/ClassMethod.java:80
this.deprecation = deprecation;
}
public void initFunctionNode(FunctionNode functionNode) {
//noinspection ConstantValue
assert this.functionNode == null;
this.functionNode = functionNode;
}
public CallTarget getCallTarget() {
return functionNode.getCallTarget();
}
@TruffleBoundary
private void reportDeprecation(SourceSection callSite) {
assert deprecation != null;
var logger = VmContext.get(null).getLogger();
logger.warn(
"Method `"
+ qualifiedName
+ "` is deprecated"
+ (deprecation.isEmpty() ? "" : ": " + deprecation),
VmUtils.createStackFrame(callSite, null));
}
public CallTarget getCallTarget(SourceSection callSite) {
if (deprecation != null) {
reportDeprecation(callSite);
}
return functionNode.getCallTarget();
}
@Override
public CallTarget getCallTarget(SourceSection callSite, VmObjectLike owner) {
return getCallTarget(callSite);
}View on GitHub (pinned to f3efcbfc9b)
Solutions
- Replace calls to the deprecated method with the replacement named in the deprecation text.
- Check the class/method documentation for the recommended alternative.
- Suppress only if intentional, and plan removal before the next major release.
- Enable warning visibility in your tooling to find all call sites.
Example fix
// before (Pkl) oldList.sortInPlace() // deprecated // after newList.sort() // use replacement per deprecation message
Defensive patterns
Strategy: validation
Validate before calling
// grep Pkl sources for known deprecated method calls before evaluation grep -rn "oldList.sortInPlace\|deprecatedMethod" src/main/pkl && exit 1 || true
Prevention
- Read deprecation messages for the recommended replacement
- Track pkl dependency changelogs for new deprecations
- Fail builds on deprecation warnings where feasible
- Prefer stable/replacement APIs in new code
When it happens
Trigger: Any Pkl evaluation whose code calls a method annotated with @Deprecated { ... } — the warning is emitted at the call site each time getCallTarget resolves a deprecated method.
Common situations: Using library or stdlib methods superseded by newer APIs, upgrading a Pkl dependency where methods were deprecated, static-analysis sweeps for future removals.
Understand the failure class
Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.
Related errors
- ${errorMessage} This will be an error in a future release.
- Node `%s` of type `%s` does not have a property named `%s`.
- JavaType token must be parameterized.
- Leaf node `%s` of type `%s` does not have a child named `%s`
- Node `%s` of type `%s` does not have a key named `%s`. Avail
AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08).
Data as JSON: /api/errors/4d8f88a828f7b06d.
Report an issue: GitHub.