Apache NetBeans Wiki Index

Note: These pages are being reviewed.

As was mentioned above, it is not possible to hold Elements, TypeMirrors and Trees and to compare instances got from different javac instances.

To solve this limitation, ElementHandle and TreePathHandlewas introduced. The TreePathHandle allows to pass an TreePath from one javac instance to another. In the first instance of javac, create the handle using TreePathHandle.create(Element, CompilationInfo) method. Keep the resulting handle, but do not hold the tree or tree path itself. In the other instance of javac, use TreePathHandle.resolve(CompilationInfo) method to resolve the TreePathHandle back to the TreePath.