{"record":{"id":"db25538e2cf0bd09","repo":"apache/pulsar","slug":"not-implemented-db2553","errorCode":null,"errorMessage":"Not implemented","messagePattern":"Not implemented","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/windowing/WindowLifecycleListener.java","lineNumber":46,"sourceCode":"public interface WindowLifecycleListener<T> {\n    /**\n     * Called on expiry of events from the window due to {@link EvictionPolicy}.\n     *\n     * @param events the expired events\n     */\n    void onExpiry(List<T> events);\n\n    /**\n     * Called on activation of the window due to the {@link TriggerPolicy}.\n     *\n     * @param events the list of current events in the window.\n     * @param newEvents the newly added events since last activation.\n     * @param expired the expired events since last activation.\n     * @param referenceTime the reference (event or processing) time that resulted in activation\n     */\n    default void onActivation(List<T> events, List<T> newEvents, List<T> expired, Long\n            referenceTime) {\n        throw new UnsupportedOperationException(\"Not implemented\");\n    }\n}\n","sourceCodeStart":28,"sourceCodeEnd":49,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/windowing/WindowLifecycleListener.java#L28-L49","documentation":"WindowLifecycleListener.onActivation is a default interface method that throws UnsupportedOperationException to force implementers to override the activation callback. It fires when the WindowManager activates a window (new events arrived or a window fired) and the listener implementation has not overridden this method.","triggerScenarios":"Passing a WindowLifecycleListener (often an anonymous class) that overrides only onEvents/onExpiry but not onActivation, when the window manager calls onActivation during window processing in tests such as testWindowFunctionWithAtleastOnce.","commonSituations":"Implementing the interface before the onActivation default was added (older custom code) and relying on the default; writing a minimal test stub listener and forgetting the activation callback.","solutions":["Override onActivation in your WindowLifecycleListener implementation with real (or no-op) logic.","If no activation behavior is needed, override it with an empty method body.","Update custom listener implementations that were written against an older interface version."],"exampleFix":"// before\nWindowLifecycleListener<WindowedValue<String>> l = new WindowLifecycleListener<>() {\n    public void onEvents(List<WindowedValue<String>> events) { ... }\n};\n// after\nWindowLifecycleListener<WindowedValue<String>> l = new WindowLifecycleListener<>() {\n    public void onEvents(List<WindowedValue<String>> events) { ... }\n    @Override\n    public void onActivation(List<WindowedValue<String>> events, List<WindowedValue<String>> newEvents,\n                             List<WindowedValue<String>> expired, Long referenceTime) { /* handle or no-op */ }\n};","handlingStrategy":"validation","validationCode":"// pre-deploy check\nclass MyListener extends WindowLifecycleListener<String> {\n    @Override public void onActivation(List<String> e, List<String> n, List<String> x, Long t) { /* impl */ }\n}","typeGuard":"static boolean overridesActivation(WindowLifecycleListener<?> l) {\n    try {\n        return !WindowLifecycleListener.class.getMethod(\"onActivation\", List.class, List.class, List.class, Long.class)\n            .getDeclaringClass().equals(WindowLifecycleListener.class);\n    } catch (NoSuchMethodException ex) { return false; }\n}","tryCatchPattern":"try { windowManager.process(...) } catch (UnsupportedOperationException e) {\n    log.error(\"Listener missing onActivation override\", e);\n}","preventionTips":["Override all interface callbacks, not just the ones used today.","Write a test that drives window activation through the listener.","Keep listener implementations updated with interface default-method changes."],"tags":["java","unsupported-operation","pulsar-functions","windowing"],"backgroundTag":"unsupported-operation","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}