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

  1. Replace calls to the deprecated method with the replacement named in the deprecation text.
  2. Check the class/method documentation for the recommended alternative.
  3. Suppress only if intentional, and plan removal before the next major release.
  4. 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

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


AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08). Data as JSON: /api/errors/4d8f88a828f7b06d. Report an issue: GitHub.