How to create an AST with a CAPTURE binding?
Asked Answered
P

1

7

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?

Pope answered 15/12, 2010 at 11:55 Comment(0)
P
7

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
    }
}
Pope answered 15/12, 2010 at 16:7 Comment(1)
This example came from Java theory and practice: Going wild with generics, Part 1.Melaniamelanic

© 2022 - 2024 — McMap. All rights reserved.