Github user aljoscha commented on the issue:

    https://github.com/apache/flink/pull/3479
  
    One quick initial remark: instead of each time having an anonymous inner 
class for the `Context` you can create a reusable class for that like this:
    ```
    class InternalProcessWindowContext<IN, OUT, KEY, W extends Window>
            extends ProcessWindowFunction<IN, OUT, KEY, W>.Context {
    
        W window;
        InternalWindowFunction.InternalWindowContext internalContext;
    
        InternalProcessWindowContext(ProcessWindowFunction<IN, OUT, KEY, W> 
function) {
            function.super();
        }
    
        @Override
        public W window() {
            return window;
        }
    
        @Override
        public KeyedStateStore windowState() {
            return internalContext.windowState();
        }
    
        @Override
        public KeyedStateStore globalState() {
            return internalContext.globalState();
        }
    }
    ```
    
    The `function.super()` call in there makes it work even though `Context` is 
itself defined as an inner abstract class of `ProcessWindowFunction`. It's a 
bit of black magic and not really too well known, I think. 😉


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to