{"record":{"id":"ce620cdaf4f20c45","repo":"apple/pkl","slug":"noimplementationforabstractmethods","errorCode":"noImplementationForAbstractMethods","errorMessage":"noImplementationForAbstractMethods","messagePattern":"noImplementationForAbstractMethods","errorType":"error_code","errorClass":"VmException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/runtime/VmClass.java","lineNumber":173,"sourceCode":"  private void checkAbstractMethods() {\n    if (isAbstract()) return;\n    // minimize allocations in the non-error case\n    var abstractMethods = getAbstractMethods();\n    if (abstractMethods.isEmpty()) return;\n    if (abstractMethods.size() == 1) {\n      throw new VmExceptionBuilder()\n          .evalError(\n              \"noImplementationForAbstractMethod\",\n              getDisplayName(),\n              abstractMethods.get(0).getCallSignature())\n          .withSourceSection(getHeaderSection())\n          .build();\n    }\n    var methodList = new ArrayList<String>(abstractMethods.size());\n    for (var method : abstractMethods) {\n      methodList.add(method.getCallSignature());\n    }\n    throw new VmExceptionBuilder()\n        .evalError(\n            \"noImplementationForAbstractMethods\", getDisplayName(), MultilineValue.of(methodList))\n        .withSourceSection(getHeaderSection())\n        .build();\n  }\n\n  private List<ClassMethod> getAbstractMethods() {\n    assert this.superclass != null;\n    var result = new ArrayList<ClassMethod>();\n    var methodCursor = getAllMethods().getEntries();\n    while (methodCursor.advance()) {\n      var method = methodCursor.getValue();\n      if (method.isAbstract()) {\n        result.add(method);\n      }\n    }\n    return result;\n  }","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/runtime/VmClass.java#L155-L191","documentation":"Same check as `noImplementationForAbstractMethod`, but when two or more abstract methods remain unimplemented, `VmClass.checkAbstractMethods` throws `noImplementationForAbstractMethods` with the class name and a multiline list of all missing method signatures.","triggerScenarios":"A concrete class extends an abstract class (or implements an interface) and leaves two or more abstract methods unimplemented, detected at class fully-initialization time.","commonSituations":"Creating a minimal stub subclass of a rich abstract base type and forgetting several overrides; interface churn in a shared library adding multiple abstract members; copy-pasting a partial skeleton class.","solutions":["Implement every method listed in the error's multiline signature list in the concrete class.","Mark the class `abstract` if it is not meant to be instantiated directly.","Fix method name/parameter-list mismatches so existing overrides actually satisfy the abstract declarations.","Use the IDE's quick-fix/generate-override support to implement all inherited abstract members at once."],"exampleFix":"// before\nabstract class Base {\n  abstract function a(): String\n  abstract function b(): Int\n}\nclass Impl extends Base {}\n// after\nclass Impl extends Base {\n  function a(): String = \"a\"\n  function b(): Int = 1\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// require subclasses to implement every listed abstract signature before use;\n// validate in CI by evaluating (not just compiling) every concrete module:\n// pkl eval **/*.pkl --no-cache // forces class initialization, surfacing missing overrides","tryCatchPattern":"catch (EvalError e) {\n  if (e.getMessage().contains(\"noImplementationForAbstractMethods\")) {\n    // implement each signature in the multiline list, or mark the class abstract\n  }\n}","preventionTips":["Evaluate all modules in CI so missing overrides fail the build, not production.","Use IDE generate-override to implement all abstract members at once.","Avoid partial stub classes; mark unfinished classes `abstract` explicitly."],"tags":["pkl","classes","abstract-method","inheritance"],"backgroundTag":"abstract-method-not-implemented","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}