7

我对使用 Eclipse JDT 创建CAPTURE绑定很感兴趣。

我已经阅读了几个捕获转换教程,但是当我复制粘贴示例代码片段时,我永远无法在抽象语法树中找到捕获转换绑定(使用插件 ASTView 来可视化 AST)。

如何实现?

4

1 回答 1

7

Deepak Azad @ Eclipse 论坛提供的示例:

interface Box<T> {
    public T get();
    public void put( T element);
}

class CaptureTest {
    public void rebox( Box<?> box) {
        box.get(); // return type of get() is a capture binding
    }
}
于 2010-12-15T16:07:31.397 回答