如何创建具有CAPTURE绑定的AST? [英] How to create an AST with a CAPTURE binding?

查看:216
本文介绍了如何创建具有CAPTURE绑定的AST?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有兴趣使用Eclipse JDT创建一个

如何实现?

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

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

class CaptureTest {
public void rebox(Box<?> box){
box.get(); //返回类型的get()是一个捕获绑定
}
}


I am interested in using the Eclipse JDT to create a CAPTURE binding.

I've read several capture conversion tutorials, but when I copy-paste sample code snippets, I can never find a capture conversion binding in the Abstract Syntax Tree (using the plugin ASTView for visualizing the AST).

How can this be accomplished?

解决方案

Example provided by Deepak Azad @ Eclipse Forums:

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
    }
}

这篇关于如何创建具有CAPTURE绑定的AST?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆